PLC state machine programming Article 4-historical state processing, plc Article 4
Today, we add the previous control task to the historical state. This task will be complicated. For such tasks, we tend to automatically generate PLC programs and write them by ourselves, which is prone to errors. But for demonstration, we can try it. Let's get down to the truth. below is our control task.
Control Task
This task is based on the previous one. An emergency stop button is added. When the EMStop emergency stop button is pressed, the device stops immediately. After troubleshooting, we hope that the device will continue to run from the fault. For such a task, we need to introduce the historical status.
The following is the state machine of the task.
In the Logic state machine, an Action sub-state is added, and the Action State contains logical control. The Action State contains an additional H letter, indicating that the Action state is a historical state. When the State is changed from Action to Alarm and then enters the Action state again, it does not start from the OnLeftPos default state, it starts from the last time it leaves. The following is the SCL program.
Control Program
Note the following points:
The state machine is a little complicated, and the program is hard to write. Next we will discuss how to automatically generate a program from a state machine.