Instruction manual

Table Of Contents
Page
83
PC215E
6.6.6.2 Generate Astable Multivibrator Waveform - TCsetAstable
Generates a clock signal of specified frequency and mark-to-space ratio. This is implemented
on two counters, both in mode 1 (digital one-shot). One counter counts the mark time and the
other counts the space time. The outputs of each counter/timer control the gate of the other,
so that when the mark times-out, the space counter is triggerred and vice versa. N.B. the user
must connect each counter’s gate to the other’s output on the user connector SK1. See section
4.2.3 for more details on the Astable application.
i = TCsetAstable (h, chip, chan, chipS, chanS, freq, msratio)
where
h Integer. Board handle as issued by function
registered board.
chip Integer. Address offset of timer/counter chip.
One of the following pre-defined constants may
be used:
X1 = 0
X2 = 4
Y1 = 8
Y2 = 12
Z1 = 16
Z2 = 20.
chan Integer. Timer/counter channel number within
the chip (0, 1 or 2).
chipS Integer. Address offset of secondary
timer/counter chip. One of the following pre-
defined constants may be used:
X1 = 0
X2 = 4
Y1 = 8
Y2 = 12
Z1 = 16
Z2 = 20.
chanS Integer. Secondary timer/counter channel
number within the chip (0, 1 or 2).
freq Float. Desired frequency, in Hertz.
msratio Float. Desired mark to space ratio, defined as
(mark time/period), i.e. 0 is D.C. 0V, 1 is D.C.
5V, 0.5 is symmetrical square wave, i.e. high for
1 and low for 1.
Returns Integer:
Handle to the astable multi-vibrator (positive integer). Use this
handle to call the TCfreeAstable function when finished, in order to
free up the counter/timers for re-use.
or ERRHANDLE
ERRDATA
Prior Calls registerBoard
See Also TCfreeAstable