Hi guys,
I'm adding calendar-date/time tracking to my clock driver (rather than just counting ticks). I'm working on grabbing the current date and time from the RTC. It mostly works, except for one odd thing. Note (in case it's relevant) that I'm testing with Bochs 2.4.5.
The one thing that's not working is this: If I read "Status Register B" by doing an outb 11 (address for this register) on port 0x70 and an inb on port 0x71, bit 2 is not set, indicating that the numbers returned if I read the time will not be in BCD. However they are, in fact, in BCD. For example at 37 minutes past the hour, I got 0x37 (55) rather than 0x25 (37). Why is the status register lying to me?
The info I got on this status register comes from my copy of "The Indepensible PC Hardware Book", which is somewhat out of date, but I don't imagine this has changed. The only thing I found in the wiki was that it may be in BCD, but it doesn't say how to check whether it's in BCD or not.
Any help would be appreciated!
Thanks,
Tyrel
Realtime clock issue [SOLVED]
- TyrelHaveman
- Member
- Posts: 40
- Joined: Thu Sep 20, 2007 11:20 pm
- Location: Bellingham, WA
- Contact:
Realtime clock issue [SOLVED]
Last edited by TyrelHaveman on Sat Jun 19, 2010 9:28 am, edited 1 time in total.
Re: Realtime clock issue
0 means BCD.
If a trainstation is where trains stop, what is a workstation ?
- TyrelHaveman
- Member
- Posts: 40
- Joined: Thu Sep 20, 2007 11:20 pm
- Location: Bellingham, WA
- Contact:
Re: Realtime clock issue
So the book is wrong?gerryg400 wrote:0 means BCD.
Re: Realtime clock issue
I don't have the book so I can't check, but maybe.
Edit: what I mean is that my source says 0 means bcd, so I think the book is wrong. We need others to comment.
Edit: what I mean is that my source says 0 means bcd, so I think the book is wrong. We need others to comment.
If a trainstation is where trains stop, what is a workstation ?
Re: Realtime clock issue
Hi,
The information I use is from a text file called "pctim003.txt". It's old, but very complete and covers just about everything you could want to know about timers and timing for older hardware; and is the best reference for RTC and PIT that I've ever seen. I did a quick search and found it online: here!.
Cheers,
Brendan
My information says 0 = BCD, 1 = binary; and I know this is right because I've used it to read the RTC correctly (on a variety of computers) in the past.gerryg400 wrote:Edit: what I mean is that my source says 0 means bcd, so I think the book is wrong. We need others to comment.
The information I use is from a text file called "pctim003.txt". It's old, but very complete and covers just about everything you could want to know about timers and timing for older hardware; and is the best reference for RTC and PIT that I've ever seen. I did a quick search and found it online: here!.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Realtime clock issue
The wiki CMOS article says very clearly:
Status Register B, Bit 1 (value = 2): Enables 24 hour format if set
Status Register B, Bit 2 (value = 4): Enables Binary mode if set (which means BCD mode is 0)
-- so yes, your book is totally wrong.
And I hope that when you access Status register B, that that's a decimal 11 you are using for the IO port.
Status Register B, Bit 1 (value = 2): Enables 24 hour format if set
Status Register B, Bit 2 (value = 4): Enables Binary mode if set (which means BCD mode is 0)
-- so yes, your book is totally wrong.
And I hope that when you access Status register B, that that's a decimal 11 you are using for the IO port.
- TyrelHaveman
- Member
- Posts: 40
- Joined: Thu Sep 20, 2007 11:20 pm
- Location: Bellingham, WA
- Contact:
Re: Realtime clock issue
Thanks to all of you! I've written the correction in my copy of that book in case I ever run across that again.
Also, thanks, bewing, for pointing that out on the CMOS article. I see now that the "Time And Date" article I was reading does indeed point to the CMOS article, I just missed it somehow.
Also, thanks, bewing, for pointing that out on the CMOS article. I see now that the "Time And Date" article I was reading does indeed point to the CMOS article, I just missed it somehow.