Menu

XOR and Clearing Bits

Help
2007-02-03
2013-05-30
  • Nobody/Anonymous

    Been trying to get GCB to clear bits in a subroutine.  Take a variable, mask off all except the LSB, and use the result as a qualifier in an IF statement.  My thick head cannot bend to the proper syntax.

    Start:
    fish = b'00010001'
    fishout
    goto Start

    sub fishout
    For Clocks = 1 to 8
    bit = fish xor b'00000001'
    If bit = 0 Then set Transmit Off
    If bit = 1 Then set Transmit On
    wait 1 sec
    ROTATE fish Right
    Next

    Regards,
    Kent

     
    • Steve

      Steve - 2007-02-04

      Try this?

      If bit.0 = 0 Then set Transmit Off
      If bit.0 = 1 Then set Transmit On

       
    • Nobody/Anonymous

      Thanks for that, but no go on using bit.0.  Curious tho,  that using an "and" mask works!  Thought I had tried that before, but must not have had all the ducks lined up.

      Regards,
      Kent

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.