Manual Number: 00650-014-4
Page 8-6
AD12-8 Manual
Generating Square Waves of Programmed Frequency
Frequency of output is a direct function of the frequency of the clock input and of the count loaded
into the counter. The minimum count (or divisor) is 2 and the maximum is 65535.
Calculating what divisor to use for a specific output frequency is straightforward. If, for example,
you desire a 1KHz output and your clock is 5MHz, divide by 1000 and find that the count to be
loaded into counter #0 should by 5000.
Measuring Frequency and Period
The two previous sections show how to count pulses and generate output frequencies. It is also
possible to measure frequency by raising the gate input of Counter #0 for a known time interval and
counting the number of clock pulses accumulated for that interval. The gating signal can be de-
rived from Counters #1 and #2 operating in a square wave mode.
Counter #0 can also be used to measure pulse width or half period of a periodic signal. The signal
should be applied to the gate input of Counter #0 and a known frequency applied to the Counter #0
clock input. During the interval when the gate input is low, Counter #0 is loaded with a full count
of 65,535. When the gate input goes high, the counter begins decrementing until the gate input
goes back low at the end of the pulse. The counter is then read and the change in counts is a linear
function of the duration of the gate input signal. If Counter #0 receives 10 microsecond duration
clock pulses (100 KHz), the maximum pulse duration that can be measured is 65,535*10
-5
= 655
milliseconds.
Generating Time Delays
There are four methods of using Counter #0 to generate programmable time delays.
Pulse on Terminal Count
After loading, the counter output goes low. Counting is enabled when the gate goes high. The
counter output will remain low until the count reaches zero, at which time the counter output goes
high. The output will remain high until the counter is reloaded by a programmed command. If the
gate goes low during countdown, counting will be disabled as long as the gate input is low.
Programmable One-Shot
The counter need only be loaded once. The time delay is initiated when the gate input goes high.
At this point the counter output goes low. If the gate input goes low, counting continues but a new
cycle will be initiated if the gate input goes high again before the timeout delay has expired; i.e., is
re-triggerable. At the end of the timeout, the counter reaches zero and the counter output goes high.
That output will remain high until re-triggered by the gate input.
Software Triggered Strobe
This is similar to Pulse-on-Terminal-Count except that, after loading, the output goes high and
only goes low for one clock period upon timeout. Thus, a negative strobe pulse is generated a
programmed duration after the counter is loaded.