Friends,
As my earlier post was not proper formated, I post the same again. Please see a portion of the codes that I have used in a project. Every thing is OK. But in a very rare case the processor behaves in improper way.If a condition of a bit test is fulfilled, the processor jumps to INV_ON where PORTA, 2 is set and then PORTC is cleared. Sometimes it is noticed that on jump of the processor to INV_ON, the first instruction to set PORTA, 2 is not carried out. But the next instructions from CLRF PORTC onwards is carried out. Is there any chance for the processor to slip over the first instruction after jumping to INV_ON? If so, could it be eliminated by using some NOPs before the first instruction?
I had problems with bit-setting too.
The answer was to perform an operation such as:
Code:
movlw 04h
xorwf portA
However this is just a toggle operation and you must be sure bit 2 is 0 before the operation.
or to set bit 2:
movlw 04h
iorwf portA,1