CS31_DIAGΒΆ
Parameter | Value |
---|---|
Library_File_Name | Diag_AC500_V10.lib |
Firmware | V1.0.2 |
Type | Type_Function_Block_History |
Group | - |
The Function Block CS31_DIAG provides the diagnosis data of the CS31 bus to the user.
The instance diagCS31 of the Function Block CS31_DIAG is declared in the global variables list GL_AC500_Diagnosis. The integrated visualization of the Function Block accesses the variables of this instance.
In order to include the Function Block into an AC500 project, it is only necessary to call the Function Block instance. Example in ST:
diagCS31(EN := TRUE, COM := 1);
The read values are written into internal structures of the instance diagCS31.
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 *) | ||
byCommState : | BYTE; | (* internal communication status: | ||
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; | (* reported number of input bytes *) | ||
byOutputBytes : | BYTE; | (* reported number of output bytes *) | ||
byInputBytesConf : | BYTE; | (* configured number of input bytes *) | ||
byOutputBytesConf : | BYTE; | (* configured number of output bytes *) | ||
byModuleConf : | BYTE; | (* 1-PLC config, 3- ignore module *) | ||
byStateDiag : | BYTE; | (* Diagnostic Condition: each bit indicates a diagnosis type) | ||
byStateDiag = 0 : no diagnosis Bit 0 (0x01, 1) : a device that was present on the bus has been disconnected from the bus. Bit 1 (0x02, 2) : A configured device or module could not be found on the bus Bit 2 (0x04, 4) : A device or module that is not configured, was found on the bus Bit 3 (0x08, 8) : It was noted a difference between a configured and reported I / O peripheral. Bit 4 (0x10, 16) : A CS31 device (no device of the S500 series) has a new error message reported (short circuit or internal fault) Bit 5 (0x20, 32) : A CS31 device (no device of the S500 series) has reported a new error message Bit 6 (0x40, 64) : A CS31 device of the S500 series has reported a new error message. Bit 7 (0x80, 128) : <not used> |
||||
byd1 : | BYTE; | (* internal variable *) | ||
usErrorCounter : | WORD; | (* Error counter for the module *) | ||
byDiagErr : | BYTE; | (* internal error number *) | ||
byDiagChannnel : | BYTE; | (* Channel in which the error has been has occurred *) | ||
byd2 : | BYTE; | (* internal variable *) | ||
byd3 : | BYTE; | (* internal variable *) | ||
pConfig : | DWORD; | (* internal variable *) | ||
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:
diagCS31.strVisuData1.Variable.
In the following example, the current number of CS31 modules is read and assigned to the variable byActNumCS31Module:
The most important data are available in the visualization Visu_CS31_Diag of the Function Block Visualizations.