Measures the frequency of a signal. This function is only used with 9513 counters. This function uses internal counters #4 and #5.
C/C++
int cbCFreqIn(int BoardNum, int SigSource, int GateInterval, unsigned short *Count, long *Freq)
Visual Basic
Function cbCFreqIn(ByVal BoardNum&, ByVal SigSource&, ByVal GateInterval&, Count%, Freq&) As Long
BoardNum
The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99. The specified board must have a 9513 counter.
SigSource
Specifies the source of the signal from which the frequency is calculated.
The signal to be measured is routed internally from the source specified by SigSource to the clock input of counter 5. On boards with more than one 9513 chip, there is more than one counter 5. Which counter 5 is used is also determined by SigSource. Set it to one of the constants in the "SigSource argument values" section below.
The value of SigSource determines which chip will be used. CTRINPUT6 through CTRINPUT10, FREQ6 through FREQ10 and GATE6 through GATE9 indicate chip two will be used. The signal to be measured must be present at the chip two input specified by SigSource. Also, the gating connection from counter 4 output to counter 5 gate must be made between counters 4 and 5 OF THIS CHIP (see below).
Refer to board-specific information in the UL Users Guide to determine valid values for your board.
GateInterval
Gating interval in milliseconds (must be > 0). Specifies the time (in milliseconds) that the counter will be counting. The optimum GateInterval depends on the frequency of the measured signal. The counter can count up to 65,535.
If the gating interval is too low, then the count will be too low and the resolution of the frequency measurement will be poor. For example, if the count changes from 1 to 2 the measured frequency doubles.
If the gating interval is too long the counter will overflow and a FREQOVERRUN error will occur.
The cbCFreqIn function does not return until the GateInterval has expired. There is no background option. Under Windows, this means that window activity will stop for the duration of the call. Adjust the GateInterval so this does not pose a problem to your user interface.
Count
The raw count is returned here.
Freq
The measured frequency in Hz is returned here.
One 9513 chip (Chip 1 used): | CTRINPUT1 through CTRINPUT5 |
GATE1 through GATE4 | |
FREQ1 through FREQ5 | |
Two 9513 chips (Chip 1 or Chip 2 used): | CTRINPUT1 through CTRINPUT10 |
GATE 1 through GATE 9 (excluding gate 5) | |
FREQ1 through FREQ10 | |
Four 9513 chips (Chips 1- 4 may be used): | CTRINPUT1 through CTRINPUT20 |
GATE1 through GATE19 (excluding gates 5, 10, and 15) | |
FREQ1 through FREQ20 |