PLC Logic to Stop Motor When Tank is Empty Automatically

In PLC, Press START, the pump begins to pump out the water; press STOP or when the water is
empty, the pump stops working.

X0 START button. X0 will be ON when pressed
X1 STOP button. X1 will be ON when pressed
X2 Level detector. X2 will be ON if there is water in the container
M0 Trigger pulse for one scan cycle
Y0 Pump motor


Ladder Program