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?
You have "several" sample projects, one per folder. Each of them is using a different programming language and/or a specific develop environment.
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)
Just load the project of interest and you see that
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