5. CONFIGURATION
5.1.5.1.5. PROFIBUS I/O Modules Quality
Different from local bus, MasterTool doesn’t automatically create the PROFIBUS modules quality structures, and neither
the PLC update such structures. Therefore the creation and cyclic update of PROFIBUS modules quality is user responsibility.
To help on the development of such applications, there are following practical examples, in ST language, for the main
PROFIBUS modules (DI, DO, AI, AO), based on Nexto Serie’s PROFIBUS slaves (NX5110). The user should feel encouraged
to make any needed adaptation and change to fit to its application.
ATTENTION
For the routines, presented in sequence, correct functioning it is necessary to enable Status
in Diagnose in the PROFIBUS slaves.
The development of PROFIBUS I/O modules quality points update routine must began from quality variables declaration
and initialization, from a GVL:
VAR_GLOBAL
QUALITY_PB_NX1005_I: LibDataTypes.QUALITY:= (VALIDITY:= VALIDITY_INVALID,
FLAGS:= (FLAG_RESTART:= TRUE));
QUALITY_PB_NX1005_O: LibDataTypes.QUALITY:= (VALIDITY:= VALIDITY_INVALID,
FLAGS:= (FLAG_RESTART:= TRUE));
QUALITY_PB_NX6000: LibDataTypes.QUALITY:= (VALIDITY:= VALIDITY_INVALID,
FLAGS:= (FLAG_RESTART:= TRUE));
QUALITY_PB_NX6100: LibDataTypes.QUALITY:= (VALIDITY:= VALIDITY_INVALID,
FLAGS:= (FLAG_RESTART:= TRUE));
END_VAR
5.1.5.1.6. PROFIBUS Digital Inputs Quality
// PROFIBUS digital input quality update, module NX1005
// In communication success case with PROFIBUS slave (address = 99) ...
IF DG_NX5001.tMstStatus.abySlv_State.bSlave_99 = TRUE THEN
// Waits the PROFIBUS slave become apt to exchange data and diagnostics
// (It is necessary to wait, avoiding invalid quality generation)
IF DG_NX5110.tPbusHeadA.tStatus1.bStation_Non_Existent = FALSE AND
DG_NX5110.tPbusHeadA.tStatus1.bStation_Not_Ready = FALSE AND
DG_NX5110.tPbusHeadA.wIdentNumber > 0 THEN
QUALITY_PB_NX1005_I.FLAGS.FLAG_COMM_FAIL:= FALSE;
// If there is a module present on the bus (slot = 2) and
// if there is no modules config problem (general) and
// if there is no config problem in that module (specific) and
// if there is no fatal error identification by the module ...
IF (DG_NX5110.tPbusHeadA.dwModuleNotPresent AND SHL(1, 2)) = 0 AND
DG_NX5110.tPbusHeadA.tSummarized.bConfigMismatch = FALSE AND
DG_NX1005_24_Vdc_8_DO_Trans_8_DI.tGeneral.bConfigMismatch = FALSE AND
DG_NX1005_24_Vdc_8_DO_Trans_8_DI.tGeneral.bFatalError = FALSE THEN
QUALITY_PB_NX1005_I.VALIDITY:= VALIDITY_GOOD;
QUALITY_PB_NX1005_I.FLAGS.FLAG_RESTART:= FALSE;
QUALITY_PB_NX1005_I.FLAGS.FLAG_FAILURE:= FALSE;
QUALITY_PB_NX1005_I.FLAGS.FLAG_OLD_DATA:= FALSE;
ELSE
QUALITY_PB_NX1005_I.VALIDITY:= VALIDITY_INVALID;
QUALITY_PB_NX1005_I.FLAGS.FLAG_FAILURE:= TRUE;
81