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

Code and Format for inputting data to eeprom with txt file

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



Joined: 19 Jul 2006
Posts: 8

View user's profile Send private message

Code and Format for inputting data to eeprom with txt file
PostPosted: Wed Aug 23, 2006 5:22 pm     Reply with quote

Hey,
I have a very general question. I would like to know if it is possible to input data into an external eeprom from a text file. If so, what format am I suppose to use? I am using the software prototyping board provided in the ace kit from CCS as well as the Mach-X and PIC16877A given in the kit. Help is much appreciated.

V.S.
theteaman



Joined: 04 Aug 2006
Posts: 98

View user's profile Send private message

PostPosted: Wed Aug 23, 2006 6:02 pm     Reply with quote

It depends on where the text file is. If its on the PIC, how do you plan on putting it there? If its on the PC, are you reading it through a uart and storing it in ram, to later put in the eeprom?
masssystems



Joined: 19 Jul 2006
Posts: 8

View user's profile Send private message

PostPosted: Thu Aug 24, 2006 9:26 am     Reply with quote

I would like to replicate a program that I am using that allows me to take a .txt file (from the PC) and put it directly onto the eeprom. Is there a general format for data in the text file (i.e. address, value etc....). If anyone has any sample code they could provide that would be a great. Thanks
grasspuddle



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

PostPosted: Thu Aug 24, 2006 11:07 am     Reply with quote

If you are sending the data from the PC to the chip over serial port then I would send some kind of start command then everything sent over the serial would be recorded to eeprom. After an end command is sent showing that the file is done then return to normal pic process.

Have you done eeprom read/write before?

look at EX_SISR.C to see how to store serial data into a buffer for processing.
masssystems



Joined: 19 Jul 2006
Posts: 8

View user's profile Send private message

PostPosted: Thu Aug 24, 2006 12:31 pm     Reply with quote

I tried the EX_SISR.c file and I saw how the buffer worked, however I don't really understand how that would help me input a text file from my PC. Can I use the same buffer idea and replace the input with a text file instead? If so, then how?
grasspuddle



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

PostPosted: Thu Aug 24, 2006 1:25 pm     Reply with quote

the interrupt would fire when there is something that needs to be loaded from usart

a getc command will take one byte/char off the buffer into a variable you have made
so you can store one byte/char at a time into your eeprom

or maybe...
you can try a program where you read in the txt file from the PC and echo it back with the pic chip

the print statements would be replaced with write to eeprom statements

sorry if i don't make sense, but hope it helps
masssystems



Joined: 19 Jul 2006
Posts: 8

View user's profile Send private message

PostPosted: Thu Aug 24, 2006 2:25 pm     Reply with quote

Ok, thanks...I'll give that a try. One more thing, when I'm inputting my text data into the buffer, how should I format the information within the text file? Do I seperate it by commas i.e. address, value ?
Guest








PostPosted: Thu Aug 24, 2006 6:02 pm     Reply with quote

if its just ascii text then you dont need to seperate it

if you want it to resemble some sort of data structure then wont that depend on the application?
grasspuddle



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

PostPosted: Fri Aug 25, 2006 6:09 am     Reply with quote

you don't have to format the txt file since the bytes being sent will be in order

when you write to the eeprom just have a counter so you know which byte you are writing

byte0 writes to address0
byte1 writes to address1
etc...

then a simple for loop will read back the text file for when you need to retrieve it from the eeprom
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