This parameter is used to retrieve information about the currently used CAN bus speed for the XL phase (extended data-field length), 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 5.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 speed;
PcanChannel channelUsed = PcanChannel.Usb01;
BitrateXL bitrateXl = (BitrateXL)("f_clock=160000000, brp=1, nom_tseg1=255, nom_tseg2=64, nom_sjw=64, fd_tseg1=63, fd_tseg2=16, fd_sjw=16, fd_ssp_offset=0, xl_tseg1=10, xl_tseg2=9, xl_sjw=9, xl_ssp_offset=10, xl_error_signaling=1, xl_transceiver_mode_switch=0");
if (Api.Initialize(channelUsed, bitrateXl) == PcanStatus.OK)
{
if (Api.GetValue(channelUsed, PcanParameter.BusSpeedXl, out speed) == PcanStatus.OK)
Console.WriteLine($"XL bit rate of channel {channelUsed} is {speed / 1000000.0} MB/s");
else
Console.WriteLine($"Error retrieving Bus Speed on channel {channelUsed}");
Api.Uninitialize(channelUsed);
}Dim speed As UInteger
Dim channelUsed As PcanChannel = PcanChannel.Usb01
Dim bitrateXl As BitrateXL = CType("f_clock=160000000, brp=1, nom_tseg1=255, nom_tseg2=64, nom_sjw=64, fd_tseg1=63, fd_tseg2=16, fd_sjw=16, fd_ssp_offset=0, xl_tseg1=10, xl_tseg2=9, xl_sjw=9, xl_ssp_offset=10, xl_error_signaling=1, xl_transceiver_mode_switch=0", BitrateXL)
If Api.Initialize(channelUsed, bitrateXl) = PcanStatus.OK Then
If Api.GetValue(channelUsed, PcanParameter.BusSpeedXl, speed) = PcanStatus.OK Then
Console.WriteLine($"XL bit rate of channel {channelUsed} is {speed / 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;
BitrateXL^ bitrateXl = (BitrateXL^)("f_clock=160000000, brp=1, nom_tseg1=255, nom_tseg2=64, nom_sjw=64, fd_tseg1=63, fd_tseg2=16, fd_sjw=16, fd_ssp_offset=0, xl_tseg1=10, xl_tseg2=9, xl_sjw=9, xl_ssp_offset=10, xl_error_signaling=1, xl_transceiver_mode_switch=0");
if (Api::Initialize(channelUsed,bitrateXl) == PcanStatus::OK)
{
if (Api::GetValue(channelUsed, PcanParameter::BusSpeedXl, bitrate) == PcanStatus::OK)
Console::WriteLine("XL 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);
}