home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource3
/
141_01
/
clock.doc
< prev
next >
Wrap
Text File
|
1985-03-11
|
2KB
|
55 lines
clock.doc 84/04/06 pmk
Inteface to Alpha Products NEWCLOCK-80 clock peripheral
The clock consists of 13 I/O ports addressed 0xB0 (176)
to 0xBC (188) inclusive, each holding a four-bit right-
justified integer. They represent seconds (0xB0), tens of
seconds (0xB1), minutes (0xB2), tens of minutes (0xB3),
hours (0xB4), tens of hours (0xB5), day of the week (0-6,
0xB6), days (0xB7), tens of days (0xB8), months (0xB9), tens
of months (0xBA), years (0xBB), and tens of years (0xBC).
Three of the ports also have special bits (within the right
nibble) as detailed below. Each port can be both read and
written, but writing anything to either of the seconds digits
(0xB0, 0xB1) clears both of them. All values read or written
should be AND'd with 0x0F.
The leap year, 12hr/24hr format, and AM/PM indication
(for 12hr format only) are handled by special bits in the tens
of days and tens of hours digits. For leap year, bit 0x4 of
port 0xB8 is zero normally and one if the NEXT February has 29
days. (Omission of leap years on centuries not divisible by
4 is probably not implemented - this will not matter until
2100 AD!) Format and AM/PM are handled by bits in the tens of
hours digit: Bit 0x8 of port 0xB5 is zero for 12hr format and
one for 24hr format; bit 0x4 is zero for AM and one for PM
(but only if bit 0x8 is zero). All these special bits must be
properly set when writing to their ports, or the modes will
change! Other unnecessary high-order bits (0xE in tens of
months, 0x8 in day of week, tens of minutes and tens of
seconds) simply read as zeroes.
Port Dec Contents
0xB0 176 Seconds - cleared by any write to 0xB0 or 0xB1
0xB1 177 Tens (3 bits) - cleared as above
0xB2 178 Minutes
0xB3 179 Tens (3 bits)
0xB4 180 Hours
0xB5 181 Tens (2 bits)
0x4: 0 = AM, 1 = PM (in 12hr format)
0x8: 0 = 12hr format, 1 = 24 hr format
0xB6 182 Day of Week (3 bits)
0xB7 183 Day of Month
0xB8 184 Tens (2 bits)
0x4: 0 = normal, 1 = 29 days next Feb
0xB9 185 Month
0xBA 186 Tens (1 bit)
0xBB 187 Year
0xBC 188 Tens
Clock is a utility to display the time and date. It continually
reads the seconds digit of the clock and updates the display
whenever the last digit changes.
B5 is zero for 12hr format and