hugo movlw 0x14
movwf n
igen decf n,f
bnz igen
nop
nop
rlncf n,w
movwf portC
nop
return
Your loop counter is 20 (0x14) so it will take a'lot longer than 11/12 cycles.
movlw 0x14 <--- 1 x 1
movf n <--- 1 x 1
igen decf n,f <----1 x 20
bnz igen <----2 x 20
nop <----1 x 1
nop <----1 x 1
rlncf n,w <----1 x 1
movwf portC <----1 x 1
return <----1 x 2
Hi,
The Stopwatch I showed was run on a 18F because the code you gave used 18F instructions, RLFCF
If I run your latest code on a 16F877a then I agree with what you got.
Question for you - how long is 1 instruction cycle and where does it come from..?
movlw 0x14 <--- 1 x 1
movf n <--- 1 x 1
igen decf n,f <----1 x 20
btfss STATUS, Z <----1 x 19 + 1 x 2
goto igen <----2 x 19
; bnz igen <---- No such instruction on PIC16
nop <----1 x 1
nop <----1 x 1
rlcf n,w <----1 x 1
movwf portC <----1 x 1
return <----1 x 2
= 88
movlw 0x14 <--- 1 x 1
movf n <--- 1 x 1
igen decf n,f <----1 x 20
btfss STATUS, Z <----1 x 19 + 1 x 2
goto igen <----2 x 19
; bnz igen <---- No such instruction on PIC16
nop <----1 x 1
nop <----1 x 1
rlcf n,w <----1 x 1
movwf portC <----1 x 1
return <----1 x 2
= 88
Hi,
Hmmm, missed the BNZ insruction and with the 16F877 it does not show a compile error ??
So you replaced bnz with goto?
movlw 0x14 <--- 1 x 1
movf n <--- 1 x 1
igen decf n,f <----1 x 20
bnz igen <----2 x 19 + (1 x 1)
nop <----1 x 1
nop <----1 x 1
rlncf n,w <----1 x 1
movwf portC <----1 x 1
return <----1 x 2
= 67
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?