zristic
Junior Member level 3
bsf pic
I am not sure yet, but it seems that BCF and BSF instructions on Pic 18F series behave very odd when a PORT is set to input mode. For example, if you do this:
MOVLW 255
MOVWF TRISB
BCF PORTB, 0
BSF PORTB, 1
then it seems there is no effect when using those instructions. However, if you do this:
MOVLW 255
MOVWF TRISB
MOVLW 2
MOVWF PORTB
then the last insctruction does set PORTB properly.
I do not actually need to change PORTB when it is in input mode, I am just curious why BCF and BSF fail to do so, but MOVWF works OK.
I am not sure yet, but it seems that BCF and BSF instructions on Pic 18F series behave very odd when a PORT is set to input mode. For example, if you do this:
MOVLW 255
MOVWF TRISB
BCF PORTB, 0
BSF PORTB, 1
then it seems there is no effect when using those instructions. However, if you do this:
MOVLW 255
MOVWF TRISB
MOVLW 2
MOVWF PORTB
then the last insctruction does set PORTB properly.
I do not actually need to change PORTB when it is in input mode, I am just curious why BCF and BSF fail to do so, but MOVWF works OK.