RTC: Difference between revisions

Jump to navigation Jump to search
707 bytes added ,  15 years ago
no edit summary
[unchecked revision][unchecked revision]
No edit summary
No edit summary
Line 2:
 
====Introduction====
Most OSs use the [[PIT]] for timing purposes. However, I believe the RTC works just as well. RTC stands for Real Time Clock. It is the chip that keeps your computers CMOS clock up-to-date. Within the chip is also the [[CMOS]] 64 bytes of RAM.
 
====Programming itCapabilities====
The RTC is capable of multiple frequencies. However, the only one acceptable for keeping time is 1024hz. For this reason, it is strongly NOT recommended that you change the frequency of the RTC, or your computers clock will no longer be accurate. However, if you need an interrupt frequency higher than 1024hz, it is possible to reprogram just the rate of the interrupt. The RTC can handle 15 interrupt rates between 2hz and 32767 Hz, theoretically. On most machines however, the interrupt rate can not go higher than 8khz.
 
====Avoiding the NMI====
When programming the RTC, it is important that the [[NMI]] (non-maskable-interrupt) be disabled. This is because if an NMI happens, then your programming code will be interrupted. This would usually not be a big deal, but the RTC is never initialized by BIOS. Actually, BIOS initializes itself from the CMOS. Note, just cause the computer reboots, doesn't mean the RTC does. The RTC is powered by an internal battery and is separate from the rest of the computer.
 
You can disable the NMI with
 
<pre>
outportb(0xA0, inportb(0xA0) | 0x80);
</pre>
 
You can later reenable the NMI with
<pre>
outportb(0xA0, inportb(0xA0) & 0x7F);
</pre>
 
====See Also====
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu