This parameter is used to retrieve information about the currently used CAN bus speed for the data phase (bit rate switch), in bits per second. It can be used to display a friendly bit rate value in an application that can be easily and quickly understood by any user.
It is available since PCAN-Basic version 4.0.0.
This parameter can only be read. It cannot be modified.
This value has a resolution of Double-Word (range [0... MaxValue]).
Does not apply.
Get: The PCAN Channel must be initialized before using this parameter.
The following code shows how to retrieve the friendly data bit rate value from a USB Channel:
uint bitrate;
PcanChannel channelUsed = PcanChannel.Usb01;
if (Api.Initialize(channelUsed, (BitrateFD)BitrateFD.BitrateSaeJ2284_4) == PcanStatus.OK)
{
if (Api.GetValue(channelUsed, PcanParameter.BusSpeedFd, out bitrate) == PcanStatus.OK)
Console.WriteLine($"FD bit rate of channel {channelUsed} is {bitrate / 1000000.0} MB/s");
else
Console.WriteLine($"Error retrieving Bus Speed on channel {channelUsed}");
Api.Uninitialize(channelUsed);
}Dim bitrate As UInteger
Dim channelUsed As PcanChannel = PcanChannel.Usb01
If Api.Initialize(channelUsed, CType(BitrateFD.BitrateSaeJ2284_4, BitrateFD)) = PcanStatus.OK Then
If Api.GetValue(channelUsed, PcanParameter.BusSpeedFd, bitrate) = PcanStatus.OK Then
Console.WriteLine($"FD bit rate of channel {channelUsed} is {bitrate / 1000000.0} MB/s")
Else
Console.WriteLine($"Error retrieving Bus Speed on channel {channelUsed}")
End If
Api.Uninitialize(channelUsed)
End IfUInt32 bitrate;
PcanChannel channelUsed = PcanChannel::Usb01;
if (Api::Initialize(channelUsed, (BitrateFD^)BitrateFD::BitrateSaeJ2284_4) == PcanStatus::OK)
{
if (Api::GetValue(channelUsed, PcanParameter::BusSpeedFd, bitrate) == PcanStatus::OK)
Console::WriteLine("FD bit rate of channel {0} is {1} MB/s", channelUsed, bitrate / 1000000.0);
else
Console::WriteLine("Error retrieving Bus Speed on channel {0}", channelUsed);
Api::Uninitialize(channelUsed);
}