Caution
Not all USB devices support this parameter.
This parameter is used for switching the external 5V on the D-Sub connector of a device. This is useful when connecting external bus converter modules to a card (AU5790 / TJA1054)), so that it is also supplied with power.
Available since PCAN-Basic version 1.0.0.
It can be read without initialization since PCAN-Basic version 4.4.0.
This parameter is read/write. It can be configured and retrieved.
This parameter represents an extra voltage that can be activated or deactivated. Accepts values of type ParameterValueActivation.
The default state of this extra voltage is Off. After switching it On, the extra 5V stays on the D-Sub until it is expressly deactivated, or the device is reinitialized (unplugged and plugged in again, or PC reboot).
Get: It can be read on initialized or uninitialized PCAN Channels.
Set: It can be set on initialized PCAN Channels only.
The following code shows how to activate the extra 5V power of a USB Channel:
PcanChannel channelUsed = PcanChannel.Usb01;
if (Api.Initialize(channelUsed, Bitrate.Pcan500) == PcanStatus.OK)
{
if (Api.SetValue(channelUsed, PcanParameter.Power5Volts, ParameterValue.Activation.On) == PcanStatus.OK)
Console.WriteLine($"5V power of {channelUsed} successfully activated.");
else
Console.WriteLine($"Error configuring 5V power on channel {channelUsed}.");
Api.Uninitialize(channelUsed);
}Dim channelUsed As PcanChannel = PcanChannel.Usb01
If Api.Initialize(channelUsed, Bitrate.Pcan500) = PcanStatus.OK Then
If Api.SetValue(channelUsed, PcanParameter.Power5Volts, ParameterValue.Activation.On) = PcanStatus.OK Then
Console.WriteLine($"5V power of {channelUsed} successfully activated.")
Else
Console.WriteLine($"Error configuring 5V power on channel {channelUsed}.")
End If
Api.Uninitialize(channelUsed)
End IfPcanChannel channelUsed = PcanChannel::Usb01;
if (Api::Initialize(channelUsed, Bitrate::Pcan500) == PcanStatus::OK)
{
if (Api::SetValue(channelUsed, PcanParameter::Power5Volts, ParameterValue::Activation::On) == PcanStatus::OK)
Console::WriteLine("5V power of {0} successfully activated.", channelUsed);
else
Console::WriteLine("Error configuring 5V power on channel {0}.", channelUsed);
Api::Uninitialize(channelUsed);
}