Word Symbols

B4Lamb

Member
If I declare a word variable e.g.
Symbol Myword = w1 ;Myword is the same as b3 (high byte) and b2 (low byte) variables

How do I refer to just the Hi Byte using the Symbol Name rather than by its Byte variable i.e. b3 ??
I have searched Manuals 1 and 2 but cannot find anything relevant.
 

AllyCat

Senior Member
Hi,

You just create another symbol name such as symbol MywordHi = b3 and symbol MywordLo = b2 etc..

Some people / systems use a "dot" suffix such as Myword.hi but I don't think there's anything "automatic" in the PICaxe Basic Editor. Personally, I prefer short variable names so normally just add an H or L , or (particularly for b0 - b3 or w0 and w1) I continue to use their default names, so that it's more obvious that they're also accessible as bit0 , etc....

Cheers, Alan.
 

B4Lamb

Member
Okay Thanks Alan,
Its been driving me mad thinking there was a PICaxe editor auto breakdown of a word variable symbol name.
I must be thinking of the PIC Assembler Language.
Cheers,
John
 

inglewoodpete

Senior Member
I use the following naming convention for Words and Bytes. Particularly useful when transmitting word variables by Async Serial, SPI or i2c
Rich (BB code):
   Symbol wRandom       = w5   'b10/11 Permanent value
   Symbol bRandom.Lo    = b10  'w5   Permanent value
   Symbol bRandom.Hi    = b11  'w5   Permanent value
 
Top