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.
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.
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.
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.
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.
Address the OTE as O:2/0 and label it Green_Lamp.
Click rung number 0 again and click the Branch icon on the Instruction Toolbar.
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.
Select the lower-left corner of the branch and add another normally open contact. This contact will be used as the seal-in path.
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.
Add a Normally Closed contact, address it as I:1/0, and label it Stop_PB. Save the program before testing.
3. Set Up the PLCLogix I/O Rack
Select I/O Worlds > I/O Rack to open the PLCLogix 2D I/O interface.
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.
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.
4. Upload, Test, and Correct the Latch
Use the Comms menu and select Upload to upload the program and go online.
To edit the program, use the mode drop-down and select OFFLINE.
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.
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.
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.
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.
6. Final Testing
Save the completed program, upload it, and go online.
- With the program running, verify that Red_Alarm is on initially.
- Press Start_PB. Green_Lamp should turn on and Red_Alarm should turn off.
- Press Stop_PB. The latch should release, Green_Lamp should turn off, and Red_Alarm should turn back on.
- Close Toggle_SW1. Red_Alarm should be bypassed and turn off.
- Open Toggle_SW1 and repeat the test with Toggle_SW2. The same bypass behavior should occur.
Need access to the required simulator? PLCLogix 500 Simulator | PLCLogix 5000 Simulator