At a Glance
You can create a diagnostic DFB in one of two ways.
You can create a standard DFB and then define its values and program it so that it is a diagnostic DFB.
You can use the USER_DIAG_ST_MODEL model that we will provide you with, or use a model you already have.
These two procedures are described below.
Creating a Diagnostic DFB without a Model
The following table describes the procedure to follow to create a diagnostic DFB without a predefined model.
Step |
Action |
---|---|
1 |
In the structure view of the Project Browser, right-click on the directory Derived FB Types. Result: A shortcut menu is opened. |
2 |
Activate the Open command. Result: The Data Editor window is opened. It is positioned directly under the DFB Types tab and shows the list of the project's DFBs. |
3 |
Select the first empty cell in the Name column (indicated by an arrow) and enter the name of the new DFB type, then confirm using Enter. Result: The empty structure of the DFB type is now created. This new DFB is added to the list of existing DFBs. It also appears in the Derived FB Types directory tree. |
4 |
In the Data Editor, right-click on the type of DFB you have just created. Result: the contextual menu appears. |
5 |
Choose the Data Properties command. Result: the Data Properties window appears. |
6 |
Click on the Diag button. Result: the checkbox is checked in red. This type of DFB is now a diagnostic DFB. If, in the Project Settings, the application diagnostic has been requested, the project's generation will incorporate the project diagnostic service in the PLC. |
7 |
Create the inputs, outputs, inputs/outputs and the internal variables of the DFB. Note: in the input's properties, remember to check the Diag checkbox for inputs that will be monitored by the DFB. |
8 |
Write your DFB's code using the REGDFB function to save and date the alarm, and the DEREG function to de-register the alarm. Note: refer to the description of the code of the USER_DIAG_ST_MODEL user diagnostic DFB model if you are not familiar with this type of DFB. |
9 |
Run a project analysis to validate your new type of DFB. Result: your new type of DFB is created. You can now create and insert instances of this type of DFB in your program. When your PLC is in RUN mode, the Viewer will display the alarms according to the operation you have programmed. |
Creating a Diagnostic DFB with the USER_DIAG_ST_MODEL Model
The following table describes the procedure to follow to create a diagnostic DFB using the USER_DIAG_ST_MODEL predefined model.
Step |
Action |
---|---|
1 |
In the structure view of the Project Browser, right-click on the directory Derived FB Types. Result: A shortcut menu is opened. |
2 |
Choose the Get from Library command. Result: the Library Browser window appears. |
3 |
Select the USER_DIAG_ST_MODEL diagnostic DFB model in the diagnostic library, then click on the >> button to transfer it to your project. |
4 |
Confirm the transfer with OK. Result: the model appears in the Project Browser. |
5 |
Replace the USER_DIAG_ST_MODEL name with the name of the type of user DFB you want to create. |
6 |
Modify and create the inputs, outputs, inputs/outputs and the internal variables of the DFB. Note: in the input's properties, remember to check the Diag checkbox for inputs that will be monitored by the DFB. |
7 |
Write your DFB's code using the model. Note: refer to the description of the code of the user diagnostic DFB model if you are not familiar with this type of DFB. |
8 |
Run a project analysis to validate your new type of DFB. Result: your new type of DFB is created. You can now create and insert instances of this type of DFB in your program. When your PLC is in RUN mode, the Viewer will display the alarms according to the operation you have programmed. Note: the message displayed by the Viewer is the comment associated with the instance of the DFB. You must therefore remember to fill in this comment for each instance created. |