Home
NI DAQmx Base C API reference Prev Page Prev Page
NI-DAQmx Base 3.x C Function Reference Help
Conventions
Related Documentation
Key Concepts
Clocks
Terminal Names
Task Configuration/Control
DAQmxBaseClearTask
DAQmxBaseCreateTask
DAQmxBaseIsTaskDone
DAQmxBaseLoadTask
DAQmxBaseResetDevice
DAQmxBaseStartTask
DAQmxBaseStopTask
Channel Configuration/Creation
Create Analog Input Channels
DAQmxBaseCreateAIThrmcplChan
DAQmxBaseCreateAIVoltageChan
Create Analog Output Channel
DAQmxBaseCreateAOVoltageChan
Create Digital Input Channels
DAQmxBaseCreateDIChan
Create Digital Output Channels
DAQmxBaseCreateDOChan
Create Counter Input Channels
DAQmxBaseCreateCIPeriodChan
DAQmxBaseCreateCICountEdgesChan
DAQmxBaseCreateCIPulseWidthChan
Position
DAQmxBaseCreateCILinEncoderChan
DAQmxBaseCreateCIAngEncoderChan
Create Counter Output Channels
DAQmxBaseCreateCOPulseChanFreq
Timing
DAQmxBaseCfgSampClkTiming
DAQmxBaseCfgImplicitTiming
Triggering
Start Trigger
DAQmxBaseDisableStartTrig
DAQmxBaseCfgDigEdgeStartTrig
DAQmxBaseCfgAnlgEdgeStartTrig
Reference Trigger
DAQmxBaseCfgAnlgEdgeRefTrig
DAQmxBaseCfgDigEdgeRefTrig
DAQmxBaseDisableRefTrig
Read Functions
DAQmxBaseReadAnalogF64
DAQmxBaseReadBinaryI16
DAQmxBaseReadCounterF64
DAQmxBaseReadCounterScalarF64
DAQmxBaseReadCounterScalarU32
DAQmxBaseReadCounterU32
DAQmxBaseReadDigitalScalarU32
DAQmxBaseReadDigitalU32
DAQmxBaseReadDigitalU8
Write Functions
DAQmxBaseWriteAnalogF64
DAQmxBaseWriteDigitalU8
DAQmxBaseWriteDigitalU32
DAQmxBaseWriteDigitalScalarU32
Export HW Signals
DAQmxBaseExportSignal
Internal Buffer Configuration
DAQmxBaseCfgInputBuffer
Error Handling
DAQmxBaseGetExtendedErrorInfo
Glossary
Important Information
Warranty
Copyright
Trademarks
Patents
WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS
Environmental Management
Technical Support and Professional Services

DAQmxBaseCreateCIAngEncoderChan

int32 DAQmxBaseCreateCIAngEncoderChan (TaskHandle taskHandle, const char counter[], const char nameToAssignToChannel[], int32 decodingType, bool32 ZidxEnable, float64 ZidxVal, int32 ZidxPhase, int32 units, uInt32 pulsesPerRev, float64 initialAngle, const char customScaleName[]);

Purpose

Creates a channel that uses an angular encoder to measure angular position. 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 signals to the default input terminals of the counter unless you select different input terminals.

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 such as Dev1/ctr0.
nameToAssignToChannel const char [] The name to assign to the created virtual channel. If you specify your own names for nameToAssignToChannel, you must use the names when you refer to these channels in other NI-DAQmxBase 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-DAQmxBase automatically assigns names to the virtual channels.
decodingType int32 Specifies how to count and interpret the pulses that the encoder generates on signal A and signal B. DAQmx_Val_X1, DAQmx_Val_X2, and DAQmx_Val_X4 are valid for quadrature encoders only. DAQmx_Val_TwoPulseCounting is valid only for two-pulse encoders.

DAQmx_Val_X2 and DAQmx_Val_X4 decoding are more sensitive to smaller changes in position than DAQmx_Val_X1 encoding, with DAQmx_Val_X4 being the most sensitive. However, more sensitive decoding is more likely to produce erroneous measurements if there is vibration in the encoder or other noise in the signals.

Value Description
DAQmx_Val_X1 If signal A leads signal B, count the rising edges of signal A. If signal B leads signal A, count the falling edges of signal A.
DAQmx_Val_X2 Count the rising and falling edges of signal A.
DAQmx_Val_X4 Count the rising and falling edges of both signal A and signal B.
DAQmx_Val_TwoPulseCounting Increment the count on rising edges of signal A. Decrement the count on rising pulses of signal B.
ZidxEnable bool32 Specifies whether to enable z indexing for the measurement.
ZidxVal float64 The value, in units, to which to reset the measurement when signal Z is high and signal A and signal B are at the states you specify with ZidxPhase.
ZidxPhase int32 The states at which signal A and signal B must be while signal Z is high for NI-DAQmxBase to reset the measurement. If signal Z is never high while the signal A and signal B are high, for example, you must choose a phase other than DAQmx_Val_AHighBHigh.

When signal Z goes high and how long it stays high varies from encoder to encoder. Refer to the documentation for the encoder to determine the timing of signal Z with respect to signal A and signal B.
Value Description
DAQmx_Val_AHighBHigh Reset the measurement when both signal A and signal B are at high logic.
DAQmx_Val_AHighBLow Reset the measurement when signal A is at high logic and signal B is at low logic.
DAQmx_Val_ALowBHigh Reset the measurement when signal A is at low logic and signal B is at high logic.
DAQmx_Val_ALowBLow Reset the measurement when both signal A and signal B are at low logic.
units int32 The units to use to return angular position measurements from the channel.

Value Description
DAQmx_Val_Degrees Degrees
DAQmx_Val_Radians Radians
DAQmx_Val_Ticks Timebase ticks
DAQmx_Val_FromCustomScale Units a custom scale specifies. Use customScaleName to specify a custom scale.
pulsesPerRev uInt32 The number of pulses the encoder generates per revolution. This value is the number of pulses on one of either A signal or B signal, not the total number of pulses on both signal A and signal B.
initialAngle float64 The starting angle of the encoder when the measurement begins. Specify this value in units.
customScaleName const char [ ] Pass NULL for this parameter.

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.
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)