View previous topic :: View next topic |
Author |
Message |
masssystems
Joined: 19 Jul 2006 Posts: 8
|
Code and Format for inputting data to eeprom with txt file |
Posted: Wed Aug 23, 2006 5:22 pm |
|
|
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
|
|
Posted: Wed Aug 23, 2006 6:02 pm |
|
|
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
|
|
Posted: Thu Aug 24, 2006 9:26 am |
|
|
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
|
|
Posted: Thu Aug 24, 2006 11:07 am |
|
|
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
|
|
Posted: Thu Aug 24, 2006 12:31 pm |
|
|
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
|
|
Posted: Thu Aug 24, 2006 1:25 pm |
|
|
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
|
|
Posted: Thu Aug 24, 2006 2:25 pm |
|
|
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
|
|
Posted: Thu Aug 24, 2006 6:02 pm |
|
|
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
|
|
Posted: Fri Aug 25, 2006 6:09 am |
|
|
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 |
|
|
|