2 structure of the canopen-node (slave), Structure of the canopen-node (slave) – Lenze PLC Designer PLC Designer (R2-x) CANopen for Runtime Systems User Manual

Page 15

Advertising
background image

L-force | PLC Designer - CANopen for Runtime Systems

CANopen-Master library

14

DMS 2.0 EN 05/2009 TD29

2.4.2 Structure of the CANopen-node (Slave)

The access on the CANopen-nodes is performed via the implicit variable pCanOpenNode created by
the programming system. This variable is an array of function blocks representing the configured
nodes. Thus methods of the nodes, like e.g. ResetNodes, are called as follows:

pCanOpenNode[0].ResetNode();

„0“ is the index of the node, not the NodeId. The NodeId is part of the function block. All instance data
of a node can be accessed reading and (partly) writing. (For this purpose please open the module
interface in the library manager in »PLC Designer«). The components of the function block in detail:

VAR_INPUT

nRxIndex : INT;

(* historically, not used.*)

nSDOSend : INT;

(* Index of the current SDO, which is sent to the node during the

configuration

phase.*)

bAutoStart : BOOL;

(* Always set TRUE as soon as the master sets the node to

automatic start. *)

nNewStatus: INT;

(* Status parameter used when action SetNodeStatus is called.*)

bSynchSend: BOOL;

(* Transferred by the master at call of the module in order to

indicate the receiving of an externally generated sync message or

the generation of a sync message by the master. Only used

internally and immediately reset afterwards.*)

dwHeartbeatTime : DWORD; (* Interval in msec, according to which the master guards the

receiving of a heartbeat message of the node. The configurator will

enter the heartbeat time by using 1,5 times of the heartbeat time of

the

node.*)

bSendReset: BOOL := TRUE; (* Per default set by the master, except it wants to use

“Reset All Nodes”. In this case the reset is switched off by the

module.*)

END_VAR
VAR (* Konfig *)

wDrvNr : WORD;

(* Number of the CAN controller used by this module.*)

wMasterIdx : WORD;

(* Index of the master, below which the current slave is running.*)

ucNodeNr : BYTE := 1;

(* NodeID of the slave, as used in the configuration.*)

dwNodeIdent : DWORD;

(* Type of the node, which is also saved in object 0x1000 of the

node.*)

dwGuardCOBID : DWORD; (* COBID of the guard telegram; used when sending nodeguard

telegrams to the slave.*)

dwEmergCOBID : DWORD; (*Emergency COBID; used when waiting for emergency telegrams

of the slave.*)

wDiagSegment : WORD;

(* In the future used for storing the diagnosis address.*)

dwDiagOffset: DWORD;
wFirstSDOIndex : WORD;

(* Range of configuration SDOs for this slave within the array of

SDOs; entered by the configurator.*)

wNummOfSDO : WORD;

(* Number of SDOs, generated by the configurator for this slave.*)

wFirstRxPDOIndex : WORD; (* In these and the following three components the PDOs for this

slave will be identified.*)

wNummOfRxPDO: WORD;
wFirstTxPDOIndex: WORD;
wNummOfTxPDO: WORD;
GuardTime : TIME;

(* Nodeguard time as used in the configuration.*)

GuardTimer : TON;

(* Timer for generation of the guard message.*)

LifeTimer : TON;

(* Timer for guarding the slave. If within the guard time not at least
one answer on a nodeguard telegram is received, a guard error
will be issued. The time for the LifeTimer is calculated as follows:
Lifetimefactor * GuardTime + 0,5 * GuardTime *)

bDoInit : BOOL := TRUE;

(* Set to FALSE by the configurator, if option “Do not initialize” is
set.*)

Advertising