EEPROM vs Programme memory?!

Thread Starter

geoffers

Joined Oct 25, 2010
488
Hi All,
I'm looking for some advice on memory, I have a application that needs to store ~ 1500 bytes of data every day. I have a board I designed and made at the moment with a 16f1827 and a i2c eeprom. When I got to thinking about how to work everything I thought maybe I could do without the eeprom?

First way is to change to another pic with more ram, (memory doesn't need to be non-volatile, I intend to put the pic to sleep a lot).

Second is to use the programme memory on the 16f1827, a quick look at the data sheet makes me think this could be the way to go? It seems I can access the programme memory with the fsr registers on this part. It also says cell endurance is ~10k (does this mean I can write to it 10000 times?)

If so daily use of each byte should mean it will last about 27 years? That will do! Main reason for losing the eeprom is to keep power consumption as low as possible, less chips= less power !

Is this a good idea? What traps could I fall into? I realise I need to keep the program small enough to make sure it doesn't overlap with the data.

Seasons greetings! Cheers Geoff
 

spinnaker

Joined Oct 29, 2009
7,830
As far as I know, the only way to store data in program memory is with a constant.

You will need eeprom to store data that changes.
 

joeyd999

Joined Jun 6, 2011
5,283
You can use program memory as non-volatile storage. You are already aware of the limited write endurance, so if that is ok, go for it!

Keep this in mind:

1. The program memory is block erased not byte erased. And the blocks are pretty large -- I think 1 or 2K without looking it up.
2. The CPU stalls during erase/write cycles. Is this OK with your app?
3. Power failure during erase/write will corrupt your stored data. Count on this happening, and plan for it.
 

Picbuster

Joined Dec 2, 2013
1,047
Hi All,
I'm looking for some advice on memory, I have a application that needs to store ~ 1500 bytes of data every day. I have a board I designed and made at the moment with a 16f1827 and a i2c eeprom. When I got to thinking about how to work everything I thought maybe I could do without the eeprom?

First way is to change to another pic with more ram, (memory doesn't need to be non-volatile, I intend to put the pic to sleep a lot).

Second is to use the programme memory on the 16f1827, a quick look at the data sheet makes me think this could be the way to go? It seems I can access the programme memory with the fsr registers on this part. It also says cell endurance is ~10k (does this mean I can write to it 10000 times?)

If so daily use of each byte should mean it will last about 27 years? That will do! Main reason for losing the eeprom is to keep power consumption as low as possible, less chips= less power !

Is this a good idea? What traps could I fall into? I realise I need to keep the program small enough to make sure it doesn't overlap with the data.

Seasons greetings! Cheers Geoff
Your correct less chips less power. an other way to save power is to use a P mosfet to switch eeprom on when needed.
Using a Mpu as storage device and give it other (external) I/O functions as well could put you in trouble when an input blow-up appears.
 

dannyf

Joined Sep 13, 2015
2,197
Is this a good idea?
It is hard to tell.

If you don't need non-volatile storage, keeping the content in RAM is the simplest - assuming there is sufficient ram for that.

Assuming the chip is self-programmable, storing it in flash is doable, though it requires additional programming and the storage can only be done on pages, aside from the endurance issue you have identified.

Storing the content outboard is the simplest, and affords you more flexibility down the road. Power consumption can be done with an external switch, or more likely just an IO pin - the typical eeprom chips don't consume much power: < 10ma active and in the ua range idling. More MCU's IO pins can handle that directly.
 

Thread Starter

geoffers

Joined Oct 25, 2010
488
Thanks for all the replies,
Its 1500 bytes a day, then we start again the next day, 1500 is the grand total, I hadn't thought of powering the eeprom through io! I was hoping to make the thing as cheap as poss so minimal components would be good. My program should be quite small (asm) so should leave a god bit left for data. Are there any pitfalls to this?
Cheers Geoff, Happy New year!
 

John P

Joined Oct 14, 2008
2,026
I very much doubt if you need a MOSFET to turn on the external EEPROM, if you go that way. Just powering it via a port pin ought to work. I looked up one I2C EEPROM at random, and the spec sheet listed 3mA ma supply current.
 

ErnieM

Joined Apr 24, 2011
8,377
If you are switching the power to the EEPROM you have to switch ALL the power to it. That includes any I/O lines that may possible go high, including the SCL and SDA of the I2C.

Most CMOS devices will power themselves off inputs when there is no VDD voltage available. They will even send out VDD power to other devices that may be there.
 

John P

Joined Oct 14, 2008
2,026
I don't think that's true--the normal state of an I2C line is high for SCL and SDA, so all you'd need to do to un-power an EEPROM would be to take away its Gnd (or Vss if that's what you call it) and you'd be all set. Vcc (or Vdd) would be high, and so would the communication lines, so no current would be able to flow anywhere.
 

ErnieM

Joined Apr 24, 2011
8,377
Same deal if you are switching out ground: you then must also remove any I/O pin that is connected to ground.

The pins conduct to the power rails thru the ESD diodes.
 
Top