View previous topic :: View next topic |
Author |
Message |
pilar
Joined: 30 Jan 2008 Posts: 197
|
How I can write a string into a ram and then read that? |
Posted: Wed Dec 09, 2009 10:34 am |
|
|
Hi, I am using a pic18f452 to read the data GPS and then save these data in the internal EEPROM pic together with others data (analogic inputs) and then send to PC by serial port. This is done every 2 minutes. According to data sheet of pic18f452 only can be 1,000,000 erase/write cycle Data EEPROM. This is not true with memory RAM that have erase/write cycle infinite.
I think that after a long time the eeprom memory will become obsolete and have to change the pic.
I can write the GPS data an analogics input in the memory RAM and after read these to send the PC?
How I can do it? |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Wed Dec 09, 2009 11:10 am |
|
|
Why not just define a serial buffer (or an array of them)?
Code: | char gpsdata[32];
...
gets(gpsdata); // Read GPS data into RAM
...
printf("%s\n",gpsdata); // Print to PC
|
|
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Dec 09, 2009 11:58 am |
|
|
dbotkin wrote: | Why not just define a serial buffer (or an array of them)?
Code: | char gpsdata[32];
...
gets(gpsdata); // Read GPS data into RAM
...
printf("%s\n",gpsdata); // Print to PC
|
|
That's pretty simplified, but would work.
Warning - Some GPS strings are longer than 31chars and would overflow that buffer.
Cheers,
Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Wed Dec 09, 2009 1:09 pm |
|
|
Well, yeah... you'll need to make the string variable(s) as long as you need to store the data. Point is, it's dead simple to store the data in RAM until it's send to the PC. Easier, even, than storing it in EEPROM. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Dec 09, 2009 1:16 pm |
|
|
:D ok - we're on the same page then.
And yes, EEPROM != RAM. (to the original poster)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|