Description
(Original Document)
Description of the Function
This DFB model detects the change to zero of the COND input.
To create a customized diagnostic DFB, you can use this model and modify it according to your needs.
It is unprotected. Its operation is described on the following pages.
You can modify all the elements of this type of DFB to create your own diagnostic DFB.
Additional parameters EN and ENO can be configured.
NOTE: This diagnostic DFB cannot be used in a different user DFB. The model itself must be modified.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL User_1 (ED: = Enable_Control, COND: = Alarm_bit,
ERROR => Error_bit) 
Representation in ST
Representation:
User_1 (ED: = Enable_Control, COND: = Alarm_bit, 
ERROR => Error_bit); 
Description of parameters
The following table describes the input parameters:
Parameter
Type
Description
ED
DFB activation bit.
If ED = 0, theCOND input is not monitored.
COND
Bit monitored by the DFB:
  • if COND = 1 the alarm is de-registered and the ERROR output changes to 0. The de-registration status (output of the DEREG function used in the code) is stored in the %SW77 system word.
  • if COND = 0 and ERROR = 0 the alarm is saved and the ERROR output changes to 1. The status of the save is stored in the %SW76 system word (result of the save by the REGDFB) function.
  • if COND = 0 and ERROR = 1 and there was a previous write attempt in the diagnostics buffer whereas it was full (BUFFULL=1), the alarm is saved. The status of the save is stored in the %SW76 system word (result of the save by the REGDFB function). If %SW76 = 0 this means the save was performed correctly and the BUFFULL indicator is set to 0.
The following table describes the output parameters:
Parameter
Type
Description
ERROR
Output indicating that the alarm is detected by the DFB.
  • If ERROR = 0 the last alarm has disappeared and has been handled, and there have been no new alarms.
  • If ERROR = 1 an alarm is in progress, it may not have been saved in the PLC's diag buffer if the buffer was full when the alarm occurred (BUFFULL = 1). If the alarm was saved in the PLC's diag buffer, BUFFULL = 0.
The following table describes the public variables:
Parameter
Type
Description
AREA_NR
Process zone monitored by the DFB: This zone is numbered 0 to 15 for which a zone has been determined in the Viewer.
OP_CTRL
If OP_CTRL = 1 the acknowledgement of the alarm on the Viewer is requested.
If OP_CTRL = 0 the operator does not need to acknowledge the alarm message on the Viewer.
The following table describes the private variables:
Parameter
Type
Description
ERROR_ID
Variable containing the error's identifier. This unique identifier is generated automatically by the system when the REGDFB function is called (use of the ERROR_ID variable as an output parameter of the REGDFB function).
It is used on input in the DEREG function to deregister the error associated with this identifier.
STATUS
Double passworded as a parameter of the REGDFB function. When used, this double password must contain a value characteristic of the error. This status is displayed in the Viewer.
BUFFULL
BUFFULL = 1 indicates that the error was not correctly saved because the PLC's diag buffer was full.
PIN_NB
Default input number which the REGDFB function must process. This number corresponds to the order number of the inputs for which the Diag property has been selected.
In our model, the COND input is input 1 because it is the first diagnostic input. Indeed, the ED input is not used for the diagnostic.
PIN_VAL
Value expected on the PIN_NB input. In this model, the alarm is detected when COND changes to zero whereas the expected value is 1.
NOTE: It is very important to fill in the comment of the DFB instance created, because this comment is displayed in the Diagnostic Viewer.