NI-DAQmx .NET Framework 4.0 API Reference

Content Type
Programming Language
Current manual
Table of Contents
Product DocumentationNI-DAQmx .NET Framework 4.0 API Reference...CIChannelCollection MethodsCreateAngularEncoderChannel Method CIChannelCollection.CreateAngularEncoderChannel Method (String, String, CIEncoderDecodingType, Boolean, Double, CIEncoderZIndexPhase, Int32, Double, CIAngularEncoderUnits)Current page
Table of Contents

CIChannelCollection.CreateAngularEncoderChannel Method (String, String, CIEncoderDecodingType, Boolean, Double, CIEncoderZIndexPhase, Int32, Double, CIAngularEncoderUnits)

CIChannelCollection.CreateAngularEncoderChannel Method (String, String, CIEncoderDecodingType, Boolean, Double, CIEncoderZIndexPhase, Int32, Double, CIAngularEncoderUnits)

CIChannelCollectionCreateAngularEncoderChannel Method (String, String, CIEncoderDecodingType, Boolean, Double, CIEncoderZIndexPhase, Int32, Double, CIAngularEncoderUnits)

Creates a CIChannel that uses an angular encoder to measure angular position. This method adds one channel to the CIChannelCollection.

Namespace:  NationalInstruments.DAQmx
Assembly:  NationalInstruments.DAQmx (in NationalInstruments.DAQmx.dll) Version: 20.7.40.49302

Syntax

public CIChannel CreateAngularEncoderChannel(
	string counter,
	string nameToAssignChannel,
	CIEncoderDecodingType encoderDecodingType,
	bool zIndexEnable,
	double zIndexValue,
	CIEncoderZIndexPhase zIndexPhase,
	int pulsesPerRevolution,
	double initialAngle,
	CIAngularEncoderUnits units
)
Public Function CreateAngularEncoderChannel ( 
	counter As String,
	nameToAssignChannel As String,
	encoderDecodingType As CIEncoderDecodingType,
	zIndexEnable As Boolean,
	zIndexValue As Double,
	zIndexPhase As CIEncoderZIndexPhase,
	pulsesPerRevolution As Integer,
	initialAngle As Double,
	units As CIAngularEncoderUnits
) As CIChannel

Parameters

counter
Type: SystemString
The names of the counters to use to create the virtual channels. You can pass a string that contains a list or range of counters to this input.
nameToAssignChannel
Type: SystemString
The name to assign to the created channel. To use the physical channel name as the local virtual channel name, set this value to Empty.
encoderDecodingType
Type: NationalInstruments.DAQmxCIEncoderDecodingType
The count and interpretation of the pulses that the encoder generates on signal A and signal B. X1, X2, and X4 are valid for quadrature encoders only. TwoPulseCounting is valid only for two-pulse encoders.
zIndexEnable
Type: SystemBoolean
Whether to use z indexing for the channel.
zIndexValue
Type: SystemDouble
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 zIndexPhase.
zIndexPhase
Type: NationalInstruments.DAQmxCIEncoderZIndexPhase
The states that signal A and signal B must be at while signal Z is high for NI-DAQmx to reset the measurement. If the signal Z is never high while the signal A and signal B are high, for example, you must choose a phase other than AHighBHigh.
pulsesPerRevolution
Type: SystemInt32
The number of pulses that the encoder generates per revolution. This value is the number of pulses on one of either the A signal or the B signal, not the total number of pulses on both the A and B signals.
initialAngle
Type: SystemDouble
The starting angle of the encoder. This value is in the units that you specify in the units parameter.
units
Type: NationalInstruments.DAQmxCIAngularEncoderUnits
The units to use to return angular position measurements from the channel.

Return Value

Type: CIChannel
The newly created CIChannel.

Exceptions

ExceptionCondition
DaqExceptionThe NI-DAQmx driver returned an error.

Remarks

With the exception of devices that support multi-counter tasks, you can create only one CIChannel at a time with this function because a task can contain only one CIChannel. To read from multiple counters simultaneously, use a separate task for each counter.

This method creates a virtual channel for the physical channel name you specify.

If you do not provide a value for nameToAssignChannel, NI-DAQmx uses the counter as the local virtual channel name. If you use nameToAssignChannel to create a name for the local virtual channel, you must use this name in other properties and methods.

X2 and X4 decoding are more sensitive to smaller changes in position than X1 encoding, with X4 being the most sensitive. However, more sensitive decoding is more likely to produce erroneous measurements if vibration exists in the encoder or other noise exists in the signals.

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.

The NI-DAQmx driver does not determine if the requested settings are possible until the task is verified. This method does not throw an exception for parameter values that are not compatible with your hardware or other settings in your task. To determine if all of the settings for a Task are valid, you must verify the task by starting the task, either with Start or by reading from or writing to the task, or by calling Control(TaskAction) with Verify.

See Also

Was this information helpful?