Write from SX memory to USB drive
I am building a system to count revolutions of a rotating shaft then writing to SX memory.· Once I fill a few banks in the SX I am writing this information to a USB drive using the Parallax Datalogger.·
Counting and writing to SX memory works great.· Communicating to the datalogger works great (thanks to Bean!).· I can't get the data transferred to the USB drive now.· I can get it to increment through the memory locations, but can't get the actual data to write to the USB drive.· I can write text, but not data.·
Any ideas would be appreciated, the code is attached.· The one called Try2 works great and writes the word "TEST" 16 times.· Try3 I'm trying to write actual data, file is blank.· I'm probably overlooking something.
Thanks,
Counting and writing to SX memory works great.· Communicating to the datalogger works great (thanks to Bean!).· I can't get the data transferred to the USB drive now.· I can get it to increment through the memory locations, but can't get the actual data to write to the USB drive.· I can write text, but not data.·
Any ideas would be appreciated, the code is attached.· The one called Try2 works great and writes the word "TEST" 16 times.· Try3 I'm trying to write actual data, file is blank.· I'm probably overlooking something.
Thanks,
Comments
SendStr "WRF "
SendChar 0
SendChar 0
SendChar 0
SendChar 10 ' <- Change this value to number of characters being sent.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?
www.iElectronicDesigns.com
·
I DON'T UNDERSTAND!! Both programs shoud do the same thing??
Below in Blue is the Piece of code that works
RevData = $30
DO
····· ' Write to file "TEST.TXT"
····· SendStr "WRF "
····· SendChar 0
····· SendChar 0
····· SendChar 0
····· SendChar 3
····· SendChar CR
····· SendStr "aa"·····'write the ASCII directly to the·SUB parameter
····· SendChar CR
····· RecvStr
INC RevData
LOOP UNTIL revdata = $3F
Below in red is the same piece of code modified to pull from RAM and it doesn't work
Revdata=$30
DO
__RAM (Revdata)="BB"
Getdata=__RAM (RevData)
····· ' Write to file "TEST.TXT"
····· SendStr "WRF "
····· SendChar 0
····· SendChar 0
····· SendChar 0
····· SendChar 3
····· SendChar CR
····· SendStr· Getdata
····· SendChar CR
····· RecvStr
INC Revdata
LOOP UNTIL revdata = $3F
Post Edited (astro70) : 5/3/2008 4:49:16 AM GMT
There are some incompatible concepts that you are unsuccessfully trying to make work together.
1.) I do not think the __RAM(address) alias knows how to formally handle strings. The __RAM(address) alias allows you to access a single byte of RAM. I think you would need to assign each character independently being certain to increment the RAM address each time. Also, most strings are terminated with a character value of zero to signify the end of the string. So you would probably need to add a terminating value as well.
However...
2.) The __READ(address) command used in your SendStr subroutine reads data from program memory not RAM. So you can not use the __READ(address) command to retrieve data stored in RAM.
I think that if you use SendChar __RAM(address) to send out data that is stored in RAM one byte at a time you can achieve the results desired. If not, write back with what you tried and what happened.
- Sparks
Post Edited (Sparks-R-Fun) : 5/8/2008 11:37:18 PM GMT