AnalogAssignment Property

Eth32AnalogChannel AnalogAssignment[int channel] 

Summary

When this property is written, it assigns a logical analog channel to one of the physical channels. When it is read, it returns the current physical channel assignment for the specified logical channel. The logical channel assignment specifies which physical pins are used to determine the value of the analog reading when that logical channel is read or monitored for events. There are eight logical channels, each of which may be arbitrarily assigned to physical channels using this property.

Parameters

  • channel - The logical channel number (0-7).

Value

This property is a Eth32AnalogChannel value, which is an enumerator containing constants defining the possible channel assignments. The possible values of this enumerator are defined in the Remarks section below.

Remarks

The logical channels simply provide a way to select which of the many physical channel sources listed below will be continually updated for reading on the device and, if configured to do so, monitored for analog events.

The assignments given to the logical channels may be completely arbitrary. Also, it is permissible to have more than one logical analog channel assigned to the same physical channel source. This can occasionally be advantageous for event monitoring. Since there are two possible event definitions per logical channel, assigning more than one logical channel to the same physical channel allows more than two event definitions on that physical channel.

When the device is first powered up or the ResetDevice Method is called, the logical channel assignments revert to their defaults. Logical channel 0 is assigned to single-ended channel 0, logical channel 1 to single-ended channel 1 and so on.

The assignments made with this property are effective until they are either overwritten by setting the property again or the board is reset (hard reset or by calling the ResetDevice Method). There is no limitation on how often you may reassign logical channels.

The following constants are defined in the Eth32AnalogChannel enumerator. These are the valid physical channel sources to which a logical channel may be assigned. The constant definition should typically be used in your source code, but its hexadecimal value is shown for reference.

For single-ended channels, the reading comes from the voltage of the specified pin with respect to ground.

Table 4. Single-Ended Channels

ConstantValuePhysical Pin
Eth32AnalogChannel.SE00x00Port 3, Bit 0
Eth32AnalogChannel.SE10x01Port 3, Bit 1
Eth32AnalogChannel.SE20x02Port 3, Bit 2
Eth32AnalogChannel.SE30x03Port 3, Bit 3
Eth32AnalogChannel.SE40x04Port 3, Bit 4
Eth32AnalogChannel.SE50x05Port 3, Bit 5
Eth32AnalogChannel.SE60x06Port 3, Bit 6
Eth32AnalogChannel.SE70x07Port 3, Bit 7

For differential channels, the reading comes from the voltage difference between two pins. It is permissible for either to be positive or negative with respect to the other. They are simply labeled positive and negative inputs to specify how the reading is determined. Please note that the voltage on each pin must still remain within the range of 0 to 5V with respect to the ground of the device.

Table 5. Differential Channels

ConstantValuePositive InputNegative InputGain
Eth32AnalogChannel.DI00X100x08Port 3, Bit 0Port 3, Bit 010x
Eth32AnalogChannel.DI10X100x09Port 3, Bit 1Port 3, Bit 010x
Eth32AnalogChannel.DI00X2000x0APort 3, Bit 0Port 3, Bit 0200x
Eth32AnalogChannel.DI10X2000x0BPort 3, Bit 1Port 3, Bit 0200x
Eth32AnalogChannel.DI22X100x0CPort 3, Bit 2Port 3, Bit 210x
Eth32AnalogChannel.DI32X100x0DPort 3, Bit 3Port 3, Bit 210x
Eth32AnalogChannel.DI22X2000x0EPort 3, Bit 2Port 3, Bit 2200x
Eth32AnalogChannel.DI32X2000x0FPort 3, Bit 3Port 3, Bit 2200x
Eth32AnalogChannel.DI01X10x10Port 3, Bit 0Port 3, Bit 11x
Eth32AnalogChannel.DI11X10x11Port 3, Bit 1Port 3, Bit 11x
Eth32AnalogChannel.DI21X10x12Port 3, Bit 2Port 3, Bit 11x
Eth32AnalogChannel.DI31X10x13Port 3, Bit 3Port 3, Bit 11x
Eth32AnalogChannel.DI41X10x14Port 3, Bit 4Port 3, Bit 11x
Eth32AnalogChannel.DI51X10x15Port 3, Bit 5Port 3, Bit 11x
Eth32AnalogChannel.DI61X10x16Port 3, Bit 6Port 3, Bit 11x
Eth32AnalogChannel.DI71X10x17Port 3, Bit 7Port 3, Bit 11x
Eth32AnalogChannel.DI02X10x18Port 3, Bit 0Port 3, Bit 21x
Eth32AnalogChannel.DI12X10x19Port 3, Bit 1Port 3, Bit 21x
Eth32AnalogChannel.DI22X10x1APort 3, Bit 2Port 3, Bit 21x
Eth32AnalogChannel.DI32X10x1BPort 3, Bit 3Port 3, Bit 21x
Eth32AnalogChannel.DI42X10x1CPort 3, Bit 4Port 3, Bit 21x
Eth32AnalogChannel.DI52X10x1DPort 3, Bit 5Port 3, Bit 21x

Note that the entries above which show both the positive side and negative side with the same input pin can be used for calibration of the differential amplifier. Any nonzero reading from those indicates an offset error within the differential amplifier which you can subtract out of other channels that share the same negative input and gain.

Table 6. Calibration Reference Channels

ConstantValueDescription
Eth32AnalogChannel.R122V0x1EInternal 1.22V Voltage Reference
Eth32AnalogChannel.R0V0x1F0V (Ground)

The above two entries connect a logical channel to internal chip voltages. They can be used as calibration points to determine errors within the analog conversions.

Example
Eth32 dev = new Eth32();

try
{
	// .... Your code that establishes a connection here
	
	
	if(dev.AnalogAssignment[0]==Eth32AnalogChannel.SE0)
	{
		// Logical channel 0 is configured for physical 
		// single-ended channel 0 (the default)
	}
	
	// Configure logical channel 7:  Assign it to the 
	// difference between bit 4 and bit 1 with 1X gain.
	dev.AnalogAssignment[7]=Eth32AnalogChannel.DI41X1;
}
catch (Eth32Exception e)
{
	// Handle Eth32 errors here
}
       
See Also

AnalogReference Property, AnalogState Property, InputAnalog Method