Your first program
Build a motor start and stop in ladder logic. It takes five minutes, and you finish with a rung that holds itself on.
What you will build
Pressing StartPB turns Motor on. Releasing it leaves Motor on. Pressing StopPB turns it off. This is a seal-in.

The finished rung, running. Green shows where power flows.
1. Start an empty project
- Open the free sandbox.
- Open the File menu and choose New project.
- In Project Explorer, open MainProgram, then Routines, then MainRoutine.
2. Add three tags
- In the bottom panel, open Tags and click + Tag.
- Add
StartPB,StopPBandMotor. Give each the data typeBOOL.
3. Add the rung
- Click Rung in the instruction palette.
- Drag an XIC onto the rung. In the Inspector, set its tag to
StartPB. - Drag an XIO after it and set its tag to
StopPB. - Drag an OTE to the end and set its tag to
Motor. - Select the first XIC and click Branch around. Drag an XIC onto the new branch and set its tag to
Motor.
4. Run it
- Click Run. The editor locks while the PLC runs.
- Click Toggle Bits, then click the
StartPBvalue in the Tags table. It turns on, andMotorturns on with it. - Click
StartPBagain to turn it off.Motorstays on, because its own contact holds the rung. - Click
StopPB.Motorturns off and stays off.
What each scan does
Global.StartPBXIC
Global.MotorXIC
Global.StopPBXIO
Global.MotorOTE
1. Press StartPB. The StartPB branch passes power and OTE writes 1 to Motor.
Global.StartPBXIC
Global.MotorXIC
Global.StopPBXIO
Global.MotorOTE
2. Release StartPB. The Motor branch reads the 1 that OTE wrote last scan, so the rung stays true.
Global.StartPBXIC
Global.MotorXIC
Global.StopPBXIO
Global.MotorOTE
3. Press StopPB. XIO StopPB blocks power. Motor turns off.
| Step | StartPB | StopPB | Motor |
|---|---|---|---|
| 1. Press StartPB | 1 | 0 | 1 |
| 2. Release StartPB | 0 | 0 | 1 |
| 3. Press StopPB | 0 | 1 | 0 |
Good to know
- If an instruction will not drop, check that the PLC is stopped. Logic cannot be edited while it runs.
- Click Single Scan instead of Run to move one scan at a time.
- Save your work with Ctrl+S. See Saving and opening projects.