View previous topic :: View next topic |
Author |
Message |
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
instruction time? |
Posted: Fri Oct 05, 2012 6:15 am |
|
|
What is the formula calculating the time needed for one instruction? |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Fri Oct 05, 2012 6:19 am |
|
|
I'm assuming you mean assembler instructions not 'C'.
By and large, instructions take one instuction cycle, except jumps which take two. One instruction cycle being four oscillator clock cycles.
Mike |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9240 Location: Greensville,Ontario
|
|
Posted: Fri Oct 05, 2012 6:31 am |
|
|
ie: if using a 4MHz xtal each instruction will take 1usec, except jumps as Mike noted.
if you refer to the datasheet for your PIC there's an entire section that details the 'instruction set'.
hth
jay |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Oct 05, 2012 9:01 am |
|
|
The MPLAB IDE has a Stopwatch function which I often use when I want to time a sequence of instructions. This also works in the Simulator, so no actual hardware is needed. |
|
|
|