Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Discussion Groups

Discussion Groups | Piclist | Calculating PIC instruction speed

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Calculating PIC instruction speed - Nelson Viegas - Apr 28 19:28:34 2008


Hello group!

Although I'm able to do some stuff using PIC microcontrollers, I still
don't know to calculate how long does a PIC instruction takes to
execute! God knows I've been up and down the PIC16F628A datasheet and
maybe it's because I'm kinda of a noob, but I was unable to figure it
out.

Can anybody shed some light on this?

Thanks!

Best regards,
Nelson

------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Calculating PIC instruction speed - "John J. McDonough, WB8RCR" - Apr 28 20:10:42 2008


----- Original Message -----
From: "Nelson Viegas"
To:
Sent: Thursday, April 17, 2008 12:40 PM
Subject: [piclist] Calculating PIC instruction speed
> Hello group!
>
> Although I'm able to do some stuff using PIC microcontrollers, I still
> don't know to calculate how long does a PIC instruction takes to
> execute! God knows I've been up and down the PIC16F628A datasheet and
> maybe it's because I'm kinda of a noob, but I was unable to figure it
> out.
>
> Can anybody shed some light on this?
>

Actually, it is pretty simple. Each instruction takes 4 clock cycles, so if
your clock is 4 MHz, each instruction takes 1 microsecond. However, any
instruction that poisons the pipeline takes an extra instruction time. So a
call will take 2 microseconds. A conditional branch will take 1 microsecond
if the branch is not taken, two if it is. Any time the next instruction is
not the next instruction in memory, then it takes an extra instruction time.
Also, modifying the program counter causes an extra instruction time, even
if the next instruction is the next in line.

But wait, there's an easier way. In the MPLAB simulator, there is a
stopwatch. Simply set breakpoints around the code you want to time, and
zero the stopwatch at the first breakpoint.

72/73 de WB8RCR http://www.qsl.net/wb8rcr
didileydadidah QRP-L #1446 Code Warriors #35
------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )