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...
 

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
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?
 

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
I don't power off my device.. It is running 24 hours. So the data in my RAM should not be disappearing..
 

Thota Suresh Avionics

Member level 2
Joined
Jul 15, 2013
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
8
Activity points
345
actually i did not used ram in DS1307,

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

Venkadesh_M

Advanced Member level 4
Joined
Jun 26, 2013
Messages
1,375
Helped
258
Reputation
516
Reaction score
254
Trophy points
83
Location
Coimbatore, India
Activity points
6,738
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.
 

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
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?
 

Venkadesh_M

Advanced Member level 4
Joined
Jun 26, 2013
Messages
1,375
Helped
258
Reputation
516
Reaction score
254
Trophy points
83
Location
Coimbatore, India
Activity points
6,738
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?
 

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
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?
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,216
Helped
4,958
Reputation
9,938
Reaction score
4,783
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
129,201
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.
 

Venkadesh_M

Advanced Member level 4
Joined
Jun 26, 2013
Messages
1,375
Helped
258
Reputation
516
Reaction score
254
Trophy points
83
Location
Coimbatore, India
Activity points
6,738
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:

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
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...
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,216
Helped
4,958
Reputation
9,938
Reaction score
4,783
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
129,201
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.
 

Gorgon

Full Member level 6
Joined
Nov 10, 2005
Messages
345
Helped
75
Reputation
150
Reaction score
67
Trophy points
1,308
Location
Norway
Activity points
3,667
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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top