Shop OBEX P1 Docs P2 Docs Learn Events
(Noobie) Pipe symbol erroring Pin := |< PinNum — Parallax Forums

(Noobie) Pipe symbol erroring Pin := |< PinNum

Getting an error message " Expected an Expression Term " for following spin code:
Con
_clkfreq = 200_000_000
Var
long BinPattern
long PinNum
Pub main()
PinNum := 3
BinPattern := |<PinNum
debug(UBIN(BinPattern))
Looking for help, using Propeller II IDE Ver 2.5.1 the error is at the pipe symbol "|<PinNum"
(Indenting is correct , it is just viewing wrong in this comment window)
Regards
WRD Bob Drury

Comments

  • Wuerfel_21Wuerfel_21 Posts: 5,054
    edited 2021-03-01 20:27

    In a very obnoxious turn of events, that operator isn't in Spin2 and IIRC there's no direct equivalent. There's DECOD but that's off-by-one, I think. Not 100% sure though.

  • AribaAriba Posts: 2,690

    The equivalent would be:

    BinPattern := 1<<PinNum
    
    
  • Thanks Wuerfei and Ariba
    1<<PinNum makes sense it does the samething why have two commands
    Regards
    WRD Bob Drury

  • JonnyMacJonnyMac Posts: 9,105
    edited 2021-03-01 22:57

    It seems decod does indeed replace |<

  • Will try out
    Thanks JonnyMac
    Regards
    WRD Bob Drury

Sign In or Register to comment.