Shop OBEX P1 Docs P2 Docs Learn Events
Recreating some C functions in SPIN2 — Parallax Forums

Recreating some C functions in SPIN2

Is there an easy way to create the bitRead() and bitWrite() in spin2 without assembly?

I may be overthinking this.

Comments

  • AribaAriba Posts: 2,682
    edited 2021-03-05 21:14

    You mean the Arduino functions bitRead() and bitWrite()?
    If so:

    Arduino:
      b = bitRead(variable,bitnum);
    Spin2:
      b := variable.[bitnum]
    
    
    Arduino:
      bitWrite(variable,bitnum,state);
    Spin2:
      variable.[bitnum] := state
    
    

    Andy

  • @Ariba see I knew I was overthinking it

Sign In or Register to comment.