02-06-2022 - PLC Start/Stop from HMI
Mission:
Sometimes it is handy to be able to start and stop a PLC from remote and not with the designated button on the PLC. This cannot be done with a function in the PLC because if the PLC is not running, then it is impossible to restart it.
That is why we are designing a way to do it with the HMI.
1. Define the start and stop buttons:
We define two buttons. I’ve chosen to do this in one of the template menu’s, but this can be done on a screen that is only accessible by a maintenance engineer as well.
Text and color can be defined in the properties of the buttons.
2. Define the behaviour of the stop button:
Define a click event, setting the PLC mode to stop.
3. Define the behaviour of the run button:
Define a click event, setting the PLC mode to run.
4. The definition of the HMI connection:
Clicking the -STOP- button will stop the PLC, because the SetPLCMode command with parameter STOP is activated by the HMI. Clicking the -RUN- button will switch the PLC to RUN, because the SetPLCMode command with parameter RUN is activated by the HMI.
That is all to start and stop the PLC.
Now we want to see the status of the PLC on het HMI:
5. Define two internal HMI tags in the HMI tree:
Use a tag group named PLCmode.
6. Define a trigger event on PLCmodeChange:
If the value of the PLCmode changes, an event on PLCmodeChange is issued.
7. Define a text list in the HMI tree:
In the HMI tree -Text and graphics list- define a text list PLCmode with 3 entries:
8. Insert a symbolic I/O field on the screen:
9. Definition of the symbolic I/O field:
Definitions for tag and text list, set the mode to ouput.
10. Appearance of the symbolic I/O field:
Depending of the size of the program, you can see or cannot see the status -STARTING-.
11. Add events on the screen:
On the screen where the symbolic I/O field is situated, add two events. The first event will get the current PLC mode, the second event will switch the status of the symbolic I/O field, because of the -Value change- event of PLCmodeChange.
The end.
Click on below download icon to download the TIA-Portal project.