Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Sasha Jevtic
12/23/05 01:33
  12/23/05 01:34

Read: 771 times
Barrington, Il

#105815 - DS12887 SET bit
Responding to: Zia Banihashem's previous message
Zia Banihashem said:
Hi friends
I was trying to use DS12887 and I secceeded but I found something strange with it.
According to the datasheet for reading and writing time The 7th bit of register B (SET) should be Set and Reset you know, but I do it without any setting and resetting, why???

I think you might be a bit confused about the SET bit. As you are probably aware, time is kept in a double buffered fashion in the DS12887. The purpose of the SET bit is to prevent the internal copy of the time from being written into the external, user-accessible copy of the time on each update cycle. When the SET bit is 0, the user-accessible copy of the time updates normally; when it is 1, the user copy of the time does not update, although interally, the '12887 continues to keep time.

Use of the SET bit is one way to guarantee that the you do not read a time value that is changing, potentially leading to the retreival of incorrect data. Similarly, it could also be used in setting of the time. However, you might find even more application-specific uses for it.

Zia Banihashem said:
And I need a piece of information for using the data bus.
when using an external RAM or ROM with 8051, Port 0 and 2 prepare address and data and they can't be used for any other purpose, my question is: Even if we use timing and can't we share the data BUS( port 0)? for exmaple when we have a RTC , a LCD display, an A/D can't we share the Data BUS? I thing it's possible, what's your idea???

Erik Malund said:
search on MMIO or memory mapped I/O

Erik is right; you need to clear up some fundamental issues relating to the connection of peripherals to the 8052's memory bus. Once you have that taken care of, you can work more with the '12887.

Also, I wrote extensively on the '12887 just a few days ago; you might want to take a look at it. If I recall correctly, setting the SET bit with my driver would be done something like this:

RTC_opts = get_RTC_opts();
Then, if you later wanted to clear the SET bit, assuming that variable is still in scope and the contents of RTC_opts is still accurate:
If you find yourself doing this a lot, you might want to add a function to the driver that does everything necessary to set/clear the SET bit so as to avoid the needing several lines of RTC manipulation code in the higher-level calling code as well as reduce the overhead associated with the number of function calls. Code size was a greater concern when I wrote this driver, and thus, the interface is not very rich.

--Sasha Jevtic

List of 5 messages in thread
Something strange with DS12887      Zia Banihashem      12/22/05 07:42      
   MMIO      Erik Malund      12/22/05 08:42      
   DS12887 SET bit      Sasha Jevtic      12/23/05 01:33      
      DS12887 SET bit      Zia Banihashem      12/25/05 09:35      
         Do not manipulate during update cycle      Sasha Jevtic      12/26/05 12:53      

Back to Subject List