CL2.DriverOpenH* (FUN)

 

This function of the CAA_CanL2.library opens a CAN interface for subsequent access. Successful operation returns a handle on the CAN interface.

Not every hardware supports each baud rate. If a baud rate is not supported or if the interface cannot be opened due to different reasons, the function returns “CAA.gc_hINVALID”.

In this case the memory is allocated from the heap.

The function can be called several times on the same interface, so that multiple parts of a program can work on it. Upon the first call the baud rate must be set to a value greater than zero. In all subsequent calls the baud rate cannot be changed and must be passed with the value zero.

Depending on the implementation, it is possible to use other baud rates than the standard rates mentioned below, for example 333 kbit.

Input:

usiNetId

USINT

number of the interface

uiBaudrate

UINT

>0: First opening of interface. Possible values for baud rate [kbit/s]: 10, 20, 50, 100, 125, 250, 500, 800 or 1000.

0: Open interface for further client with same baud rate

xSupport29BitIds*

BOOL

FALSE: 11 Bit-Ids only; TRUE: 29 Bit-Ids also supported

ctMessages

CAA.COUNT

number of messages for which memory must be allocated

peError

POINTER TO CL2.ERROR

pointer to error code (enumeration type)

Output:

hDriver

CAA.HANDLE

handle of CAN interface