Hi guys ...
For one of my project i need to store data on external eeprom 24c04 like data base that is i need to store at least last 5 days data and retrieve the same got any idea please help me with this Thank you_________________KaalaayaTasmaiNamah:

guy

Joined: 21 Oct 2005Posts: 266

Posted: Sat Nov 12, 2016 2:57 pm

Hi Madhu,
I have a data logger project with a 24LC1025 (256KB EEPROM). If you can be specific with your question/problem I'd be glad to help.

Guy

temtronic

Joined: 01 Jul 2010Posts: 5826Location: Greensville,Ontario

Posted: Sat Nov 12, 2016 4:00 pm

How much 'data' do you need to store ? What IS the 'data'? What format is the 'data'. The EEPROM you listed only has 512 bytes of storage, so is that enogh for 5 days worth of 'data'?

We need a LOT more details about this 'data'....

Also need to know how much you can afford for the external storage device !

And what PIC are you using ? Do you have the required I/O pins available for the interface ? 5 V or 3 V ? Speed ??

Your solution will be found in the 'details' that you haven't provided us with....

Jay

Ttelmah

Joined: 11 Mar 2010Posts: 12643

Posted: Sun Nov 13, 2016 3:50 am

As a comment, to store a date, obviously you need some form of RTC on the PIC. There is a 'standard' way of encoding dates/times, which stores them in a machine readable form, as 'seconds since epoch', where the 'epoch' as standard on most systems is either 1970, or 2010 (as an in32 count). CCS provides the standard C library for this, converting a date and time, into such a count, or turning a count back into a date and time (supporting both epoch's, #define TIME_T_USES_2010, switches operation). This is in time.h/time.c. This also includes functions to perform some maths with these, giving you the 'difference' between two times (for example). Now since this includes seconds rather than just date, it may well be bulkier than you need, but (for insance), if your EEPROM data, for each record, simply started with the int32 'timestamp' from this, then if you wanted to find all records in the last day, a simple search, testing if the stored time in each record is less than 86400 seconds from the current time would do this.

temtronic

Joined: 01 Jul 2010Posts: 5826Location: Greensville,Ontario

Posted: Sun Nov 13, 2016 6:02 am

hmm..since the original post has a very small EEPROM I'm thinking that there are only a few data to store per day. If he doesn't need precise seconds and can live with 15 minute resolution( 6:00,6:15,6:30,etc.) you can store 24hrs in less than a byte! I did that 30 years ago and it still works today. You've actually got one bit leftover, that can be used as a 'flag'. So if you wanted to turn a light on /off, within one byte you have the time and control command.
A similar method can be used for actual temperture, storing the difference and not the real reading.
We still need to hear back from the OP about how much 'data' needs to be stored though.

Jay

Ttelmah

Joined: 11 Mar 2010Posts: 12643

Posted: Sun Nov 13, 2016 9:15 am

Absolutely.
As I said:
"Now since this includes seconds rather than just date, it may well be bulkier than you need".
Indeed since he just says 'date', he may not need time of day at all.