How is it possible to register a new Hardware (in my case the PCAN USB) in the C++ environment?
I´ve found a lot of useful functions like CAN_SetHwParam(), CAN_RegisterHardware() etc., but I have no idea how to create a 'Hardware Handle' corresponding to my PCAN USB. And without such a 'Hardware Handle' it is not possible for me to change any settings regarding the e.g. transmit queue. Are there any examples about this topic?
Best Regards
Register new Hardware in C++
Re: Register new Hardware in C++
Hello Flashmaster,
CAN_RegisterHardware() is used to register Not Plug&Play hardware (PCAN-ISA, PCAN-Dongle, etc), so you don't need that function when you are using an USB device.Flashmaster wrote:I´ve found a lot of useful functions like CAN_SetHwParam(), CAN_RegisterHardware() etc.,
It is highly recommended to read first the introduction chapter of the Canapi2 Documentation, so that you can understand how the PCAN-Environment works.Flashmaster wrote: but I have no idea how to create a 'Hardware Handle' corresponding to my PCAN USB
To achieve communication using an USB device you basically need to:Flashmaster wrote:How is it possible to register a new Hardware (in my case the PCAN USB) in the C++ environment?
- Register a PCAN-Net on the device you want to use (Using the Net-Config tool).
- Register a PCAN-Client using the function CAN_RegisterClient.
- Connect Client and Net together using the function CAN_ConnectToNet. At this point you are able to communicate using the USB device.
You get together with the API a group of sample projects, called "I CAN do It - Samples". These will help you starting to work with the API. Look for it in the installation directory of your PCAN-Developer package:Flashmaster wrote:Are there any examples about this topic?
- For point 1 above, use the sample project ICConfigureNets (Samples/Visual C++ (MFC)/Configure Nets) if you want to manage nets yourself (not using the Net Config tool).
- For point 2 above, use the sample project ICRegClients (Samples/Visual C++ (MFC)/Initialization).
- For point 3 above, use the sample project ICConnectNets (Samples/Visual C++ (MFC)/Connect To Nets).
Best regards,
Keneth
Keneth