CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How I can write a string into a ram and then read that?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pilar



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

How I can write a string into a ram and then read that?
PostPosted: Wed Dec 09, 2009 10:34 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Dec 09, 2009 11:10 am     Reply with quote

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: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Dec 09, 2009 11:58 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Dec 09, 2009 1:09 pm     Reply with quote

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: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Dec 09, 2009 1:16 pm     Reply with quote

: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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group