Strings help
I hope anyone can help and thanks in advance.
If I have:
DAT
·· msg0···· byte···· "0.bmp",0
·· msg1···· byte···· "1.bmp",0
.
.
.
·· msg16·· byte···· "multi.bmp",0
·· msg17·· byte···· "div.bmp",0
and I need to send to a serial device each dat definition one at the time, which is the proper way?
·
If I have:
DAT
·· msg0···· byte···· "0.bmp",0
·· msg1···· byte···· "1.bmp",0
.
.
.
·· msg16·· byte···· "multi.bmp",0
·· msg17·· byte···· "div.bmp",0
and I need to send to a serial device each dat definition one at the time, which is the proper way?
·

Comments
table word @msg0, @msg1, ... @msg8 word @msg9, @msg10, ... @msg17Then do:
The "@" operator at compile time provides the object relative offset of each address. The "@@" operator turns these into absolute addresses.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Please give a code example.
Thanks
vptr := lookupz(field: @wmask, @wval, @wtime) 'retrieve pointer to variable if(position//2 == 0) 'change high nibble BYTE[noparse][[/noparse]vptr][noparse][[/noparse]3-position/2] &= NMSK 'clear high nibble BYTE[noparse][[/noparse]vptr][noparse][[/noparse]3-position/2] |= in_value << 4 'set high nibble value else 'change high nibble BYTE[noparse][[/noparse]vptr][noparse][[/noparse]3-position/2] &= !NMSK 'clear low nibble BYTE[noparse][[/noparse]vptr][noparse][[/noparse]3-position/2] |= in_value 'set low nibble valueSo this code·arranges a set of variables as a psuedo array regardless of thier names
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
the problem i found is if i use:
· repeat i from 1 to 16
····· char:=lookup(i:msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,msg10,msg11,msg12,msg13,msg14,msg15,msg16)
····· term.str(@char)
····· term.out(13)
DAT
· msg1······· byte····· "0.ezp",0
· msg2······· byte····· "1.zp",0
· msg3······· byte····· "2.ezp",0
· msg4······· byte····· "3.zp",0
· msg5······· byte····· "4.ezp",0
· msg6······· byte····· "5.zp",0
· msg7······· byte····· "6.ezp",0
· msg8······· byte····· "7.zp",0
· msg9······· byte····· "8.ezp",0
· msg10······· byte····· "9.ezp",0
· msg11······· byte····· "plus.ezp",0
· msg12······· byte····· "minus.ezp",0
· msg13······· byte····· "multi.ezp",0
· msg14······· byte····· "div.zp",0
· msg15······· byte····· "spin.bmp",0
· msg16······· byte····· "propeller.bmp",0
It only prints the first character of the string.
I need to print the whole string ie, "propeller.ezp"
term.str(char)
Though I'm not sure why @char even gives the 1st correct character.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
···· char:=lookup(i:@msg1,@msg2,@msg3,@msg4,@msg5,@msg6,@msg7,@msg8,@msg9,@msg10,@msg11,@msg12,@msg13,@msg14,@msg15,@msg16)
····· term.str(@char)
So that char DOES hold the address of the message, and that address is sent to term.str.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.