IoDigitalClear

This parameter is used to configure the value of selected digital output Pins to “low” within a device, using a bit mask value. Unlike IoDigitalValue, only needed Pins are set to “low”; unwanted ones are not touched, i.e., they are not re-configured.

  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 the configuration of a maximum of 5 digital Pins. For this reason, all other (not used) bits are automatically discarded from the bit mask value.

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 is write-only. It can only be written.

Possible Values

This parameter has a resolution of a double-word (range [0...MaxValue]). It is a bit mask, in which every bit represents digital Pin. Bit0, the least significant bit, corresponds to Pin0; Bit1 corresponds to Pin1, and so on until Pin31.

Bit value

Description

0

The digital Pin at this position is ignored.

1

The value of the digital pin at this position is set to “low”.

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 set the value of digital outputs of a USB Channel to "low":

C#
PcanChannel channelUsed = PcanChannel.Usb01;

if (Api.Initialize(channelUsed, Bitrate.Pcan500) == PcanStatus.OK)
{
    uint pinMask = 0x1;
    if (Api.SetValue(channelUsed, PcanParameter.IoDigitalClear, pinMask) == PcanStatus.OK)
        Console.WriteLine($"Pin0 of {channelUsed} was successfully set to 'low'.");
    else
        Console.WriteLine($"Error configuring digital Pin states for {channelUsed}.");
    Api.Uninitialize(channelUsed);
}

See Also