DAQmxCreateCIPeriodChan
int32 DAQmxCreateCIPeriodChan (TaskHandle taskHandle, const
char counter[], const char
nameToAssignToChannel[], float64 minVal, float64 maxVal, int32 units, int32
edge, int32 measMethod, float64 measTime, uInt32 divisor, const char
customScaleName[]);
Purpose
Creates a channel to measure the period of a digital signal and
adds the channel to the task you specify with taskHandle. You
can create only one counter input channel at a time with this function because a
task can include only one counter input channel. To read from multiple counters
simultaneously, use a separate task for each counter. Connect the input signal
to the default input terminal of the
counter unless you select a different input terminal.
|
Note When measMethod is set to
DAQmx_Val_LowFreq1Ctr, you must pass the
values 0.000001 for measTime
and 4 for divisor. These
values will be ignored by the function, but if they are not passed, the
function returns an error. |
Parameters
Input
|
Name |
Type |
Description |
taskHandle
|
TaskHandle |
The task to which to add the channels that this function creates. |
counter
|
const char []
|
The name of the counter to use to create virtual channels. |
nameToAssignToChannel
|
const char []
|
The name(s) to assign to the created virtual channel(s). If you do not specify a name, NI-DAQmx uses the physical channel name as the virtual channel name. If you specify your own names for nameToAssignToChannel, you must use the names when you refer to these channels in other NI-DAQmx functions.
If you create multiple virtual channels with one call to this function, you can specify a list of names separated by commas. If you provide fewer names than the number of virtual channels you create, NI-DAQmx automatically assigns names to the virtual channels. |
minVal
|
float64 |
The minimum value, in units, that you expect to measure. |
maxVal
|
float64 |
The maximum value, in units, that you expect to measure. |
units
|
int32 |
The units to use to return the measurement.
Value |
|
Description |
DAQmx_Val_Seconds
|
|
seconds |
DAQmx_Val_Ticks
|
|
Timebase ticks |
DAQmx_Val_FromCustomScale
|
|
Units a custom scale specifies. Use customScaleName to specify a custom scale. |
|
edge
|
int32 |
Specifies between which edges to measure the frequency or period of the signal.
Value |
|
Description |
DAQmx_Val_Rising
|
|
Rising edge(s). |
DAQmx_Val_Falling
|
|
Falling edge(s). |
|
measMethod
|
int32 |
Specifies the method used to calculate the frequency or period of the signal.
Value |
|
Description |
DAQmx_Val_LowFreq1Ctr
|
|
Use one counter that uses a constant timebase to measure the input signal. |
DAQmx_Val_HighFreq2Ctr
|
|
Use two counters, one of which counts pulses of the signal to measure during the specified measurement time. |
DAQmx_Val_LargeRng2Ctr
|
|
Use one counter to divide the frequency of the input signal to create a lower-frequency signal that the second counter can more easily measure. |
|
measTime
|
float64 |
The length of time to measure the frequency or period of a digital signal, when measMethod is DAQmx_Val_HighFreq2Ctr. Measurement accuracy increases with increased measurement time and with increased signal frequency.
|
Caution If you measure a high-frequency signal for too long a time, the count register could roll over, resulting in an incorrect measurement.
|
|
divisor
|
uInt32 |
The value by which to divide the input signal, when measMethod is DAQmx_Val_LargeRng2Ctr. The larger this value, the more accurate the measurement, but too large a value can cause the count register to roll over, resulting in an incorrect measurement. |
customScaleName
|
const char []
|
The name of a custom scale to apply to the channel. To use this parameter, you must set units to DAQmx_Val_FromCustomScale. If you do not set units to DAQmx_Val_FromCustomScale, you must set customScaleName to NULL. |
Return Value
Name |
Type |
Description |
status
|
int32 |
The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error. |