Lenze PLC Designer PLC Designer (R2-x) CANopen for Runtime Systems User Manual
Page 13

L-force | PLC Designer - CANopen for Runtime Systems
CANopen-Master library
12
DMS 2.0 EN 05/2009 TD29
The configuration data are stored in the following arrays:
VAR_GLOBAL
pCANopenMaster : ARRAY[0..MAX_MASTERINDEX] OF CanOpenMaster;
pCanOpenNode : ARRAY[0..MAX_NODEINDEX] OF CanOpenNode;
pCanOpenSDO : ARRAY[0..MAX_SDOINDEX] OF CanOpenSDO;
pCanOpenPDO_Rx : ARRAY[0..MAX_PDOINDEX_RX] OF CanOpenPDO_Rx;
pCanOpenPDO_Tx : ARRAY[0..MAX_PDOINDEX_TX] OF CanOpenPDO_Tx;
ODMEntries:
ARRAY[0..MAX_MASTER_ODENTRY_IDX] OF CanOpenODEntry;
END_VAR
Thereby the function block member variables are used as follows: (pure internal variables, declared in
the VAR-sections, should not be written by the application; however some of them are of interest for
diagnosis purposes.)
VAR_INPUT
nStatus : INT;
(* Current status of the master. This status has nothing to do with the
states defined according to CANopen. It is an own, internal definition.
*)
bMsgUsed: BOOL;
(* Can be used by the application in order to detect that a new SDO-
Client request has been processed. Subsequently e.g. the object
dictionary of the master can be inspected for changes or can be re-
evaluated. (Only valid if the appropriate entries in the »PLC Designer«
*.cfg-file effect that the master has an object dictionary. Otherwise
without any meaning.)*)
nRxIndex : INT;
(* Historically, in order to avoid compile errors in old projects; not
used.*)
wDrvNr : WORD;
(* Needed for the configuration: Number of the CAN controller, given
from the library to the CAN driver in order to inform the driver on which
controller the write and read requests refer to. The application may not
write this parameter.*)
bUseStartAllNodes : BOOL; (* Can be used by the application to determine whether the library
should use command “Start Node”(FALSE) or “Start All Nodes”
(TRUE). The application only once may write this flag, preferably
during the first few cycles after start. Cyclic writing causes that single
slaves will not be restarted after a failure.*)
bAutoStart : BOOL;
(* TRUE set by PLC Designer if the Autostart option of the master
has been set. *)
bUseResetAllNodes : BOOL; (* Analog to bUseStartAllNodes*)
END_VAR
VAR_OUTPUT
bError : BOOL;
(* Historically, not used.*)
END_VAR
VAR (* Konfig *)
sDrvName : STRING(40); (* Historically, not used.*)
wBaudrate : WORD;
(* Baudrate as used in the configuration, entered by PLC Designer.*)
nFirstNodeNr : INT;
(* Index of the first slave belonging to the current master, entered by
PLC
Designer.*)
nLastNodeNr : INT;
(* Index of the last slave belonging to the current master, entered by
PLC
Designer.*)
SyncTimer : TON;
(* Timer used for the generation of the sync message.*)
dwCOBID_Sync : DWORD; (* COBID of the sync message as used in the configuration;
entered by PLC Designer.*)
dwHeartbeatTime : DWORD;(* Heartbeat generation time in ms, entered by PLC Designer.*)
nNodeId : WORD;
(* NodeId of the master as used in the configuration, entered by
PLC
Designer.*)
HeartbeatTimer :TON; (* Timer which is used by the master for heartbeat generation.*)