Counter/Timers (8254)
Mode 3: Square Wave Mode
Mode 3 is typically used for baud rate generation. Mode 3 is similar
to Mode 2 except for the duty cycle of OUT. OUT is initially high.
When half the initial count has expired, OUT goes low for the
remainder of the count. Mode 3 is periodic; the sequence above is
repeated indefinitely. An initial count of N results in a square wave
with a period of N CLK cycles.
GATE = 1 enables counting
GATE = 0 disables counting
If GATE goes low while OUT is low, OUT is set high immediately:
no CLK pulse is required. A trigger reloads the counter with the
initial count on the next CLK pulse. Thus the GATE input can be
used to synchronize the counter.
After writing a Control Word and initial count, the counter is loaded
on the next CLK pulse. This allows the counter to be synchronized by
software.
Writing a new count while counting does not affect the current
counting sequence. If a trigger is received after writing a new count
but before the end of the current half-cycle of the square wave, the
counter will be loaded with the new count on the next CLK pulse and
counting continues from the new count. Otherwise, the new count is
loaded at the end of the current half-cycle.
Mode 3 is implemented as follows:
Even counts:
OUT is initially high. The initial count is loaded
on one CLK pulse and then is decremented by two
on succeeding CLK pulses.
When the count
expires, OUT changes value and the counter is
reloaded with the initial count. The above process
is repeated indefinitely.
11-19