8254 MODES
MODE 0: INTERRUPT ON TERMINAL COUNT
In this mode OUT is low. Once a count is loaded the counter is decremented after every cycle,
and when count reaches zero, the OUT goes high.
This can be used as an interrupt. The OUT remains high until a new count or command word is
loaded.
MODE 1: HARDWARE RETRIGGERABLE ONE SHOT
In this mode OUT is intially high. When gate is triggered, the OUT goes low, and at the end of
count it goes high again, thus generating a one shot pulse.
MODE 2: RATE GENERATOR
The mode is used to generate a pulse equal to given clock period at a given interval.
When a count is loaded, the OUT stays high until count reaches 1 and then OUT goes low
for 1 clock period then gets reloaded automatically and this is how pulse gets generated
continuously.
MODE 3: SQUARE WAVE GENERATOR
In this a continuous square wave with period equal to count is generated.
The frequency of square wave = frequency of clock divide by count.
if count (N) is odd pulse stay high for (N + 1)/2 and low for (N - 1)/2.
MODE 4: SOFTWARE TRIGGERED STROBE
In this mode OUT is initially high, it goes low for one clock period at the end of count.
The count must be reloaded for subsequent outputs.
MODE 5: HARDWARE TRIGGERED STROBE
Same as MODE4 except that it is triggered by rising pulse at gate.