Instruction manual

Table Of Contents
PC215E Page 94
6.6.8.6 Divide an External Frequency - TCdivideFreq
Measures an external signal’s frequency, then generates another signal whose frequency is
the external frequency divided by a specified number. N.B. this function is not on-going, and
must be called at a regular interval to keep the generated frequency tracking the external
signal. Note the output signal will be a square wave.
i = TCdivideFreq (h, ipChip, ipChan, opChip, opChan, divisor)
where
h Integer. Board handle as issued by function
registerBoard.
ipChip Integer. Address offset of the timer/counter
chip on which the input frequency will be
measured.
ipChan Integer. Input timer/counter channel on which
to perform the frequency measurement. The
external signal must be connected to the clock
input of this channel. Another timer channel
(chan-2) will also be used to provide the gate
signal. This may be on the previous chip.
opChip Integer. Address offset of the timer/counter
chip on which to generate the output frequency.
One of the following pre-defined constants may
be used:
X1 = 0
X2 = 4
Y1 = 8
Y2 = 12
Z1 = 16
Z2 = 20.
opChan Integer. Output timer/counter channel number
within the chip (0, 1 or 2).
divisor Float. Division Factor
Returns Integer:
OK
or ERRHANDLE
ERRCHAN
ERRDATA
Prior Calls registerBoard
See Also TCmultiplyFreq
TCfreeResource