Is there a way in PIC assembler to set all bits of a register to 1 without using the W register? Basically, I want to do this:
Except I want to preserve what was in the w register. It would simply be a reversal of
The reason I want to do this is in displaying a 4 digit number on 7 seg LEDs with common Anode. I want to turn on a number and call the delay. Then after the delay, I want to call the lookup table for the next number, Set PortA to all 1s (turn off the display), do RLF to get to the next digit, then finally put the contents of w back on PortB. The code looks like this:
I know that people normally just use the lookup table afterthey have turned off the LED, but doesn't this mean you have to make your delay faster to reduce flicker? Wouldn't it be much clearer if the lookup table was called while the LED was on?
movlw 0xFF moxwf PORTB
<Some digits is being displayed> ;when both PortA and PortB are low, digit is displayed call Delay movlw h'06' ;Put some number (6) in the W register call LUTable ;Call the lookup Table with 6 __?__ PORTB ;Turn off all LEDS momentarily RLF PORTA ;Move to the next digit ;NOTE: W is still value of 6 in LED format movwf PORTB ;Load PORTB with new number ;digit is displayed