AnalogAssignment Property

Public Property AnalogAssignment(ByVal channel As Long) As Eth32AnalogChannel

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 7. Single-Ended Channels

ConstantValuePhysical Pin
ANALOG_SE0&H00Port 3, Bit 0
ANALOG_SE1&H01Port 3, Bit 1
ANALOG_SE2&H02Port 3, Bit 2
ANALOG_SE3&H03Port 3, Bit 3
ANALOG_SE4&H04Port 3, Bit 4
ANALOG_SE5&H05Port 3, Bit 5
ANALOG_SE6&H06Port 3, Bit 6
ANALOG_SE7&H07Port 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 8. Differential Channels

ConstantValuePositive InputNegative InputGain
ANALOG_DI00X10&H08Port 3, Bit 0Port 3, Bit 010x
ANALOG_DI10X10&H09Port 3, Bit 1Port 3, Bit 010x
ANALOG_DI00X200&H0APort 3, Bit 0Port 3, Bit 0200x
ANALOG_DI10X200&H0BPort 3, Bit 1Port 3, Bit 0200x
ANALOG_DI22X10&H0CPort 3, Bit 2Port 3, Bit 210x
ANALOG_DI32X10&H0DPort 3, Bit 3Port 3, Bit 210x
ANALOG_DI22X200&H0EPort 3, Bit 2Port 3, Bit 2200x
ANALOG_DI32X200&H0FPort 3, Bit 3Port 3, Bit 2200x
ANALOG_DI01X1&H10Port 3, Bit 0Port 3, Bit 11x
ANALOG_DI11X1&H11Port 3, Bit 1Port 3, Bit 11x
ANALOG_DI21X1&H12Port 3, Bit 2Port 3, Bit 11x
ANALOG_DI31X1&H13Port 3, Bit 3Port 3, Bit 11x
ANALOG_DI41X1&H14Port 3, Bit 4Port 3, Bit 11x
ANALOG_DI51X1&H15Port 3, Bit 5Port 3, Bit 11x
ANALOG_DI61X1&H16Port 3, Bit 6Port 3, Bit 11x
ANALOG_DI71X1&H17Port 3, Bit 7Port 3, Bit 11x
ANALOG_DI02X1&H18Port 3, Bit 0Port 3, Bit 21x
ANALOG_DI12X1&H19Port 3, Bit 1Port 3, Bit 21x
ANALOG_DI22X1&H1APort 3, Bit 2Port 3, Bit 21x
ANALOG_DI32X1&H1BPort 3, Bit 3Port 3, Bit 21x
ANALOG_DI42X1&H1CPort 3, Bit 4Port 3, Bit 21x
ANALOG_DI52X1&H1DPort 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 9. Calibration Reference Channels

ConstantValueDescription
ANALOG_122V&H1EInternal 1.22V Voltage Reference
ANALOG_0V&H1F0V (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
Private Sub example()
    
    ' Set up error handling for this routine
    On Error GoTo myerror
    
    Set dev = New Eth32
    
    ' .... Your code that establishes a connection here

    If dev.AnalogAssignment(0) = ANALOG_SE0 Then
        ' Logical channel 0 is configured for physical
        ' single-ended channel 0 (the default)
    End If
    
    ' Configure logical channel 7:  Assign it to the
    ' difference between bit 4 and bit 1 with 1X gain.
    dev.AnalogAssignment(7) = ANALOG_DI41X1

    
    Exit Sub
myerror:
    MsgBox "ETH32 error: " & dev.ErrorString(Err.Number)
End Sub
       
See Also

AnalogReference Property, AnalogState Property, InputAnalog Method