# How do we calculate instruction execution time for PIC micro-controllers?

Status
Not open for further replies.

#### sush

##### Member level 4
hi,
I'm a newcomer to PIC, but i know 8051. as i've just started there is question in my mind,
For calculating time taken by an instruction to execute, in 8051, we use formula:-
Time, t = (No. of clock cycles x 12)/ (Xtal Frequency)
For example :- in case of timer suppose TH0=1Eh & TL0=2Ch or TMR=1E2Ch = 7724d; & crystal frequency=24MHz, then
time, t= 7724x12/24e6=3.862 mSecs
How do we calculate this in case of PIC micro-controllers, is it:- t= (No. of clock cycles x 4)/ (Xtal Frequency)??

Thanks

#### sp

##### Full Member level 6
newcomer to PIC

the time period for each assembly instruction in the PIC is

Code:
the inverse of [crystal_clk/4]

#### saudrehman

##### Member level 1
Re: newcomer to PIC

In Pic the external clock frequency is internally divided By four and this is the main clock used inside the controller.
This is true for all Pic controllers though new ones have a PLL option.
hence instruction time will be 1/(clock frequency/4)

Status
Not open for further replies.