Strings help
El Paisa
Posts: 375
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
Then 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
So 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.