Hi.
I'm just starting with micro controllers and PICS and I have a question about using varibles in BSF and any instruction that has the format f,b (such as BTFSC).
Here is a part of the code I have right now:
When I use btfsc CMDOUT,BITNUM and bsf PORTB,BITNUM for the value of BITNUM it uses the register location (0x10) instead of register value (which I have increasing each loop). What I am trying to accomplish is to test each bit of a register with a loop.
Am I going about this the wrong way? Is there a way to test the value of the BITNUM register instead of the register location.
I'm just starting with micro controllers and PICS and I have a question about using varibles in BSF and any instruction that has the format f,b (such as BTFSC).
Here is a part of the code I have right now:
Code:
START
movlw 0x00
movwf BITNUM
movlw 0x08
movwf BTLOOP
LOOP2
btfsc CMDOUT,BITNUM
bsf PORTB,BITNUM
bcf PORTA,3 ; Clock Low
; call DELAY ; Delay
bsf PORTA,3 ; Clock High
; call DELAY ; Delay
incf BITNUM,f
decfsz BTLOOP
goto LOOP2
return
When I use btfsc CMDOUT,BITNUM and bsf PORTB,BITNUM for the value of BITNUM it uses the register location (0x10) instead of register value (which I have increasing each loop). What I am trying to accomplish is to test each bit of a register with a loop.
Am I going about this the wrong way? Is there a way to test the value of the BITNUM register instead of the register location.