[Ktechlab-devel] instruction cycles

deifo at ono.com deifo at ono.com
Fri Feb 17 14:28:45 UTC 2006


Recently I was experimenting with little programs and KTechLab, but sometimes
strange things happen.
For example, why is this program producing a perfect square wave in RA4 output?

loop:
    BSF       PORTA, 4
    BCF       PORTA,4
    GOTO      loop

According to the pic specification, GOTO should take 2 cycles and B?F should
take only 1 cycle.

To correct this, we must add two NOP's after BSF, is this correct?
With this little program we should have a perfect square wave on the RA4
pin.

loop:
    BSF       PORTA, 4
    NOP
    NOP
    BCF       PORTA,4
    GOTO      loop






More information about the Ktechlab-devel mailing list