Chapter 2 Function Reference — CTR_Rate
NI-DAQ FRM for PC Compatibles 2-104
©
National Instruments Corporation
CTR_Rate
Format
status = CTR_Rate (freq, duty, timebase, period1, period2)
Purpose
Converts frequency and duty-cycle values of a selected square wave into the timebase and
period parameters needed for input to the
CTR_Square function that produces the square
wave.
Parameters
Input
Output
Parameter Discussion
freq is the square wave frequency selected in cycles per second (Hz).
Range: 0.0008 through 2,500,000 Hz.
duty is the square wave duty cycle you select as a fraction. With positive output polarity and
TC toggled output selected, the fraction expressed by duty describes the fraction of a single
wavelength of the square wave that is logical high.
Range: 0.0 through 1.0 noninclusive (that is, any value between, but not including,
0.0 and 1.0).
timebase is a code that represents the resolution of the onboard source signal that the counter
uses to produce the square wave. You can input the value returned by timebase directly to the
CTR_Square function.
1: 1 µs.
2: 10 µs.
Name Type Description
freq f64 frequency selected
duty f64 duty cycle selected
Name Type Description
timebase i16 onboard source signal used
period1 u16 units of time that the square wave is high
period2 u16 units of time that the square wave is low