PDA

View Full Version : Dealing with long ASCII strings



Michael O'Doul
08-07-2005, 08:34 AM
I've looked around these forums and elsewhere, but I can't find an elegant solution to the following problem. I have a radio beacon -- a simple device that transmits the same 128 byte ascii string over and over again. What I want to do is:

receive the string
check for errors with some version of CRC
If the string is error-free, pass it to another device via RS-232

The first two tasks are easy, but the lack of RAM on the BS2 makes the third task a bit difficult. Is there some way for the stamp to hold onto the entire 128 byte string without resorting to a WRITE command? The length of the string cannot be be shortened.

Any help will be greatly appreciated.

Michael

Bruce Bates
08-07-2005, 09:01 AM
Michael -

You will be pleased to learn that all of the larger Stamp platforms (BS-2p and upwards) have 127 bytes of SPRAM (scratchpad RAM) available for your use. This SPPRAM can be accessed using the GET and PUT commands, as found in the PBASIC Stamp Manual which is free for the download from the Parallax web site. Data can be read to and written from that area in BYTE (8 bits) or WORD (16 bits) segments. That should give you all the storage space you need for your long data string.

There was a discussion on using SPRAM on the third of this month (08/03/2005) in this forum if you want to go back and look at it. The title of the thread was "SP RAM HELP". You may find it quite helpful, as there are some examples therein.

Regards,

Bruce Bates

Michael O'Doul
08-08-2005, 01:29 AM
Thanks Bruce -- I think that might be the best answer, especially since speed is a bit of a concern on this project anyway.