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

Page 16

Advertising
background image

L-force | PLC Designer - CANopen for Runtime Systems

CANopen-Master library

DMS 2.0 EN 05/2009 TD29

15

bOptional :BOOL;

(* Set to TRUE by the configurator, if option “optional device” has
been set. *)

bHeartbeatConsumer: BOOL; (* Not used. Reserved for information purposes.*)
tHeartBeatLifeTime : TON; (* Watch time for the heartbeat messages of a slave. Always

restarted as soon as a heartbeat message coming from the slave
has been received. *)

END_VAR
VAR_OUTPUT

byLastState : BYTE := 0;

(* Last status, as contained in the answer of the node on the last
guard message.*)

nStatus : INT;

(* Current status of the node. This status is the status of a node
within the current library and is not at all concerned with the status
defined by CANopen!:
0: undefined.
1: Node will be reset by the master and re-configured.

Master waits on a bootup-message of the node (or on the

expiry

of the given guard time) and after that switches the

state of the node to status 2.

2: Master waits ca. 300 msecs before requesting object 0x1000.

Then the status is set to 3.

3: Master starts the configuration of the slave with a SDO-read-

request (index 0x1000) to the node. All SDOs generated by the

configurator will be sent to the node in this status. The

generated SDOs are packed in an array of SDOs, where the

node knows its first SDO and the number of its SDOs. (Instance

components „wFirstSDOIndex” and „wNummOfSDO“)

4: If in the configuration of the Master “Auto startup” is activated,

the node will get sent a „Start Node“ and change to status 5.

5: Node receives/sends PDOs, Master also. Normal operation.
97: Optional node has not been detected at start-up.
98: Node has answered on a request for the device type

(object 0x1000) with a different type.

99: LifeTimer is exceeded, Nodeguarding error.*)

The state of a node during the “normal” operation when I/O data
are being exchanged, is 5.

nSDOActiv : INT;

(* Index of the active SDO, managed by the node; -1 means that no
SDO is active *)

EmcyMsg : CAN_Message; (* Last emergency message received from the node.*)
aEmcyMsg : ARRAY[0..7] OF CAN_Message; (* <Here the last 8 emergency messages received

by the node, will be stored. aEmcyMsg[0] contains the most
recently received and thus latest emergency message.*)


sdoConfig : CanOpenSendSDO; (* Instance of the CanManger-Lib function block, used for the

configuration of the node. *)

END_VAR

VAR

nSDOIndex : INT;

(* Current index of the configuration SDOs.*)

bReady : BOOL;

(* Always when an emergency or guard message has been
received, bReady is set TRUE for the duration of one cycle.*)

SDO_TimeOut: TON := ( PT := T#500ms );
dwMerker : DWORD;

(* Lower 16 bits of object 0x1000, as read from the device.*)

nStatusOld : INT;

(* Internal variable, used to detect a status change.*)

bManualStart : BOOL := FALSE; (* Internally used by StartNode for advising the function block to

start the slave.*)

Advertising