IoDigitalSet
This parameter is used to configure the value of selected digital output Pins to “high” within a device, using a bit mask value. Unlike
IoDigitalValue, only needed Pins are set to “high”; unwanted ones are
not touched, i.e., they are not re-configured.
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.
It is available since PCAN-Basic version 4.3.0.
This parameter is write-only. It can only be written.
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 “high”.
|
Set: The PCAN Channel must be initialized before using this parameter.
The following code shows how to set the value of digital outputs of a USB Channel to "high":
PcanChannel channelUsed = PcanChannel.Usb01;
if (Api.Initialize(channelUsed, Bitrate.Pcan500) == PcanStatus.OK)
{
uint pinMask = 0x4;
if (Api.SetValue(channelUsed, PcanParameter.IoDigitalSet, pinMask) == PcanStatus.OK)
Console.WriteLine($"Pin2 of {channelUsed} was successfully set to 'high'.");
else
Console.WriteLine($"Error configuring digital Pin states for {channelUsed}.");
Api.Uninitialize(channelUsed);
}
Dim channelUsed As PcanChannel = PcanChannel.Usb01
If Api.Initialize(channelUsed, Bitrate.Pcan500) = PcanStatus.OK Then
Dim pinMask As UInteger = &H4
If Api.SetValue(channelUsed, PcanParameter.IoDigitalSet, pinMask) = PcanStatus.OK Then
Console.WriteLine($"Pin2 of {channelUsed} was successfully set to 'high'.")
Else
Console.WriteLine($"Error configuring digital Pin states for {channelUsed}.")
End If
Api.Uninitialize(channelUsed)
End If
PcanChannel channelUsed = PcanChannel::Usb01;
if (Api::Initialize(channelUsed, Bitrate::Pcan500) == PcanStatus::OK)
{
UInt32 pinMask = 0x4;
if (Api::SetValue(channelUsed, PcanParameter::IoDigitalSet, pinMask) == PcanStatus::OK)
Console::WriteLine("Pin2 of {0} was successfully set to 'high'.", channelUsed);
else
Console::WriteLine("Error configuring digital Pin states for {0}.", channelUsed);
Api::Uninitialize(channelUsed);
}