CMOS: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
Additional comment about UTC |
m →Format of Bytes: Optimised the formula to prevent division and multiplication operations. |
||
Line 151:
In BCD mode, each of the two hex nibbles of the byte is modified to "display" a '''decimal''' number.
So 1:59:48 has hours = 1, minutes = 0x59 = 89, seconds = 0x48 = 72. To convert BCD back into a "good" binary value, use: binary = ((bcd / 16) * 10) + (bcd & 0xf) [Optimised: binary = (bcd >> 1) + (bcd >> 3) + (bcd & 0xf)].
24 hour time is exactly what you would expect. Hour 0 is midnight to 1am, hour 23 is 11pm.
|