IoAnalogValue

This parameter is used for reading analog voltages from the analog input Pin of a device.

  Note

At the time of writing this documentation only PCAN-Chip USB based devices, with a firmware version equal to or greater than 3.3.0, support only 1 analog pin.

No error is generated by setting a bit for a nonexistent Pin.

Availability

It is available since PCAN-Basic version 4.3.0.

Supported By

Access Mode

This parameter can only be retrieved. It cannot be modified.

Possible Values

This parameter has a resolution of a double-word (range [0...MaxValue]). The returned value represents the direct value from the A/D converter, which is an unsigned integer value.

The returned value must be converted into a signed value, considering the external wiring.

Default Value

Does not apply.

Initialization Status

Set: The PCAN Channel must be initialized before using this parameter.

Example

The following code shows how to retrieve the value of the analog Pin of a USB Channel:

C#
PcanChannel channelUsed = PcanChannel.Usb01;

if (Api.Initialize(channelUsed, Bitrate.Pcan500) == PcanStatus.OK)
{
    uint rawValue;
    if (Api.GetValue(channelUsed, PcanParameter.IoAnalogValue, out rawValue) == PcanStatus.OK)
        Console.WriteLine($"The raw value of the analog Pin of {channelUsed} is {rawValue}.");
    else
        Console.WriteLine($"Error retrieving the analog Pin value from {channelUsed}.");
    Api.Uninitialize(channelUsed);
}

See Also