Shop OBEX P1 Docs P2 Docs Learn Events
Lowbyte — Parallax Forums

Lowbyte

philipad23philipad23 Posts: 44
edited 2006-05-17 18:31 in BASIC Stamp
hi all,
Can I separate a Word to LOWBYTE and HIGHBYTE on BS1? (this is for RF transmission of the Word)
thanks

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-17 17:59
    If you know what register it's in (the variable) you can always pull the byte sized variables from those registers.· For example, if the data is in W0 then you could access B0 and B1.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-17 18:31
    You can, and here's an extention of what Chris notes above; all Word variables a busted into corresponding bytes:

    W0··· B0· -- bit level access on W0 only
    ······B1
    W1··· B2
    ······B3
    W2····B4
    ······B5
    W3··· B6
    ······B7
    W4··· B8
    ······B9
    W5··· B10
    ······B11
    W6··· B12· -- CAUTION: Used as RETURN stack for GOSUB
    ······B13

    Note that only W0 (B0/B1) has bit-level access, and there is no LOWBYTE·modifier as with the BS2; use the table above to create the proper variable aliases with SYMBOL, like this:

    SYMBOL lights··· =·W0
    SYMBOL lightsLo ·= B0
    SYMBOL lightsHi· = B1

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.