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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/23/05 08:33
Modified:
  12/23/05 08:34

Read: times


 
#105815 - DS12887 SET bit
Responding to: ???'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_OPT_T RTC_opts;

RTC_opts = get_RTC_opts();
BIT_RECONF(RTC_opts, SET_MASK, SET_MASK);
set_RTC_opts(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:
BIT_RECONF(RTC_opts, SET_MASK, ~SET_MASK);
set_RTC_opts(RTC_opts);
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
TopicAuthorDate
Something strange with DS12887            01/01/70 00:00      
   MMIO            01/01/70 00:00      
   DS12887 SET bit            01/01/70 00:00      
      DS12887 SET bit            01/01/70 00:00      
         Do not manipulate during update cycle            01/01/70 00:00      

Back to Subject List