Page 1 of 1

Register new Hardware in C++

Posted: Mon 4. Feb 2013, 15:16
by Flashmaster
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

Re: Register new Hardware in C++

Posted: Tue 19. Feb 2013, 08:58
by K.Wagner
Hello Flashmaster,
Flashmaster wrote:I´ve found a lot of useful functions like CAN_SetHwParam(), CAN_RegisterHardware() etc.,
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: but I have no idea how to create a 'Hardware Handle' corresponding to my PCAN USB
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:How is it possible to register a new Hardware (in my case the PCAN USB) in the C++ environment?
To achieve communication using an USB device you basically need to:
  1. Register a PCAN-Net on the device you want to use (Using the Net-Config tool).
  2. Register a PCAN-Client using the function CAN_RegisterClient.
  3. Connect Client and Net together using the function CAN_ConnectToNet. At this point you are able to communicate using the USB device.
Flashmaster wrote:Are there any examples about this topic?
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:
  • 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).