I am using the DS1643 which contain both non voliate ram and a RTC. also, in my project, i use the timer 1 interrupt to counter the machine operation time: unsigned char second, min, hour; i use XBYTE[0x1ffe0]=second; XBYTE[0x1ffe1]=min; XBYTE[0x1ffe2]=hour; then i have a function to recall the NVram data to the counter variavle. it is not problem for the reset the system, and all data can be keep. however, when i remove the power supply, all data are going wrong. How can i solve this problem? any programming skills needed for using NVRAM? Pls help!!!!!!!!!!!!!!!! many thx!!!!!!!!!!!!!!
There are lots of different types of Non-volatile RAM. Are you using a battery backup type. If so, the obvious question is what happens when you remove the power? If the RAM is corrupted when power is removed, the battery is not doing its job and it is a hardware problem.
I am using the internal backup battery type. According to datasheet. It can hold the data for more than 10 years. CAn u give some hints for me to solve this problem. Because my project deadline is coming.
If your code works when you reset the CPU, but doesn't work when you power on the CPU, then you've got a couple of possibilities: 1) Your code doesn't really do the same thing on a reset as on a power-on start. 2) The NVRAM doesn't really keep its values when you turn the power off. I'd try to rule out #2 by setting up my emulator to stop the CPU immediately, and powering on the system. Using the emulator to read and write the RAM, you should be able to see values there (or not). Turn it off and back on, and see if the values you wrote via the emulator are still there. If the chip really works, then you can move on to #1, and figure out what's different about the path your code takes when the system powers on. Perhaps there's some configuration (internal or external) that survives a reset that gets scrambled by the power cycle, and access to the NVRAM isn't set up properly.
I am not familiar with your device, but many RTC type chips which have an internal battery are shipped with the battery disabled, and you have to set an obscure bit in a control register to enable the battery.