DriverOpenH (FUN)

FUNCTION DriverOpenH : CAA.HANDLE

Opens a CAN interface and allocates memory from heap. 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. The function can be called several times on the same interface, so that multiple parts of a program can work on it. You can set uiBaudrate to 0 if the interface is already opened or if the default baudrate from configuration file should be used. See following section in configuration file:

[CmpCAACanL2]
;If setting PersistentBaudrate is enabled (0: disabled; 1: enabled)
;the baudrate will be stored into Net.X.DefaultBaudrate (where X equals NetId) when opening the driver.
PersistentBaudrate=1
;Default baudrate for CAN network 0. This baudrate will be used when the network is opened (e.g from CmpBlkDrvCan or CANopen) with the baudrate set to 0.
;Net.0.DefaultBaudrate=1000
Net.0.DefaultBaudrate=1000
InOut:

Scope

Name

Type

Comment

Return

DriverOpenH

CAA.HANDLE

handle of CAN interface or CAA.gc_hINVALID if failed.

Input

usiNetId

USINT

number of CAN interface [0..n]

uiBaudrate

UINT

Baudrate in kBit/s e.g. 1000 for 1 Mbit

xSupport29Bits

BOOL

FALSE: only 11-Bit IDs, TRUE: support also 29-Bit

ctMessages

CAA.COUNT

number of transmit messages which should be allocated

peError

POINTER TO ERROR

optional pointer to error enum