PIC18F Bit clear problem

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
Hi everyone,

Im currently programming a pic using assembly. Now for some reason the BCF instruction only seems to execute after a specific delay. For example:

Rich (BB code):
LOOP    BSF     PORTA,0
        BCF     PORTA,0
        GOTO    LOOP
This does not appear to work at all! If however I write to the port directly (such as movlw 0x01 and then mowf porta) it works fine. What is going on???
 

atferrari

Joined Jan 6, 2004
5,026
Hola MITCH, the setting/resetting of bits in the respective LATch is explained as the solution of that problem, somewhere in their manuals for the 18F.

Every time, identify TRIS to change IO direction / PORT to read input / LAT to write output. After that you can FORGET the RMW problem.

You were lucky: given the right conditions you could have had changes in the port. :eek: Much worst.
 
Top