Supported platforms: CODESYS 2.3, CODESYS 3.5

 

CANopen library's description

This library contains CANopen PLCopen functions.

 

For CODESYS 3.5 library this topic applies only for 3.X.X.X versions.

For CANopen V4 see new topics.

 

The application calls the CANopen library which uses the CANVXD library to send and receive CAN messages. The CANVXD library communicates with the CANDrv(HW) library which controls the physical interface of the CAN bus.

 

The application then calls protocol initializations according to the following table. The needed protocol init and update functions are listed in the table's columns. The ProtocolData column shows the data storage used by each protocol (struct table). CANopenUpdateDevices updates each protocol and internally calls the update function of each protocol that has been used.

 

ProtocolType

POU

CALLParam

ProtocolData

Update

Init

OD

-

-

CANopenOD

-

-

NMT slave

CANopenNMTCLIENT

DeviceAddress

CANopenNMT

CANopenNMTCLIENT.Update

CANopenNMTCLIENT.Init

NMT master

-

-

-

-

-

EMCY producer

-

-

CANopenEMCYProtocol

CANopenEMCYs.Update

CANopenEMCYs.Init

SDO server

CANopenSDOSERVER

DeviceAddress

CANopenSSDO

CANopenSDOSERVER.Update

CANopenSDOSERVER.Init

SDO client

-

-

-

-

-

RPDO

CANopenPDO

CANopenPDO

CANopenDefPDO

CANopenPDORead

-

TPDO

-

-

CANopenDefPDO

CANopenPDOSend

-

SYNC consumer

CANopenSYNCProtocol

DeviceAddress

CANopenSYNC

-

CANopenSYNCProtocol.Init

HB producer

-

-

-

-

-

HB consumer

CANopenHBConsumer.RCVState

CANopenHeartBeat

CANopenHeartBeatConsumer

CANopenHBConsumer.Update

CANopenHBConsumer.Init

DevErrors

-

-

-

-

-

IndexSave

-

-

-

-

-

NodeGuard

-

-

-

-

-

Note: Grey colored protocols are not implemented in CANopen library.

 

Common functions

POU

Description

CANopenDeviceAddProtocol (FUN)

Adds Protocol to device.

CANopenGetProtocolData (FUN)

Returns pointer to required protocol data.

CANopenInitDevices (FUN)

Calls all devices protocols initialization POUs.

CANopenSystemAddDevice (FUN)

Adds Device to system.

CANopenUpdateDevices (FUN)

Calls all devices protocols update POUs.

 

OD specific functions

POU

Description

CANopenODAddLine (FUN)

Adds or updates a line in Object Dictionary.

CANopenODAddTypedef1to9 (FUN)

Adds type definition indexes 1-9 to given OD.

CANopenODGetData (FB)

Gets pointer to subindex of given OD line.

CANopenODGetIndexDataSize (FUN)

Returns index data size in bytes.

CANopenODGetIndexInstPtr (FUN)

Returns pointer to OD entry of given OD index.

CANopenODGetLine (FUN)

Returns line number of requested index in given OD if found.

CANopenODReOrg (FUN)

Order Object Dictionary by ascending index.

 

 

EMCY specific functions

POU

Description

CANopenEMCYActivate (FUN)

Adds given EMCY object from list of active EMCYs.

CANopenEMCYDeactivate (FUN)

Removes given EMCY object from list of active EMCYs.

CANopenEMCYs

EMCY protocol handler. Includes actions (CODESYS 2.3) or methods (CODESYS 3.5) for EMCY protocol communication.

 

 

PDO specific functions

POU

Description

CANopenPDO (FB)

PDO protocol handler. Includes actions (CODESYS 2.3) or methods (CODESYS 3.5) for PDO protocol communication.

CANopenRPDO (FB) (CODESYS 3.5)

Handler for received PDOs.

CANopenTPDO (FB) (CODESYS 3.5)

Handler for PDO transmission.

 

 

SYNC specific functions

POU

Description

CANopenSYNCProtocol

SYNC protocol handler. Includes actions (CODESYS 2.3) or methods (CODESYS 3.5) for SYNC protocol communication.

 

 

SDO specific functions

POU

Description

CANopenSDOSERVER

SDO protocol server. The function block handles incoming SDO client messages.

 

 

NMT specific functions

POU

Description

CANopenNMTCLIENT

NMT protocol handler. Includes actions (CODESYS 2.3) or methods (CODESYS 3.5) for NMT protocol communication.

 

 

HB consumer specific functions

POU

Description

CANopenConsumeHB (FUN)

Adds HeartBeat to list of consumed HBs.

CANopenHBConsumer

HeartBeat protocol handler. Includes actions (CODESYS 2.3) or methods (CODESYS 3.5) for HB protocol communication.

CANopenHeartBeat (FB) (CODESYS 2.3) /

CANopenHeartBeatProducer (FB) (CODESYS 3.5)

HeartBeat message handler. Includes actions (CODESYS 2.3) or methods (CODESYS 3.5) for HB message receiving.

 

 

Dependencies

 

Source file Topic000216.htm

Last updated 13-Jun-2024