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

Page 20

Advertising
background image

L-force | PLC Designer - CANopen for Runtime Systems

CANopen-Master library

DMS 2.0 EN 05/2009 TD29

19

2.4.3.4 Evaluation of the responses of the slaves on the configuration SDOs
The application can log the complete configuration phase of a node, thus can „see“ each response.
The responses on the configuration SDOs appear in sdoConfig of the node structure: for example in

pCanOpenNode[0].sdoConfig.ucAnswerBytes[0..7] (see also: description of function block
CanOpenSendSDO.)

The master sends one SDO after the other as soon as a response from the slave has been received.
Therefore the application must detect the change of the response in order to determine when a new
SDO response has come in:

VAR

ucOldAnwer : array[0..7] of BYTE;
i : INT;

END_VAR
FOR i := 0 to 7 DO

IF pCanOpenNode[0].sdoConfig.ucAnswerBytes[i] <> ucOldAnswer[i] THEN

ucOldAnswer

:=

pCanOpenNode[0].sdoConfig.ucAnswerBytes;

(* Here the new response can be evaluated, if desired by the application.*)

(* Information on the abort codes see in the description of CanOpenSendSDO.*)

EXIT; (* Leave loop at first change.*)

END_IF

END_FOR

Advertising