Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How come the value in my RAM of DS1307 RTC become zero?

Status
Not open for further replies.

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
Hi guys... I'm using the 56 bytes of RAM in the DS1307 to store some data. My DS1307 is connected to the PIC18F46K22. But after running a few days, all the data inside the RAM will suddenly become zeros. The time in the RTC is still accurate but it's just that all the data in the RAM has become zero. I have check my coding but cannot pin point what's the problem. Do you guys have any idea? I did not reset it to zero from my coding...
 

Is it EEPROM??? RAM is temporary storage unit

If u program RTC once then it will keep go on with CMOS...
Yes. It is RAM which is backup by a battery. I don't know why after running a few days, this the values in this RAM will all reset to zero, but the time and date still accurate. Do you have any idea what's wrong?
 

I don't power off my device.. It is running 24 hours. So the data in my RAM should not be disappearing..
 

actually i did not used ram in DS1307,

Normally low voltages to RAM corrupts the data,Check your battery voltage.
 

Most probable cause is low voltage. you should have more than 2 volt in battery terminals. but the clock will be optimized to work even in low voltages.
 

Most probable cause is low voltage. you should have more than 2 volt in battery terminals. but the clock will be optimized to work even in low voltages.

But I don't turn off my device.. My device is running 24 hours.. means 24 hours it is with power on. How come it will involve the voltage of the battery?
 

Oh god, can you post the code? how come you found is getting zero. how time exactly take to zero ?

Is there a possibility of loose connections?
 

Is there any possibilities that during the time when data is written to the RAM, there is some interruption from the ISR? I am using a timer in the ISR.
Do we need to put INTCONbits.GIE = 0; when data is written to the RTC RAM?
 

maniac84, the memory doesn't clear itself. Something electrical or in software is clearing it and apart from telling us what MCU you use, you have given absolutely no information whatsoever on what you try to achieve or how you do it. I'm afraid "it doesn't work, what's wrong?" is inadequate if you want an informative answer.

Brian.
 

Not to do it completely

Code C - [expand]
1
2
3
INTCONbits.GIE = 0;
Ram access code;
INTCONbits.GIE = 1;



Why don you have a single thread for this problem ?

It would be easy for everyone to understand.
 
Last edited:

Not to do it completely

Code C - [expand]
1
2
3
INTCONbits.GIE = 0;
Ram access code;
INTCONbits.GIE = 1;



Why don you have a single thread for this problem ?

It would be easy for everyone to understand.


I have tried this, but then when got data comes from the RS485 communication, it will miss some data...
 

I'm sorry but without more details we can't help. We need to see the code, just turning interrupts off during the RAM routines would quite predictably stop other things working.

Brian.
 

If your I2C write routines glitch, I suppose you may loose/zero data bytes.

Using I2C RAM to store serial data from the RS485 sounds a bit iffy.
What happens when you receive new data on the RS485, and you are in the process of writing I2C data? Will you get collisions?

Why not use the processor RAM to store the serial data, and use the Serial RAM to store less frequent/ time constrained data?
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top