PDA

View Full Version : Lowbyte



philipad23
05-18-2006, 01:31 AM
hi all,
Can I separate a Word to LOWBYTE and HIGHBYTE on BS1? (this is for RF transmission of the Word)
thanks

Chris Savage
05-18-2006, 01:59 AM
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 (mailto:csavage@parallax.com)

Jon Williams
05-18-2006, 02:31 AM
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