Hi,
I am working on a project and need to get a clear answer on a potential problem.
We are using a PIC to communicate with a sensor. This sensor has some data that needs to be read initially in order to use it in formulating the output.
This data will be pulled upon startup and stored in an array. The results will also be stored into an array.
The device will be battery powered so it makes sense that when not sampling data we put it to sleep.
The question we have is when asleep do we loose the data stored in the array?
Array storage while sleeping
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Array storage while sleeping
What controller are you using? What sleep settings do you want to use?
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- Steve
- Matrix Staff
- Posts: 3422
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: Array storage while sleeping
Kersing is correct - it depends on what microcontroller you are using and what sleep mode you have it in.
Retaining power to the RAM is fairly significant and so in certain applications it is desirable to remove this power. I believe many modern micros have multiple options for sleep and so you will need to look at the device datasheet to see if this is possible.
One alternative is to use non-volatile memory such as EEPROM (some chips have it internally, but if not you can use an external chip). And other chips allow data to be written to the program memory space which is also non-volatile.
Hope this helps.
Steve.
Retaining power to the RAM is fairly significant and so in certain applications it is desirable to remove this power. I believe many modern micros have multiple options for sleep and so you will need to look at the device datasheet to see if this is possible.
One alternative is to use non-volatile memory such as EEPROM (some chips have it internally, but if not you can use an external chip). And other chips allow data to be written to the program memory space which is also non-volatile.
Hope this helps.
Steve.
Re: Array storage while sleeping
Hi,
The chip is possibly going to be PIC18LF25K22.
As for sleep modes, no idea as of yet, i didnt realise there were more than one setting. It will be the setting that requires least power.
I dont think EEPROM will be suitable as we will be constantly reading and writing to it so it will wear over time, Or at least thats how i read it.
Final application is a datalogger.
Program memory seems like a good option tho as long as this doesnt wear out as well with repeated writes.
The chip is possibly going to be PIC18LF25K22.
As for sleep modes, no idea as of yet, i didnt realise there were more than one setting. It will be the setting that requires least power.
I dont think EEPROM will be suitable as we will be constantly reading and writing to it so it will wear over time, Or at least thats how i read it.
Final application is a datalogger.
Program memory seems like a good option tho as long as this doesnt wear out as well with repeated writes.
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Array storage while sleeping
Except RAM all memory wears out when frequently rewritten.Synergy6 wrote:Program memory seems like a good option tho as long as this doesnt wear out as well with repeated writes.
The 18LF25K22 should retain RAM contents while in sleep mode if the voltage does not drop below 1.5V according to the data sheet.
For lowest power sleep mode all peripherals need to be disabled as well as brown out detect, watchdog timer, secondary oscillator and fixed voltage reference. If you want to take periodic measurements you will need to either provide an external interrupt source or use the watchdog (increasing the sleep consumption of the chip) to wake the device from sleep.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis