6 can functions (only etcxm), Can functions (only etcxm), Plc programming – Lenze ETC Motion Control User Manual

Page 410

Advertising
background image

PLC programming

Library
CAN functions (only ETCxM)

8

8.8
8.8.6

l

410

EDSTCXN EN 2.0

8.8.6

CAN functions (only ETCxM)

8.8.6.1

DefineCanMsg (only ETCxM)

FUNCTION DefineCanMsg: DINT

VAR_INPUT

CanNum_w

: WORD;

(* Number of the CAN interface − 1 or 2 *)

WriteCobId_w

: WORD;

(* CobId: ETCxM

CAN node *)

ReadCobId_w

: WORD;

(* CobId: CAN node

ETCxM *)

QueueSize_w

: WORD;

(* Number of messages being buffered *)

END_VAR

Creating and initialising a structure for managing CAN transfers. This allows
to receive or send any CAN messages. When the function is called it checks
whether the stated CobId are not still in use. It is also possible for the CobId
to be entered into the control configuration of CoDeSys at a CANopen
module. ReadCobId_w or WriteCobId_w equals 0 means that no Cobld is
required yet.

The function returns a handle on the administrative structure. If it returns 0
no administrative structure could be created using the stated parameters.

handle_pr

: DINT;

handle_pr = DefineCanMsg(1, 1014, 1114, 32);

8.8.6.2

AddCobIdCanMsg (only ETCxM)

FUNCTION AddCobIdCanMsg: BOOL

VAR_INPUT

handle_pr

: DINT;

(* Handle on the management structure *)

CobId_w

: WORD;

(* CobId *)

Read_bit

: BOOL;

(* direction, TRUE for CAN nodes ETCxM *)

END_VAR

This function allows adding a CobId to the management structure (see
function DefineCanMsg()) for CAN transfers. The function returns TRUE if
the CobId has been entered successfully in the management structure. If the
Cobld is already in use or the maximum number (32) of possible Cobld has
been reached, it returns FALSE.

handle_pr

: DINT;

FctReturn_bit

: BOOL;

handle_pr = DefineCanMsg(1, 1014, 1114, 32);

FctReturn_bit = AddCobIdCanMsg(handle_pr, 1024, 1);

Declaration

Description

Example

Declaration

Description

Example

Advertising