CS31_DIAG_EXTΒΆ

../_images/c76c6554e389f32b0a33139000eba54e
Parameter Value
Library_File_Name Diag_AC500_V20.lib
Firmware V2.0
Type Type_Function_Block_History
Group -

Function Block CS31_DIAG provides the diagnosis data of the CS31 Bus to the user.

The read values are written into internal structures of the instance.

Structure TYPE Assignment
strVisuData1 strCS31_DiagBus Diagnosis data of the CS31 master
strVisuData strCS31_DiagModule

Diagnosis data of all 31 CS31 software modules

ARRAY[0..31] OF strCS31_DiagOneModule

CS31Mod strCS31_DiagOneModule Diagnosis data of one CS31 software module

The structure strCS31_DiagBus is composed as follows:

TYPE strCS31_DiagBus :

(* STRUCT info about CS31 bus *)

STRUCT

  iCS31BusState : DINT;

(* Bit 0=1 waiting for slave

Bit 1=1 initialization

Bit 4=1 I/O data exchange

:= 19 all modules at bus *)

  iNumberModule : DINT; (* current no. of CS31 software modules on the CS31 bus *)
  iMaxNumberModule : DINT; (* max. number of modules at CS31 bus since power ON *)
  iErrorSum : DINT; (* sum error counter *)
  ulCycleCount : DWORD; (* counter of CS31 bus cycles *)
  byStateDiag : BYTE; (* general bus diagnosis: 0=ok, 1=no module on the bus *)

END_STRUCT

END_TYPE

The structure strCS31_DiagOneModule is composed as follows:

TYPE strCS31_DiagOneModule :

STRUCT

  dwScheduleCycle : DWORD; (* internal time *)
  byPhysicalAdress : BYTE; (* module address x 2 *)
  byStateDiag : BYTE; (* communication status:
       

00 = OK

Bit 0=1 (1) module disconnected again

Bit 1=1 (2) module not available on bus

Bit 2=1 (4) unconfigured module on bus

Bit 3=1 (8) difference in I/O range

Bit 4=1 (16) E4 – error message

Bit 5=1 (32)

Bit 6=1 (64) *)

  bySlaveType : BYTE; (* Slave type:
       

00 = digital input

01 = analog input

02 = digital output

03 = analog output

04 = digital input/output

05 = analog input/output

06 = special module

  byInputBytes : BYTE; (* number of reported input bytes *)
  byOutputBytes : BYTE; (* number of reported output bytes *)
  byInputBytesConf : BYTE; (* number of input bytes in configuration *)
  byOutputBytesConf : BYTE; (* number of output bytes in configuration *)
  byModuleConf : BYTE; (* 1-PLC config, 3- ignore module *)
  byStateDiag : BYTE; (* internal flag *)
  byd1 : BYTE; (* internal flag *)
  usErrorCounter : WORD; (* single-error counter *)
  byDiagErr : BYTE; (* internal error number *)
  byDiagChannnel : BYTE; (* internal error channel *)
  byd2 : BYTE; (* internal flag *)
  byd3 : BYTE; (* internal flag *)
  pConfig : DWORD; (* internal flag *)
 

END_STRUCT

END_TYPE

The structure strCS31_DiagModule contains an ARRAY[0..31], i.e. with 32 entries of the structure strCS31_DiagOneModule.

This way, the structures strVisuData1 and strVisuData provide access to all diagnosis data of the CS31 bus.

If the user program should have access to these values, this is done as follows:

diagCS31ext.strVisuData1.Variable.

In the following example, the current number of CS31 modules is read and assigned to the variable byActNumCS31Module:

../_images/16b45bade389f8390a33139000eba54e

The most important data are available in the visualization Visu_CS31_Diag_EXT of the Function Block Visualizations.