8254
Control Word Format
A
1
,A
0
e
11 CS
e
0RD
e
1WR
e
0
D
7
D
6
D
5
D
4
D
3
D
2
D
1
D
0
SC1 SC0 RW1 RW0 M2 M1 M0 BCD
SCÐSelect Counter
SC1 SC0
0 0 Select Counter 0
0 1 Select Counter 1
1 0 Select Counter 2
1 1 Read-Back Command
(see Read Operations)
RWÐRead/Write
RW1 RW0
0 0 Counter Latch Command (see Read
Operations)
0 1 Read/Write least significant byte only
1 0 Read/Write most significant byte only
1 1 Read/Write least significant byte first,
then most significant byte
MÐMode
M2 M1 M0
0 0 0 Mode 0
0 0 1 Mode 1
X 1 0 Mode 2
X 1 1 Mode 3
1 0 0 Mode 4
1 0 1 Mode 5
BCD
0 Binary Counter 16-bits
1 Binary Coded Decimal (BCD) Counter
(4 Decades)
NOTE:
Don’t care bits (X) should be 0 to insure compatibility with future Intel products.
Figure 7. Control Word Format
By contrast, initial counts are written into the Coun-
ters, not the Control Word Register. The A
1
,A
0
in-
puts are used to select the Counter to be written
into. The format of the initial count is determined by
the Control Word used.
Write Operations
The programming procedure for the 8254 is very
flexible. Only two conventions need to be remem-
bered:
1) For each Counter, the Control Word must be writ-
ten before the initial count is written.
2) The initial count must follow the count format
specified in the Control Word (least significant
byte only, most significant byte only, or least sig-
nificant byte and then most significant byte).
Since the Control Word Register and the three
Counters have separate addresses (selected by the
A
1
,A
0
inputs), and each Control Word specifies the
Counter it applies to (SC0,SC1 bits), no special in-
struction sequence is required. Any programming
sequence that follows the conventions in Figure 7 is
acceptable.
A new initial count may be written to a Counter at
any time without affecting the Counter’s pro-
grammed Mode in any way. Counting will be affected
as described in the Mode definitions. The new count
must follow the programmed count format.
If a Counter is programmed to read/write two-byte
counts, the following precaution applies: A program
must not transfer control between writing the first
and second byte to another routine which also writes
into that same Counter. Otherwise, the Counter will
be loaded with an incorrect count.
6