PDA

View Full Version : Lookup Table - help needed



computer guy
01-10-2009, 06:16 PM
Hi there,


I want to read 2 strings from a text file and store them in a form of lookup table.
I can already read the strings in but need help with the lookup table.


e.g

Text file:



Temp, Foo
Hello, Temp2




lookup:



v1 := lookup("Temp")
print(v1)




Gives output:



Foo





Thank you http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip (http://robot.tmcp.com.au/buildingblock) A web site designed to help people who are new to the propeller chip.

Guitar Hero controller using the prop (WIP) --> HERE (http://robot.tmcp.com.au/buildingblock/projects/guitar.htm)

StefanL38
01-10-2009, 06:58 PM
Hello cg,

you have to reserve memory for the strings in RAM.




VAR
byte ByteArrayStr1[40]
byte ByteArrayStr2[40]






You can do this definining a byte-array or defining an "empty string"
= memory filled up with zeros




DAT
Str1 byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,00,0,0
Str2 byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,00,0,0





then you have to store the string bytewise into the array or the DAT-memorysection

"printing" strings (with FullDuplexSerial, TV_text etc.) works via a pointer which contains the memoryadress of the RAM where the string begins and has to be ALWAYS terminated with a zero

best regards

Stefan

computer guy
01-10-2009, 07:04 PM
Thank you Stefan. http://forums.parallax.com/images/smilies/smile.gif

I think I have enough information to complete the project now.
The information I needed was right under my nose.
Thank you for pointing it out.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip (http://robot.tmcp.com.au/buildingblock) A web site designed to help people who are new to the propeller chip.

Guitar Hero controller using the prop (WIP) --> HERE (http://robot.tmcp.com.au/buildingblock/projects/guitar.htm)