Counter/Timers (8254)
Read Operations
It is possible to read the value of a counter without disturbing the
count in progress. Three possible methods for reading the counters in
the 8254 are a simple read operation, the Counter Latch command,
and the Read-Back command.
Simple Read
The first method is to perform a simple read operation.
We
recommend that the counter CLK input first be inhibited by using the
GATE input or by external logic if the clock input comes from the
frontplane connector J3. Otherwise, the count may be in the process
of changing when it is read, giving an undefined result. To read the
counters 0, 1, or 2, access them at I/O port addresses 0040h, 0041h, or
0042h, respectively.
Keep in mind that if the Control Word indicates a read of two bytes,
then two separate byte I/O inputs must be performed at the
appropriate I/O address. These are not required to be read one right
after the other, but may be interleaved with other I/O operations,
including those to other counters.
Counter Latch Command
The second method uses the Counter Latch command. Like a Control
Word, this command is written to the Control Word register, which is
selected at address 0043h.
Bits 4 and 5 distinguish the Latch
command from a simple read or write Control Word. Counter Latch
commands do not affect the programmed mode of the counter in any
way. Refer to Figure 11-4 for details on the Control Word format.
11-8