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 to read and write the time and date in RTC

Status
Not open for further replies.

liuyangqwin

Newbie level 2
Newbie level 2
Joined
Jul 12, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
19
Reading and writing the time and date registers is an asynchronous event, separate from the automatic update of the internal registers. Two types of read errors can occur when the time and date registers increment while being read. First, the data could change while a single register is being read, or, second, the data could change during the time between reading two registers. Assume, for example, that the clock increments from 11:59:59 to 12:00:00 during a read of the seconds, minutes, and hours registers. The time read could be 12:00:59, which is incorrect.
How to read and write the time and date in RTC?
 

Well since you have not mentioned the RTC controller that you are using, so its kind of difficult to answer your question, But generally all such operations where register value can change during a read/write operation, secondary registers are used. So whenever you initiate a read, all the values from internal registers are copied to these secondary registers. And while you are reading even if internal registers get updated, value on the secondary register remains the same. This gives you an accurate reading.
I've used DS1307 long time ago, atleast that had this feature.
 

I use the I2C to read and write. I considered the second register. But how to save a second register value of internal registers. When I2C read data in time how to ensure that the second register internal data unchanged. I considered the following structure, but there may be Competition risk on OR gate 2013-07-13_100516.png


Well since you have not mentioned the RTC controller that you are using, so its kind of difficult to answer your question, But generally all such operations where register value can change during a read/write operation, secondary registers are used. So whenever you initiate a read, all the values from internal registers are copied to these secondary registers. And while you are reading even if internal registers get updated, value on the secondary register remains the same. This gives you an accurate reading.
I've used DS1307 long time ago, atleast that had this feature.

- - - Updated - - -

I use the I2C to read and write. I considered the second register. But how to save a second register value of internal registers. When I2C read data in time how to ensure that the second register internal data unchanged. I considered the following structure, but there may be Competition risk on OR gate2013-07-13_100516.png


Well since you have not mentioned the RTC controller that you are using, so its kind of difficult to answer your question, But generally all such operations where register value can change during a read/write operation, secondary registers are used. So whenever you initiate a read, all the values from internal registers are copied to these secondary registers. And while you are reading even if internal registers get updated, value on the secondary register remains the same. This gives you an accurate reading.
I've used DS1307 long time ago, atleast that had this feature.
 

I dint get you
Are you trying to make your own controller or using an off the shelf RTC?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top