4. INITIAL PROGRAMMING
ATTENTION
The requisition diagnostics variables of direct mapping MODBUS Master/Client are de-
clared at System_Diagnostics GVL.
Example:
Device.Application.ReqDiagnostics
VAR_GLOBAL
MODBUS_Device_REQDG_0001 : NXMODBUS_DIAGNOSTIC_STRUCTS.
T_DIAG_MODBUS_RTU_MAPPING_1;
MODBUS_Device_REQDG_0002 : NXMODBUS_DIAGNOSTIC_STRUCTS.
T_DIAG_MODBUS_RTU_MAPPING_1;
MODBUS_Device_REQDG_0003 : NXMODBUS_DIAGNOSTIC_STRUCTS.
T_DIAG_MODBUS_RTU_MAPPING_1;
MODBUS_Device_1_REQDG_0001 : NXMODBUS_DIAGNOSTIC_STRUCTS.
T_DIAG_MODBUS_ETH_MAPPING_1;
MODBUS_Device_1_REQDG_0002 : NXMODBUS_DIAGNOSTIC_STRUCTS.
T_DIAG_MODBUS_ETH_MAPPING_1;
END_VAR
The ReqDiagnostics GVL is editable, therefore the requisitions diagnostic variables can be manually created without need
to follow the model created by the automatic declaration. Both ways can be used at same time, but the variables must always
be of type referring to the device. And take care to don’t delete or change a variable automatically declared, because they might
being used by some device. If the variable be deleted or changed an error is going to be generated while the project is being
compiled. To correct the automatically declared variable name, it must be followed the model exemplified above according to
the device and the requisition to which they belong.
The following picture shows an example of the presentation of this GVL when in Online mode.
Figure 42: ReqDiagnostics GVL in Online Mode
4.14.10. Prepare_Start Function
In this POU, the PrepareStart system event function is defined. It belongs to the communication task and is called before
starting the application. When there is active communication with the PLC, it is possible to observe the event status and the
call count in the System Events tab in the Task Configuration object. Every time the user starts the application, the count is
incremented.
57