Jump to content

Flipping a bit


jackchaos
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...