DAQmxCreateCICountEdgesChan

NI-DAQmx C Functions

DAQmxCreateCICountEdgesChan

int32 DAQmxCreateCICountEdgesChan (TaskHandle taskHandle, const char counter[], const char nameToAssignToChannel[], int32 edge, uInt32 initialCount, int32 countDirection);

Purpose

Creates a channel to count the number of rising or falling edges 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.

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.
edge int32 Specifies on which edges of the input signal to increment or decrement the count.
Value Description
DAQmx_Val_Rising Rising edge(s).
DAQmx_Val_Falling Falling edge(s).
initialCount uInt32 The value from which to start counting.
countDirection int32 Specifies whether to increment or decrement the counter on each edge.
Value Description
DAQmx_Val_CountUp Increment the count register on each edge.
DAQmx_Val_CountDown Decrement the count register on each edge.
DAQmx_Val_ExtControlled The state of a digital line controls the count direction. Each counter has a default count direction terminal.

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.