7 guarding the configuration phase, 1 access on the state of the canopen-master, 2 time guarding in the boot-up phase – Lenze PLC Designer PLC Designer (R2-x) CANopen for Runtime Systems User Manual
Page 27
 
L-force | PLC Designer - CANopen for Runtime Systems
CANopen-Master library
26
DMS 2.0 EN 05/2009 TD29
2.4.4.7 Guarding the configuration phase 
The configuration phase of the slaves can be guarded. First of all the master must be guarded in its 
boot-up phase, because it will get caught at nStatus = 3, if a non-optional slave is not found during 
boot-up. 
Slaves, at which a problem occurs during the configuration phase, will get caught at nStatus = 3 or will 
directly change to error state > 5 after the configuration phase. 
The following examples show application code which can be used to keep working with the CAN 
network even in certain situations resp. to get diagnosis information. 
During the guarding of the boot-up phase it must be regarded that per IEC-cycle of the task, which 
calls the CANopen-Master (also see implicit calls), only one SDO can be transmitted to each slave. 
That is, the boot-up phase might take long time, depending on the maximum number of SDOs which 
must be transferred to a slave. 
2.4.4.7.1 Access on the state of the CANopen-Master 
In order to avoid that application code is processed although the IO-network is not yet ready, the 
status of the master must be polled: 
IF pCanOpenMaster[0].nStatus = 5 THEN 
 <application 
code>
END_IF
2.4.4.7.2 Time guarding in the boot-up phase
VAR 
 
Guarding : TON;
iSlave : INT;
bSlaveFound:
BOOL;
END_VAR
Guarding(IN:= pCanOpenMaster[0].nStatus < 5, PT := T#10 );
IF Guarding.Q THEN
(* figuring out whether there is a non-configurable slave *) 
FOR iSlave := pCanOpenMaster[0]. nFirstNodeNr TO pCanOpenMaster[0]. nLastNodeNr 
DO 
 
IF pCanOpenNode[iSlave]. nStatus < 4 THEN
bSlaveFound := TRUE;
 EXIT; 
 END_IF 
END_FOR
END_IF 
 
After this sequence in variable iSlave the number (index) of the fist slaves appears, which is still in 
status 3 after expiration of the guarding time. 
This example only is valid for a non-optional slave. Optional slaves must be managed by the 
application, because it is not always recognizable, whether they are available or not. The startup 
phase will be validated as “OK” even if optional slaves are not available.