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 seal-in rung in the Labs editor while running

The finished rung, running. Green shows where power flows.

1. Start an empty project

  1. Open the free sandbox.
  2. Open the File menu and choose New project.
  3. In Project Explorer, open MainProgram, then Routines, then MainRoutine.

2. Add three tags

  1. In the bottom panel, open Tags and click + Tag.
  2. Add StartPB, StopPB and Motor. Give each the data type BOOL.

3. Add the rung

  1. Click Rung in the instruction palette.
  2. Drag an XIC onto the rung. In the Inspector, set its tag to StartPB.
  3. Drag an XIO after it and set its tag to StopPB.
  4. Drag an OTE to the end and set its tag to Motor.
  5. Select the first XIC and click Branch around. Drag an XIC onto the new branch and set its tag to Motor.

4. Run it

  1. Click Run. The editor locks while the PLC runs.
  2. Click Toggle Bits, then click the StartPB value in the Tags table. It turns on, and Motor turns on with it.
  3. Click StartPB again to turn it off. Motor stays on, because its own contact holds the rung.
  4. Click StopPB. Motor turns off and stays off.

What each scan does

1. Press StartPB. The StartPB branch passes power and OTE writes 1 to Motor.

StepStartPBStopPBMotor
1. Press StartPB101
2. Release StartPB001
3. Press StopPB010

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.

Related