You say "(the PIC cannot retain variable in sleep mode, and sleep is absolutely necessary)" but what do you base this on? I have skimmed the data sheet and I am led to believe that RAM IS preserved.
Table 10.1 on page 53 says that data will be preserved as long as the supply voltage stays above 1.5 volts.
Parameter D002 VDR RAM Data Retention Voltage(2) — 1.5* — V Device in Sleep mode
Note 2: This is the limit to which VDD can be lowered in Sleep mode without losing RAM data.
What I would be checking is voltage sag during writes to EEROM. Most EEROM has a 'high voltage generator' to provide the programming voltage and this briefly draws a high current. If you are using lithium thionyl chloride primary batteries there is a short but severe voltage drop usually attributed to 'passivation effects' as your device wakes up and draws current. That voltage sag will scramble RAM and make it look like data was not preserved during sleep. A big tantalum capacitor across the battery helps but beware the leakage current will shorten the battery lifetime. Careful PCB layout with fat power and ground tracks also helps.
There are many varieties of lithium batteries. All have high internal energy but some are designed for very low drain such as memory protection and others are better at supplying spike currents. Read the Tadiran and Eagle Picher data sheets for details.
Saving data in RAM and only writing the ten minute result will save you power if not codespace.
Can you please explain what is going on here...
'Word names aliased to Bytes using EXT
ASM
W0 = _B0 + 0
W1 = _B0 + 2
W2 = _B0 + 4
ENDASM
W0 VAR WORD EXT
W1 VAR WORD EXT
W2 VAR Word EXT
I have not seen that construct before.
Cheers
BrianT
Bookmarks