jackchaos Posted September 25, 2005 Report Share Posted September 25, 2005 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! Quote Link to comment Share on other sites More sharing options...
Dave_Wheeler Posted September 25, 2005 Report Share Posted September 25, 2005 HiThink 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 regardlessThe bit will always be set.Dave Quote Link to comment Share on other sites More sharing options...
jackchaos Posted September 25, 2005 Author Report Share Posted September 25, 2005 Dave:I was following this description of btfss:"btfss: tests a bit in a file register and skips the next instruction if the resultis set"I'm thinking 'set' = 00000001not 'set' = 00000000if 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.