Master

Diagnostic variables

The master possesses a variety of diagnostic variables that describe the state of the master and of the Profibus. They can be linked in the PLC:

Master 1:


CdlInfo:

Variable

Description

cycleCounter

Is incremented at the end of each PROFIBUS cycle in order that this variable can indicate whether the last cycle was completed before the task was started.

error

Indicates the number of slaves, with which no data exchange could take place during the last cycle. The variable BoxState of the slaves only has to be checked, if this value is not 0.

actualCycleTime

Shows the current cycle time in 4/25 µs. This variable is only updated, if all slaves are in data exchange (i.e. CdlInfo.error is 0).

actualModulo

Shows the current modulo. This variable is only relevant, if the slaves are prioritized.

 

Counter: These variables are only used for the redundancy mode.

Variable

Description

Counter[0-1]

These variables are reserved for extensions.

Counter[2]

This variable counts received telegrams. The counter is incremented by 1 whenever an error-free PROFIBUS telegram is received.

Counter[3]

This variable counts the telegrams received by the primary master. The counter is incremented by 1, whenever the primary master receives an error-free telegram (The primary master has the same address as the redundancy master).

Counter[4]

This variable is a timeout counter. The counter is incremented by 1 whenever a timeout occurs on the PROFIBUS.

Counter[5-7]

These variables are reserved for extensions.

 

DiagFlag:

Variable

Description

DiagFlag

Indicates whether the master diagnostic information has changed. In this case the control program reads the information via ADS, and the variable "DiagFlag" is then reset.

0 = diagnostic data unchanged.

1 = diagnostic data have changed. Use ADS Read to read the data.

 

GlobalState:

Variable

Description

GlobalState[0]

Indicates the state of the master.
0 = RUN
1 = RESET
2 = OFFLINE
3 = STOP

GlobalState[1]

Indicates the number of detected bus errors.

GlobalState[2]

Reserved for extensions.

GlobalState[3]

Reserved for extensions.

 

CycleFailedCounter:

Variable

Description

CycleFailedCounter

This counter indicates how often the PROFIBUS cycle was not complete on startup of the TwinCAT task.

 

StartRedundantMasterFlag: Is for the redundancy mode.

Variable

Description

StartRedundantMasterFlag

If the value is set to 1 (True), the redundancy master on the PROFIBUS becomes active. If the value is 0 (False), the redundancy master is offline.