Home > electrical-training-simulator > PLC programming lessons > lesson 1

PLC Programming Lesson 1: Start/Stop Latch and Alarm Bypass

Build the circuit, test its behavior, troubleshoot the mistake, and finish the program

Lesson objective: Create a simple latch circuit using a normally open momentary Start_PB at I:1/1 and a normally closed momentary Stop_PB at I:1/0 to control the Green_Lamp at O:2/0.

 

When the Green_Lamp is off, the Red_Alarm at O:2/1 should be on unless either Toggle_SW1 at I:1/2 or Toggle_SW2 at I:1/3 is closed. The two toggle switches act as a bypass for the Red_Alarm.

 

You will build and test the program, identify incorrect behavior, edit the ladder logic, then run the modified program and confirm the intended operation.

Before you begin: Access to the PLCLogix 500 or PLCLogix 5000 training simulator is required to complete the hands-on lesson series.

1. Create a New PLC Program

 

Open PLCLogix 500 and create a new controller file. Select File > New. In the New Controller dialog, enter the desired program name and click OK. It is good practice to save the file to the desired location at this point.

Create a new controller file and name the Lesson 1 program.

Click rung number 0. The rung number becomes highlighted. Any instruction you add is inserted immediately to the right of the currently selected circuit element.

 

Click the Normally Open Contact icon on the Instruction Toolbar to add the first contact to rung 0.

 

Learning tip: Use the PLCLogix Help options whenever you encounter an instruction or function you do not recognize. Learning to use the built-in instruction reference is an important PLC programming and troubleshooting skill.
Select rung 0 and add a normally open contact.

Double-click the question mark above the new contact, enter address I:1/1, and press Enter. Then double-click the description area above the address and enter Start_PB.

Address the normally open contact as I:1/1.
Add the Start_PB description to the input contact.

2. Build the Start/Stop Latch Circuit

 

With the Start_PB contact highlighted, click the OTE (Output Energize) instruction on the toolbar to add an output to the right side of the rung.

Add an OTE instruction to the end of the rung.

Address the OTE as O:2/0 and label it Green_Lamp.

Address the output as O:2/0 and label it Green_Lamp.

Click rung number 0 again and click the Branch icon on the Instruction Toolbar.

Select rung 0 so the branch is inserted at the start of the rung.
The new branch appears at the start of rung 0.

Move the Start_PB contact into the upper part of the branch. Click and hold the contact, drag it to the small placement box inside the branch, and release it when the target turns green.

Drag Start_PB into the upper branch.

Select the lower-left corner of the branch and add another normally open contact. This contact will be used as the seal-in path.

Add the seal-in contact on the lower branch.

Click the right side of the branch so the branch edge is highlighted. The next instruction will be inserted immediately to the right of this point.

Highlight the right side of the branch before adding the Stop_PB contact.

Add a Normally Closed contact, address it as I:1/0, and label it Stop_PB. Save the program before testing.

The first version of the latch uses the Stop_PB contact shown here.

3. Set Up the PLCLogix I/O Rack

 

Select I/O Worlds > I/O Rack to open the PLCLogix 2D I/O interface.

Open the 2D I/O Rack from the I/O Worlds menu.

For this exercise, configure Slot 1 bit 00 as a normally closed pushbutton and Slot 1 bit 01 as a normally open pushbutton. Right-click a switch repeatedly to cycle through the available switch types.

The PLCLogix I/O Rack provides the field devices used to test the ladder program.

Because this exercise only uses the upper portion of Slots 1 and 2, you can resize the I/O window so the ladder program and field devices remain visible at the same time.

 

The default lamp at O:2/0 is green. Change the lamp at O:2/1 to red by right-clicking it and selecting Red.

Set the O:2/1 output lamp color to red for the Red_Alarm.

4. Upload, Test, and Correct the Latch

 

Use the Comms menu and select Upload to upload the program and go online.

Upload the program and go online so you can test the latch circuit.
Test 1 - Start_PB: Click and hold Start_PB. The corresponding ladder contact shows continuity, but the output does not remain energized when the button is released. The latch fails to lock in.
Testing Start_PB reveals that the first version of the latch does not stay energized.
Test 2 - Stop_PB: Click and hold Stop_PB. The observed action is the reverse of the intended behavior. This tells you the Stop_PB ladder instruction must be corrected.
Testing Stop_PB helps identify the incorrect ladder instruction.

To edit the program, use the mode drop-down and select OFFLINE.

Go offline before editing the program.

The lesson demonstrates two ways to correct an instruction: replace the contact type directly or delete it and insert the correct contact.

 

To replace it directly, double-click the Stop_PB instruction, change the device type to XIC, and re-enter address I:1/0. The existing label fills automatically when the address is entered.

Change the Stop_PB ladder instruction to XIC and retain address I:1/0.

Upload the corrected program and verify the behavior again. Press and release Start_PB: Green_Lamp should turn on and remain on. Press and release Stop_PB: continuity on the latch rung should break and Green_Lamp should turn off.

Re-test the corrected start/stop latch before adding the alarm circuit.

5. Add the Red Alarm Bypass Circuit

 

The lesson also demonstrates that an unwanted instruction can be removed by right-clicking it and selecting Delete.

You can also remove an instruction and insert a replacement.

Add the normally closed contacts for the two bypass toggle switches using addresses I:1/2 and I:1/3, with the appropriate labels. Add another OTE using output address O:2/1 and label it Red_Alarm.

 

The completed program contains the start/stop latch on rung 0 and the alarm/bypass logic on rung 1.

Completed Lesson 1 ladder program ready for final testing.

6. Final Testing

 

Save the completed program, upload it, and go online.

  1. With the program running, verify that Red_Alarm is on initially.
  2. Press Start_PB. Green_Lamp should turn on and Red_Alarm should turn off.
  3. Press Stop_PB. The latch should release, Green_Lamp should turn off, and Red_Alarm should turn back on.
  4. Close Toggle_SW1. Red_Alarm should be bypassed and turn off.
  5. Open Toggle_SW1 and repeat the test with Toggle_SW2. The same bypass behavior should occur.
Self-assessment: There is no separate online test for this lesson. Your completed PLC program and its correct simulated behavior are the assessment.
Assigned by an instructor or supervisor? Save your finished PLC program and share it with them when you complete the lesson.

Need access to the required simulator? PLCLogix 500 Simulator   |   PLCLogix 5000 Simulator