Introduction to PCAN Basic API

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
braden
Posts: 4
Joined: Wed 15. Jul 2020, 16:35

Introduction to PCAN Basic API

Post by braden » Wed 15. Jul 2020, 16:47

Hi,

I'm just getting started using PCAN-Basic, which will be used for CAN communication to our custom motor control board. My goal is to have a simple UI where I can set speed (RPM), en/disable the system, and read data like current, voltage, and temperature.

At this point I need some guidance about how to use the API. I see the PCANBasicExample application, which I can run. I also see many folders in "Samples" which I assume are the source code for this example application. I want to work in C++, and there are 3 folders (C++_Builder, C++_CLR, C++_MFC). I can see differences in their contents, but I'm not entirely sure how they come together to form the project. I also don't understand how the application is built and what files it relies on. I've never worked with an API like this before, so I'd appreciate any sort of help.

How is the example project structured? Where can I edit the UI, and where can I edit the CAN-facing code?

Thanks

K.Wagner
Software Development
Software Development
Posts: 767
Joined: Wed 22. Sep 2010, 13:36

Re: Introduction to PCAN Basic API

Post by K.Wagner » Thu 16. Jul 2020, 08:46

Hello,
braden wrote:
Wed 15. Jul 2020, 16:47
I also see many folders in "Samples" which I assume are the source code for this example application.
You have "several" sample projects, one per folder. Each of them is using a different programming language and/or a specific develop environment.
braden wrote:
Wed 15. Jul 2020, 16:47
I want to work in C++, and there are 3 folders (C++_Builder, C++_CLR, C++_MFC). I can see differences in their contents, but I'm not entirely sure how they come together to form the project.
Their content is of course different, since they are different projects, using different programming environments
  • C++_Builder: C++ Builder IDE (Embarcadero, Borland, CodeGear)
  • C++_MFC: Visual Studio C++ MFC (Microsoft Foundation Classes)
  • C++_CLR: Visual Studio Managed C++ (Microsoft .NET Environment)
braden wrote:
Wed 15. Jul 2020, 16:47
I also don't understand how the application is built and what files it relies on.
Just load the project of interest and you see that
braden wrote:
Wed 15. Jul 2020, 16:47
I also don't understand how the application is built and what files it relies on. I've never worked with an API like this before, so I'd appreciate any sort of help.
Are you ever used an API on Windows? This API is to be used like any other standard library, i.e. loading a DLL. For this you need a header file (PCANBasic.h), a library (PCANBasic.dll) and in some cases a lib file (PCANBasic.lib). All these are included in the PCAN-Basic package. Please note that we are talking here from very basic programming techniques on windows for using APIs. You get more information about dynamic link libraries (DLL) in the microsoft website: Dynamic-Link-Libraries
Best regards,
Keneth

Post Reply