Supported platforms: CODESYS 2.3

 

CanApiFilterMaskSet

Description

This function enables the receiving of one CAN message to the software buffer.

Limitations

The IEC application should enable only CAN messages which are necessary. All message cause extra execution load to the system and because of this it is not reasonable to receive messages which are not necessary.

 

Do not disable the SDO server COB-ID for Codesys communication if it is used for defined CAN interface. This will disable CANopen based codesys communication to the module.

 

Before shared memory is visible/accessible in the IEC application there must be the function call CanApiSrvInit in the application. This function must always be executed succesfully before other CAN-API functions can be used. It is only necessary to call this function once.

Inputs

Input variable name

Data type

Range

Description

i_CanDrvNbr

BYTE

1,2,...

Number of the CAN interface.

Defined globals

i_Enable

BOOL

TRUE/FALSE

Enable/disabel defined COBID.

i_CobId

DWORD

 

Enabled COBID. Only 16 first bit are used for 29-bit messages. There is no possibility to define if the COBID is 11-bit or 29-bit.

Outputs

Output variable name

Data type

Range

Description

CanApifilterMaskSet

DINT

 

Status of the execution.

Error codes

Errors

Error code

IEC_ERROR_CANAPI_INVALID_INTERFACE_NBR

IEC_ERROR_CANAPI_INVALID_SHM_MEM

 

Example code

Definitions:

 

error:DINT;

Code:

 

error := CanApiFilterMaskSet(CANAPI_CAN1,TRUE,16#1234).             (*Enable messages which last 16-bit in COB-ID are 1234h *)

error := CanApiFilterMaskSet(CANAPI_CAN1,FALSE,16#4321).             (*Disable messages which last 16-bit in COB-ID are 4321h *)

 

EXP - file:

No exp files.

 

See also

 

Source file Topic000046.htm

Last updated 24-Apr-2025