visaxx
visaxx

Reputation: 3

correct number of instruction cycles and time? ASM PIC F18

Can someone please just check if my answer is correct? :)

The question is:

How long will it take for the following subroutine to execute if we use a 12 MHz crystal frequency on a F18 PIC?

movlw .20
movwf n

again: 
decf n,f
bnz again
nop
nop
rlncf n,w
movwf PORTC
nop
return

My answer is:

22.66 ns which is about 23 ns.

We have 68 instruction cycles, right? And then one cycle will take .33333 ns??

Upvotes: 0

Views: 222

Answers (1)

GJ.
GJ.

Reputation: 10937

1 / 12000000 Hz * 4 = 0.33333 us and not 0.33333 ns. So the right result is 22.6666 us or about 23 us.

Upvotes: 1

Related Questions