Caution
An internal hardware reset is carried out when the acceptance filter is modified. If other application is using the same device, its communication could be affected in some scenarios.
This parameter causes a modification of the acceptance filter of the CAN chip of a PCAN Channel, thus allowing it to receive messages or not. It can be used for switching the acceptance of messages temporarily, for example, to avoid receiving messages during a defined amount of time.
It is available since PCAN-Basic version 1.0.0.
This parameter is read/write. It can be configured and retrieved.
This parameter accepts values of type ParameterValueFilter. In a setting operation, this parameter can be opened or closed. In a get operation, a value indicating that the filter was customized can also be retrieved.
The default state of the filter is to receive all messages (Open). A PCAN Channel starts receiving messages immediately after it is initialized.
Get: The PCAN Channel must be initialized before using this parameter.
Set: The PCAN Channel must be initialized before using this parameter.
The following code shows how to close the acceptance filter of a USB Channel:
PcanChannel channelUsed = PcanChannel.Usb01;
if (Api.Initialize(channelUsed, Bitrate.Pcan500) == PcanStatus.OK)
{
if (Api.SetValue(channelUsed, PcanParameter.MessageFilter, ParameterValue.Filter.Close) == PcanStatus.OK)
Console.WriteLine($"The acceptance filter of {channelUsed} was successfully closed.");
else
Console.WriteLine($"Error configuring the acceptance filter 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.MessageFilter, ParameterValue.Filter.Close) = PcanStatus.OK Then
Console.WriteLine($"The acceptance filter of {channelUsed} was successfully closed.")
Else
Console.WriteLine($"Error configuring the acceptance filter 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::MessageFilter, ParameterValue::Filter::Close) == PcanStatus::OK)
Console::WriteLine("The acceptance filter of {0} was successfully closed.", channelUsed);
else
Console::WriteLine("Error configuring the acceptance filter on channel {0}.", channelUsed);
Api::Uninitialize(channelUsed);
}