Principle Description Of The Api - Peak PCAN-USB Pro FD User Manual

Table of Contents

Advertisement

6.2 Principle Description of the API

The sequence of accessing the CAN interface is divided into three phases:
Initialization
A CAN channel must be initialized before using it. This is done by the simple call of
the function CAN_Initialize for CAN and CAN_InitializeFD for CAN FD.
Depending on the type of the CAN hardware, up to 16 CAN channels can be opened
at the same time. After a successful initialization the CAN channel is ready. No
further configuration steps are required.
Interaction
For receiving and transmitting messages the functions CAN_Read and CAN_
Write as well as CAN_ReadFD and CAN_WriteFD are available depending on
the initialization mode. Additional settings can be made, such as setting up
message filters to confine to specific CAN IDs or setting the CAN controller to
Listen-only mode.
When receiving CAN messages, events are used for an automatic notification of an
application (client). This offers the following advantages:
The application no longer needs to check for received messages periodically
(no polling).
The response time at reception is reduced.
Completion
To end the communication the function CAN_Uninitialize is called in order to
release the reserved resources for the CAN channel, among others. In addition the
CAN channel is marked as "Free" and is available to other applications.
6   API PCAN-Basic
PCAN-USB Pro FD
User Manual 2.0.0
© 2023 PEAK-System Technik GmbH
32

Advertisement

Table of Contents
loading

Table of Contents