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 CCS Technical Support

loading Txt File to EEPROM

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



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

loading Txt File to EEPROM
PostPosted: Mon Jul 25, 2022 10:11 am     Reply with quote

Hi guys,
anyone have a method of pre-loading into EEPROM a file with data that will be later read by the program as a structure?

The data will be something like:
Phone number
serial number
1 config byte
1 flag byte

ive got close to 100 of these "entries". on the txt
i will make the data entry be a power of 2 for easier "fit".

i just dont want to manually type it all in.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Mon Jul 25, 2022 10:38 am     Reply with quote

Are you talking about the internal EEPROM or an external chip?
If the former, I can't think of any that would hold 100 entries like this.
However if it is the former, look in the programming specification for
the chip. You can then use #ROM to store data at the address for
programming (getenv can also fill this in for you).
If the latter, then you would either have to use an external programmer,
or add a program to automatically write the data from perhaps serial.
benoitstjean



Joined: 30 Oct 2007
Posts: 566
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Jul 26, 2022 5:37 am     Reply with quote

The second option - through serial - is what I do using an FTDI USB to serial converter.

It's as simple as hooking-it up to the PIC's serial port then you can use a program like Tera Term to upload the file or write your own program on your PC.

I use Tera Term to upload firmware but I also wrote my own Windows app to upload files stored on my device's SD card, over FTDI, to my PC (reverse of what you do but it's simple the other way around).

If you have an SD card adapter on your device with the proper SD driver, then you could go that way as well reading data off the SD card.

There are many ways to do this, it's just a matter of time, tools and money.

Good luck.

Ben
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Thu Jul 28, 2022 12:47 am     Reply with quote

It's worth perhaps just saying that a bit of 'thought' in the layout of the file
can simplify the coding, and improve the likelihood of it working reliably.
So (for instance), having the actual main elements split by a LF is good,
but it is worth considering if the sub components can be split by perhaps
a comma instead. So:

Phone number, serial number, nnn, nnn <LF>

Makes it easy to write the code to be confident where a new element starts
(at the LF), and to separate the parts of this (with the commas).
Both easy for human readability, and computer scanning.

I did a massive database transfer some years ago, and had the old system
output the data into a huge text stream like this, then the new system just
read this, entered it and indexed it into the new database. Took a few days
to transfer over 80000 records, some with thousands of characters, but the
impressive thing was that everything ended up in the correct places, and
nothing was lost.
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