Peak.PCANBasic.NET 4.9.0.942

Prefix Reserved
dotnet add package Peak.PCANBasic.NET --version 4.9.0.942                
NuGet\Install-Package Peak.PCANBasic.NET -Version 4.9.0.942                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Peak.PCANBasic.NET" Version="4.9.0.942" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Peak.PCANBasic.NET --version 4.9.0.942                
#r "nuget: Peak.PCANBasic.NET, 4.9.0.942"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Peak.PCANBasic.NET as a Cake Addin
#addin nuget:?package=Peak.PCANBasic.NET&version=4.9.0.942

// Install Peak.PCANBasic.NET as a Cake Tool
#tool nuget:?package=Peak.PCANBasic.NET&version=4.9.0.942                

PCAN-Basic.NET Assembly

PCAN-Basic.NET is an interface for accessing and using the native PCAN-Basic API in .NET applications. The assembly is written using .NET Standard 2.0 which makes it suitable for developing under Windows and Linux.

The underlying native library (PCANBasic.dll on Windows and libpcanbasic.so on Linux), is used to do CAN communication through plug-and-play devices from PEAK-System Technik GmbH like PCAN-USB FD, and PCAN-PCI Express, among others.

Note: the native library files are not part of the PCAN-Basic.NET package. See next block for installation instructions.

Documentation

For full online API documentation see docs.peak-system.com/API/PCAN-Basic.Net. Alternatively, the documentation is available as a CHM file. It can be found within the "NuGet" folder of the PCAN-Basic package, and can also be downloaded directly using this link.

Getting Started

Windows:

For using PCAN-Basic.NET you need:

  1. to have the Windows device drivers installed, by using the PEAK-Drivers Setup,
  2. to have any plug-and-play device of the PCAN series attached to your PC, and
  3. to have the PCAN-Basic API installed, by using the PEAK-Drivers Setup (recommended). Alternatively, you can download a package containing all needed files and setting instructions.

PCAN-Gateway devices: If you want to communicate to PCAN-Gateways devices using PCAN-Basic, then you need to additionally install the feature "Virtual PCAN-Gateway" within the PEAK-Drivers Setup. Note that this is only supported on Windows systems.

For Linux:

For using PCAN-Basic.NET you need:

  1. to have the character-based Linux driver (chardev) installed, by compiling the source code yourself. Instructions are found in the PEAK-System Linux site.
  2. to have any plug-and-play device of the PCAN series attached to your PC, and
  3. to have the PCAN-Basic API installed, by downloading and compiling the source files. See instructions in the readme.txt file enclosed in the package.

Usage

Reference the following namespace from the file where you want to use PCAN-Basic functionality:

C#:

    using Peak.Can.Basic;

VB:

    Imports Peak.Can.Basic

C++/CLI:

    using namespace Peak::Can::Basic;

The namespace contains type enumerations, structures and classes for PCAN-Basic API accessing. Use the class Api to access API methods and constants:

C#:

PcanStatus result; 
result = Api.Initialize(PcanChannel.Usb01, Bitrate.Pcan500);

VB:

Dim result As PcanStatus
result = Api.Initialize(PcanChannel.Usb01, Bitrate.Pcan500)

C++/CLI:

using namespace Peak::Can::Basic;
result = Api::Initialize(channelUsed, Bitrate::Pcan500);

Use the class Worker for event driven reading and writing

C#:

Worker myWorker = new Worker();
PcanMessage message = new PcanMessage(0x100, MessageType.Standard, 3, new byte[] { 1, 2, 3 }, false);
Broadcast broadcast = new Broadcast(message, 100);

myWorker.MessageAvailable += OnMessageAvailable;
if (myWorker.AddBroadcast(ref broadcast))
    Console.WriteLine($"Broadcast {broadcast.Index}' configured successfully.");

myWorker.Start();
Console.WriteLine("The Worker was activated successfully.");    

VB:

Dim myWorker As Worker = New Worker()
Dim message As PcanMessage = New PcanMessage(&H100, MessageType.Standard, 3, New Byte() {1, 2, 3}, False)
Dim broadcast As Broadcast = New Broadcast(message, 100)

AddHandler myWorker.MessageAvailable, AddressOf OnMessageAvailable    
If myWorker.AddBroadcast(broadcast) Then
    Console.WriteLine($"Broadcast '{broadcast.Index}' configured successfully.")        
End If

myWorker.Start()
Console.WriteLine("The Worker object was activated successfully.")

C++/CLI:

Worker^ myWorker = gcnew Worker();
PcanMessage^ message = gcnew PcanMessage(0x100, MessageType::Standard, 3, gcnew array<Byte> { 1, 2, 3 }, false);
Broadcast^ broadcast = gcnew Broadcast(message, 100); 

myWorker->MessageAvailable += gcnew System::EventHandler(&OnMessageAvailable);    
if (myWorker->AddBroadcast(broadcast))
    Console::WriteLine("Broadcast '{0}' configured successfully.", broadcast->Index); 

myWorker->Start(false, false, false);
Console::WriteLine("The Worker object was activated successfully.");   

Need Support?

If you need further information or help, you can contact us using the following channels:

PEAK-System team

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.9.0.942 2,245 4/24/2024
4.8.2.897 1,959 1/22/2024
4.8.1.872 238 12/15/2023
4.8.0.830 1,731 10/5/2023
4.7.1.818 6,789 7/12/2023
4.7.0.793 4,994 3/7/2023
4.6.2.753 3,225 10/25/2022