PDA

View Full Version : Store and retrieve strings to an ATmel SPI Serial EEprom



BryanSw
- 12th August 2010, 00:43
I have normally worked with other compilers but at work I have to use Picbasic Pro. Usually I use a Pascal language compiler. Anyways, I am finding it kind of difficult to do something simple like store strings in an external serial eeprom for call back later. I will have many strings of varing lengths possible over 100 of them. I am using a 16 meg atmel double buffered serial (SPI) eeprom. I can write data (decimal numbers) to the eeprom and read it back. But what to do about strings? I don't have too much experience with PBP yet but learning fast. I know I don't have the option of having a string variable :confused:. So, my guess is load each character into an array and send it out one at a time. Once the strings are loaded into the eeprom I can comment out or delete the code that put them there. The rest of the memory will be used for storing A/D data. I guess the big question is when I load the strings back into the PIC can I convert them to ascii again for output to an LCD.
Anyone have any samples of how I can do something like this? I don't need someone to write all the code for me as I'm a big boy now. I just need to see a way to create an array of characters, do a shiftout of each character and then do a shiftin and reassemble the string for an LCDout. I've already tried to do this but just got some garbage on the LCD.
For the Mel guys, Yes, a string var would be nice and some simple string handling functions like other compilers have ie.... mikroe.

Bryan

Darrel Taylor
- 12th August 2010, 00:58
Hi Bryan,

Here's one possibility from awhile back.

STRINGS - How to store and retrieve strings in Code Space
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=10

In the StringOut: routine, instead of sending to the USART (HSEROUT), send it to the EEPROM.
Fortunately, you already have that part working.

HTH,

BryanSw
- 13th August 2010, 02:17
Hi Bryan,

Here's one possibility from awhile back.

STRINGS - How to store and retrieve strings in Code Space
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=10

In the StringOut: routine, instead of sending to the USART (HSEROUT), send it to the EEPROM.
Fortunately, you already have that part working.

HTH,

OK, that seemed to do the trick. Still very strange way to do this. A string var would be nice to have. Almost seems like I'm using more program memory just to create the strings (labels in this case) and send them to the eeprom and read them back in, just to output them to an LCD. The idea I had was to off load about 100 or more strings to an EEprom so I don't keep them in code space and call the back up by EEprom addresses. Still I see no other way to do this. It works but looks very inefficent to me. Once I load the strings into the eeprom I can comment out the code that put them there and not write to those addresses later.
Thanks for your help it is greatly appreciated.

Bryan