I just want to toggle a bits state.
How do I flip a bit?
[this isnt working for me]
btfss CHAOS_DCO1_WAVE, 0
bcf CHAOS_DCO1_WAVE, 0
bsf CHAOS_DCO1_WAVE, 0
[uPDATED]
I discovered btg by accident on the net. This is the first time I’ve come across it.
Of all the PIC assembly links on the net I’ve gone through, I’ve never found this.
btg filereg,0
does exactly what I want!
Hi
Think about what is happening…
btfss CHAOS_DCO1_WAVE, 0 ; if CHAOS_DCO1_WAVE, 0 is set, skip next instruction
bcf CHAOS_DCO1_WAVE, 0 ; Not set so clear it, but it is already clear
bsf CHAOS_DCO1_WAVE, 0 ; set it again regardless
The bit will always be set.
Dave
Dave:
I was following this description of btfss:
"btfss: tests a bit in a file register and skips the next instruction if the result
is set"
I’m thinking ‘set’ = 00000001
not ‘set’ = 00000000
if bit is set (00000001), then do next instruction whic is clear.
Looks like I’ve got the SET thing backwards.
…anyway, BTG is what I needed.