Hands-On Lab Workbook
Total Page:16
File Type:pdf, Size:1020Kb
Hands-On Lab Workbook
Basics of PLCs Basics of PLCs: Hands-On Lab
Training Lab Manual ABOUT THIS HANDS-ON LAB ______7
BEFORE YOU BEGIN______7
LAB MATERIALS______8
DOCUMENT CONVENTIONS______9
LAB 1: CONFIGURING THE COMPUTER TO COMMUNICATE TO THE PLC______11
LAUNCHING RSLINX COMMUNICATION SOFTWARE AND CONFIGURING A DRIVER______11
LAB 2: CREATING A NEW PROJECT______14
ABOUT THIS LAB______14
ABOUT MICROLOGIX CONTROLLERS______14
LAUNCHING RSLOGIX 500 PROGRAMMING SOFTWARE______15
CREATING A NEW CONTROLLER PROJECT______15
EXAMINING YOUR NEW RSLOGIX 500 PROJECT______18
ASSIGNING I/O MODULES______19
CREATING THE FIRST RUNG OF LADDER LOGIC______21
CREATING THE SECOND LADDER LOGIC RUNG______25
CREATING THE THIRD LADDER LOGIC RUNG______30
VERIFYING YOUR LADDER LOGIC PROGRAM______31
SAVING YOUR WORK______32
LAB3: TESTING YOUR LADDER LOGIC______33
DOWNLOADING YOUR LADDER LOGIC TO THE PLC______33
CHANGING THE PLC FROM PROGRAM TO RUN MODE______35
MONITORING AND TESTING YOUR PLC LADDER PROGRAM______36
LAB 4: USING BASIC INSTRUCTIONS IN LADDER LOGIC______38
Basics of PLCs Hands-on Lab
4/29/2018 Page 3 of 48 GOING OFF-LINE WITH THE PLC______38
COPY AND RENAME YOUR PREVIOUS LADDER LOGIC PROGRAM______38
MODIFYING YOUR EXISTING LADDER LOGIC PROGRAM______39
ADDING A TIMER TO YOUR LADDER LOGIC PROGRAM______40
ADDING A COUNTER TO YOUR LADDER LOGIC PROGRAM______41
ADDING A LIMIT INSTRUCTION TO YOUR LADDER LOGIC PROGRAM______42
VERIFYING YOUR LADDER LOGIC PROGRAM______43
ADDING RUNG COMMENTS TO YOUR LADDER LOGIC PROGRAM______45
SAVING YOUR WORK______46
DOWNLOADING THE LADDER LOGIC PROGRAM TO THE PLC______47
MONITORING AND TESTING YOUR LADDER LOGIC PROGRAM______49
Basics of PLCs Hands-on Lab
4/29/2018 Page 4 of 48 Welcome to the Basics of PLCs Hands-On Lab
About This Hands-On Lab
This session provides you with an opportunity to explore the basics of programmable logic control using a MicroLogix 1200, or MicroLogix 1500 PLC, depending on the station at which you find yourself seated. The following sections explain what you’ll be doing in this lab session, and what you will need to do to complete the hands-on exercises. What You Will Accomplish In This Lab As you complete the exercises in this hands-on session, you will: . develop an understanding of the concepts of PLC’s and an introduction to basic programming . design, create and download programs to a MicroLogix controller . examine the PLC executing a program Who Should Complete This Lab This hands-on lab is intended for individuals who: . have little or no experience with PLC’s and want to learn the basics of how PLC’s operate . are interested in becoming familiar with the basics of programming a PLC using ladder logic . are interested in becoming familiar with RSLogix 500 programming software Pre-Requisites For This Lab . General understanding of electrical control . Basics of Microsoft Windows 95/98/NT/2000/XP based computer
Before You Begin
Before you begin this Hands-On Lab, please be sure to close any applications that are currently running.
For this lab you will need to complete all sections in order, because each section builds upon the previous section.
Basics of PLCs Hands-on Lab
4/29/2018 Page 5 of 48 Lab Materials
For this Hands-On lab, we have provided you with the following materials that will allow you to complete the labs in this workbook. Hardware Your lab station will consist of one of the following: MicroLogix 1200: . (1) 1762-24BXB MicroLogix 1200 (14 DC Inputs / 10 DC/relay outputs, 24VDC power) . (1) 1762-IF2OF2 1762 Input/Output Analog Expansion Module . (1) 1794-PS1 24VDC Power Supply . (1) 1796-SIM1200 Input Simulator . (1) 1761-CBL-PM02 Serial cable (9-pin female to 8-pin mini-din) . (1) 1791D-8B8P Compact Block I/O - 8 Inputs/8 Outputs (Not used in this lab) MicroLogix 1500: . (1) 1764-L28BXB MicroLogix 1500 . (1) 1764-LRP Dual serial port MicroLogix 1500 processor . (1) 1764-DAT Data Access Terminal . (1) 1764-SIM1500 Input Simulator . (1) 1769-IQ6X0W4/A 24V DC Sink/Source Input, AC/DC Relay Output (Not used in this lab) . (1) 1769-IF4XOF2 4 Channel Current/Voltage Analog Input (Not used in this lab) . (1) 1769-SDN DeviceNet Scanner module (Not used in this lab) . (1) 1769-PA2 Power supply . (1) 1769-ECR Right end cap . (1) 1761-CBL-PM02 Serial cable (9-pin female to 8-pin mini-din) Software This hands-on lab uses the following software: . RSLogix 500 programming software . RSLinx Files No pre-configured files are required for this lab.
Basics of PLCs Hands-on Lab
4/29/2018 Page 6 of 48 Document Conventions
Throughout this workbook, we have used the following conventions to help guide you through the lab materials. This style or symbol: Indicates: Words shown in bold italics (e.g., Any item or button that you must click on, or a menu name from RSLogix 500 or OK) which you must choose an option or command. This will be an actual name of an item that you see on your screen or in an example. Words shown in Courier text, An item that you must type in the specified field. This is information enclosed in single quotes (e.g., that you must supply based on your application (e.g., a variable). 'Controller1') Note: When you type the text in the field, remember that you do not need to type the quotes; simply type the words that are contained within them (e.g., Controller1).
FYI The text that is displayed as shown is supplemental information regarding the lab materials; it is not information that is required reading in order for you to complete the lab exercises but may provide you with helpful hints that can make it easier for you to use this product.
Note: If the mouse button is not specified in the text, you should click on the left mouse button.
Basics of PLCs Hands-on Lab
4/29/2018 Page 7 of 48 Lab 1: Configuring the Computer to Communicate to the PLC
In this lab, we will introduce you to the RSLinx communications software. In this lab you will: . Start RSLinx . Auto-Configure an RSLinx RS-232 driver Launching RSLinx Communication Software and Configuring a Driver
RSLinx is the communication software that allows a PLC to communicate with your computer running RSLogix 500 software. We must first configure how we want our computer to communicate with our PLC.
1. From the Windows start menu select Start > Programs > Rockwell Software > RSLinx > RSLinx.
2. Once RSLinx starts, from the toolbar menu select Communications > Configure Drivers as shown below:
3. When the Configure Drivers window appears, from the Available Driver Types pull-down menu, choose the first one on the list which is RS-232 DF1 and then click the Add New button.
Basics of PLCs Hands-on Lab
4/29/2018 Page 8 of 48 4. When the following screen appears, click on OK to accept the default name.
This will launch the configuration screen for communications. There is a lot of information here, and this can appear confusing, however a great feature of RSLinx is that it can automatically configure all parameters for you (assuming that you are already connected to your controller).
5. Simply click on the AutoConfig button.
6. Verify that your Auto Configuration was successful as shown below:
This indicates that RSLinx has successfully tested and verified your communications. If Auto- Configure is not successful, verify that the communications cable from your computer (PC) is properly connected to your PLC and try the Auto-Configure again.
7. Click OK to close the Driver Configuration window. 8. Click Close to close the Configure Drivers window.
Basics of PLCs Hands-on Lab
4/29/2018 Page 9 of 48 We have completed configuring our communications driver and will not have to do this again on this computer. 9. Minimize (but do not close) RSLinx by clicking on the in the upper right corner of the RSLinx window.
Basics of PLCs Hands-on Lab
4/29/2018 Page 10 of 48 Lab 2: Creating a New Project
About This Lab
In this lab, we will introduce you to the basics of programming a PLC using controllers from the MicroLogix product family. In this lab you will: . Create a new project . Write 3 rungs of ladder logic to start and stop a simulated motor . Save your project to the hard drive of the PC . Download this project to the MicroLogix controller at your lab station . Monitor and Test your program on-line with the MicroLogix controller About MicroLogix Controllers
MicroLogix Based on the architecture of the market-leading SLC 500 controller family, the MicroLogix family of programmable controllers provides 3 levels of control. Small on size, big on performance, the MicroLogix 1000 offers control capabilities in an affordable, compact package. The MicroLogix 1200 is small enough to fit in tight spaces, but powerful enough to accommodate a broad range of applications. Designed to grow as your needs grow, the MicroLogix 1500 helps you achieve high- level control in a variety of applications. These small controllers bring high speed, powerful instructions and flexible communications to applications that demand compact, cost-effective solutions.
MicroLogix controllers are utilized in a very wide range of applications, from small high-speed stand alone controllers for local control, to network integrated clusters of controllers providing system- level solutions, and even remote terminal units that combine local control and data collection with master controllers that oversee complex architectures. These small controllers pack in a lot of high end features, such as: . Fast processing speed, with typical program scan of 1 to 3 msec per 1K User Program . Embedded high-speed inputs and outputs for: o High-speed counters for fast material handling applications o Latching & pulse catch inputs to detect transient pulses independent of program scan o I/O interrupts for real-time event processing o High-speed PTO (pulse train outputs) or PWM (pulse width modulated outputs) for low cost stepper or servo motor control, and heater element control o Adjustable filters to balance speed and environmental noise immunity . Expansion I/O (available on the MicroLogix 1200 and MicroLogix 1500 only) o Allows a controller to initially expand, and adapt over time o Provides the flexibility to mix different I/O types to match the needs of the application o Allows the controller to address I/O modules located remotely from the controller . Multiple protocol options to integrate into existing control environments or to establish efficient controller to controller or system wide communication networks
Basics of PLCs Hands-on Lab
4/29/2018 Page 11 of 48 . World-class programming software: RSLogix 500 o And ease of use features such as the Hand-held programmer (MicroLogix 1000 only), trim pots (MicroLogix 1200 and 1500 only), remove and insert under power memory modules (MicroLogix 1200 and 1500 only), and the Data Access Tool (MicroLogix 1500 only).
Launching RSLogix 500 Programming Software
In this section of the lab, you will launch the RSLogix 500 software, which will allow you to program your MicroLogix controller.
1. From the Windows start menu, select Start > Programs > Rockwell Software > RSLogix 500 English > RSLogix 500 English as shown below:
Creating a New Controller Project
In this portion of the lab, you will create an offline program for your MicroLogix controller.
1. Identify which MicroLogix controller is at your lab station by examining the front of the controller (you will see either the MicroLogix 1200, or MicroLogix 1500).
2. Maximize RSLogix 500 by clicking the maximize Icon in the upper right hand corner of the RSLogix 500 window.
3. From the toolbar menu, select File > New to create a new controller file.
Basics of PLCs Hands-on Lab
4/29/2018 Page 12 of 48 4. Enter the Processor Name as ‘M-LAB1’ as shown below.
5. Using the down arrow, select the MicroLogix controller found at your lab workstation. If your lab station has a MicroLogix 1200 select as shown below:
If your lab station has a MicroLogix 1500 select as shown below:
Basics of PLCs Hands-on Lab
4/29/2018 Page 13 of 48 6. Once you have selected your controller click OK.
7. From the toolbar menu, select File > Save As and enter ‘M-Lab1’ in the File name box and then click Save as shown below.
Basics of PLCs Hands-on Lab
4/29/2018 Page 14 of 48 8. If the following prompt appears, click Yes to replace the file.
Examining Your New RSLogix 500 Project
In this section of the lab, you will use the following display to review the RSLogix 500 programming environment.
A: Project Viewer . Controller information/setup = Series Revision, Configuration Information . Program Files - Where ladder logic is entered . Data Files - Where data values are stored . Force Files - Where you can override the state of the I/O with a “forced” value, so an input that is turned on by an external sensor may be forced off even when the sensor is turned on. Or a relay output may be forced on, even when the program running in the controller did not turn it on. . Custom Data Monitors = User Configurable Data monitor registers, which allows a user to manipulate user program information (beyond the scope of this course) B: Program Viewer . Where Programs reside . Where ladder logic is entered C: Program “TABS” . When a program file is open a “TAB” is created
Basics of PLCs Hands-on Lab
4/29/2018 Page 15 of 48 . Allows easy/quick access to program file content D: Instruction Buttons . Drag & Drop, or Double Click . Must have “Program Viewer” Active E: Tabbed Toolbar . Instructions grouped by function. . Floating Toolbar Support
Assigning I/O modules
Before we can start writing our first ladder logic program we must first tell the software all the modules that are connected to the controller. You could do this manually and add each module separately, but RSLogix 500 software allows us to perform a “Read I/O configuration” and automatically configures our I/O saving us time identifying and manually adding each module.
We will not actually be using any expansion I/O modules in this lab however we still must properly configure our controllers for the actual hardware we have.
1. From the project tree, double-click on the I/O Configuration. This will open the I/O configuration screen.
2. When the I/O Configuration window appears, click on Read IO Config. This will cause the RSLogix 500 software to request information on the I/O modules connected to the controller.
Basics of PLCs Hands-on Lab
4/29/2018 Page 16 of 48 Note: The expansion I/O screen shown above is for the MicroLogix 1500 lab station. Depending on the type of controller at your lab station the I/O configuration window will appear differently since different controllers will use different expansion I/O modules.
3. Select the AB_DF1-1 driver as shown below and then click Read IO Config.
Basics of PLCs Hands-on Lab
4/29/2018 Page 17 of 48 The Read IO window will disappear and one of the following updated I/O configuration windows will appear as shown below for the appropriate hardware found at your lab station. MicroLogix 1200
MicroLogix 1500
4. After you have finished viewing the I/O configuration window click on the ‘x’ in the upper right corner of the window to close.
Basics of PLCs Hands-on Lab
4/29/2018 Page 18 of 48 Creating the First Rung of Ladder Logic
1. Verify that the ladder editor in RSLogix 500 is active by clicking in the white space below:
2. Click on the User tab.
Basics of PLCs Hands-on Lab
4/29/2018 Page 19 of 48 3. Locate the New Rung button.
4. Click and hold the New Rung with the left mouse button and drag the icon to rung zero (0000).
5. When you see the green X on rung zero release the left mouse button.
Rungs can be thought of as the means to get “current” from the left rail to the right rail. In simple relay ladder diagrams, wires did exactly that.
5. Verify that your RSLogix 500 program window should now appear as shown below.
The lower case ‘e’ to the left of the ladder logic indicates that the rung is in edit mode.
Our empty rung represents a “dead short”, so we need to add the conditions that define when we want “current to flow”, or actions to take place. We will start by adding an input instruction to our blank ladder rung. An input instruction gives the controller information that it interprets as the “cause” component of “cause and effect”. Given the proper inputs (“causes”) the controller will generate specific outputs (“effects”).
6. Click on the Bit tab to show the bit level instructions.
7. Click on the XIC instruction and again drag the instruction to your new rung.
8. When you see the green X, release the mouse button. The XIC instruction eXamines if an Input is Closed (a.k.a. a normally open contact).
Basics of PLCs Hands-on Lab
4/29/2018 Page 20 of 48 We now need to provide an address for our new XIC input. The address tells the ladder logic where to look for the input. PLCs use addressing where Relay Logic (or hard-wired logic) used the physical connection of wires to make a circuit.
9. Make sure the instruction is highlighted and type ‘I:0/0’ and press Enter.
10. When the description window appears, enter the description as shown below and click on OK.
Adding a description is not required; however, it is good practice for program documentation and for future troubleshooting. This will allow you to later “read” your program, and understand it much more easily.
11. Verify that your ladder rung appears as follows:
Basics of PLCs Hands-on Lab
4/29/2018 Page 21 of 48 Now let us add an output instruction to this rung. This represents the “effect”, as discussed earlier.
12. From the Bit tab, click and drag an OutpuT Energize OTE instruction to the rung as shown below. As before, when you see the green X release the mouse button.
Again we need to provide an address for our new OTE output.
13. Make sure the instruction is highlighted and type ’O:0/0’ and press Enter. Note: There is a difference between the letter “O” (which stands for Output), and the number “0”.
14. Enter a description as shown below and then click on OK.
Basics of PLCs Hands-on Lab
4/29/2018 Page 22 of 48 15. Verify that your ladder rung appears as follows:
If your addresses do not look the same, make sure that you are properly using the letter “O” and the number “0”. Congratulations you have just created your first rung of ladder logic! When the conditions on the input (left) side of a rung are met, the instruction on the output (right) side of the rung will be executed. In this case, the OTE instruction will be executed whenever the XIC instruction is evaluated as “true”. In other words, when the input (Input Switch 0) is closed or turned on at address I:0/0 the result will be the output (Output 0 on the controller) will be turned on at address O:0/0.
The inputs and outputs in your ladder logic can be physical, real outputs like the relay output shown above, or can be virtual or a bit stored in the data table. You use physical outputs for controlling external devices but you may want to create virtual outputs to identify when something turns on or off for others parts of your ladder logic program.
Creating the second ladder logic rung
We need to start a new rung. So let’s insert a new rung into our program. You can do this either by the method we used in the previous section (Click/Drag) or you can try another method:
1. Select rung 1 (0001) and simply press the Insert key on your keyboard. You will now see a new empty rung in your ladder logic program as shown below.
Basics of PLCs Hands-on Lab
4/29/2018 Page 23 of 48 Let’s add the first input instruction to this new rung just as you did in the previous section.
2. Click and Drag an XIO instruction to rung 1 until you see the green X, then release your mouse button. The XIO instruction eXamines if an Input is Open (a.k.a. a normally closed contact).
3. With the newly added XIO highlighted, enter the address ‘I:0/1’ and press Enter.
4. Add a description as shown below and click OK.
Basics of PLCs Hands-on Lab
4/29/2018 Page 24 of 48 When finished, your rung should appear as follows:
Let’s add a second input instruction on rung 1.
5. Click and drag an XIC instruction (eXamine If Closed) down to rung 1, to the right of our XIO instruction, until you see the green X, then release your mouse button.
6. Using what you learned in the previous steps, address this new instruction as ‘I:0/2’ and add a description of ‘StartButton’. When finished your rung should now look like this.
Basics of PLCs Hands-on Lab
4/29/2018 Page 25 of 48 Putting serial conditions on the rung allows us to look for “AND” conditions. In this case we are asking if the Stop Button is not pressed AND the Start Button is pressed. Both conditions have to be “true” for the rung to be “true”.
7. Add an OTE instruction (OutpuT Energize) to rung 1 and address it as ‘O:0/1’.
8. Add a description of ‘Motor1’ so that your rung appears as follows:
Now let’s add a Branch to rung 1.
Branches allow for “either / or” programming. For example, we would use branched rungs if we wanted to indicate that either Pushbutton 1 or Pushbutton 2 could be used to turn on an output.
9. Click on the User tab (to the left of the Bit tab) and then click and hold the left mouse button to drag the Rung Branch button in between the XIO (StopButton) and the XIC (StartButton) instructions on rung 1.
10. When you see the green X as shown below, release the mouse button.
Basics of PLCs Hands-on Lab
4/29/2018 Page 26 of 48 11. Verify that your rung appears as follows:
We must now identify what the “either / or” decision will be. To do this, we need to move the branch around our Start Button.
12. Click and hold on the right side of the branch leg. Drag the branch leg to the right side of the Start Button. When you see the green X release the mouse button.
Your rung should now appear as follows:
Basics of PLCs Hands-on Lab
4/29/2018 Page 27 of 48 We now need to add an input instruction on our branch.
13. Using what you learned in the previous steps, click and drag an XIC onto the new branch you just created and address the new XIC as ‘O:0/1’. Your rung should appear as follows:
You will notice you are entering the same address for this XIC instruction as the output address of your OTE instruction. This is the power of the PLC. What you have just accomplished is the PLC equivalent to auxiliary contacts on a motor starter that allow you to create a ‘Seal In’ circuit. By adding this branch with the OTE address the motor will now stay on when the start button is released, until the stop button is pressed.
Creating the third ladder logic rung
1. Using what you’ve learned so far, add another rung as shown below.
Basics of PLCs Hands-on Lab
4/29/2018 Page 28 of 48 Verifying your ladder logic program
Program validation or a verification, checks the program you have written for errors. After verification is completed the Results window will open and gives you information about mistakes or omissions that may have been found as your program logic was inspected by the software.
There are two types of program verification. The first one verifies the file you are currently working in and only this file. The second verifies all files (Main and Subroutines) for the project you created. Because our program only resides in File #2 we will use the first program verification method.
1. Click on the Verify File button as shown below:
When the verify has completed and no errors are found all program edit markers (the ‘e’ to the left of the ladder rungs) will disappear and no errors found will be displayed at the bottom of the RSLogix 500 software screen.
2. If no errors are identified in your logic program proceed to the next section Saving Your Work.
3. If you have errors in your logic program, those rungs containing the errors will still show the edit markers (the small “e” beside the rung number) as shown below:
4. From the toolbar menu, select View > Results, or simply press ALT+1 (this window may open automatically if program errors are found). The Verify Results window will appear as shown below:
RSLogix will take you directly to the errors in your program.
Basics of PLCs Hands-on Lab
4/29/2018 Page 29 of 48 5. Click on the error message in the Verify Results window and you will notice RSLogix 500 highlights the ladder rung and instruction that contains the error.
6. Go back through the previous lab and correct your error(s).
Common errors are using letters instead of numbers such as ( O instead of 0 )
7. After correcting your error(s) verify your file again.
8. Once all errors are fixed proceed to the next section Saving Your Work.
Saving your work
Your project is still not stored on your computer’s hard drive. Save your program to prevent your work from being lost.
1. Click on the Save button or from the toolbar menu select File > Save.
2. When the Revision Note box appears, click OK.
The revision note box will appear. RSLogix 500 software is automatically configured to allow you to enter notes on version changes of your program and back-up older versions of your program as you make changes. This allows you to quickly go back to an older version if you make a mistake. The number of revision copies is configurable and can be turned off if you do not desire to have this feature active.
Basics of PLCs Hands-on Lab
4/29/2018 Page 30 of 48 Lab3: Testing Your Ladder Logic
Downloading your ladder logic to the PLC
1. From the RSLogix 500 toolbar menu, select. Comms > System Comms.
2. Expand the AB_DF1,DH485 driver by clicking on the + sign in front of the driver.
3. Highlight the PLC at Node 01 as shown below:
What you will see displayed on your computer is the file name that is currently running in your lab station controller and not necessarily what is shown above. After we download our program the controller name will change to what we programmed in the previous steps.
Basics of PLCs Hands-on Lab
4/29/2018 Page 31 of 48 4. Click Download and click OK when the Revision Note window appears.
5. You will be asked to confirm the download click YES
6. You may then be prompted to replace the controllers communications settings with your new project settings. Click YES.
7. If the controller is currently in RUN mode and executing a program the following screen will appear asking to switch the controller to the PROGram mode to begin the download. Click YES.
The MicroLogix 1200 controller does not have a Mode Switch, so the software is the only way to change the controller’s operating mode from Run to Program. The MicroLogix 1500 controller has a mode switch and when in Remote Run/Prog mode (Mode Switch would be in the center position) the software is able to change the controllers mode. If the Mode Switch on a MicroLogix 1500 controller is in the Run position or the Program position, the software program will not be able to change the operating mode.
Basics of PLCs Hands-on Lab
4/29/2018 Page 32 of 48 You will see the download progress window appear as the download occurs.
8. If your controller was in the RUN mode prior to the download RSLogix 500 will ask if you wish to switch the controller back into the RUN mode. Click NO. We will manually switch into the RUN mode in a later step.
9. You will then be asked if you wish to Go Online with your controller. Click YES.
Changing the PLC from Program to Run mode
1. Click on the down arrow next to REMOTE PROG as shown below:
Notice there are three (3) Run selections for the PLC:
. Run scans the program and outputs are enabled . Test Continuous scans the program and the outputs are disabled . Test Single Scan performs one scan cycle with outputs disabled
2. Click Run.
Basics of PLCs Hands-on Lab
4/29/2018 Page 33 of 48 3. When asked “Are you sure you want to change processor mode to RUN?” click Yes.
Monitoring and testing your PLC ladder program
With the PLC in ‘Remote Run’, you can monitor or edit data within the controller. This allows you to make program debugging changes and change data variables while in the run mode.
When green bars are shown on either side of ladder logic elements this indicates ‘Logical Continuity’, which helps determine how the application is operating and is designed to help you in debugging your application ladder logic. In a relay logic model, this is the same as “current flowing”.
So now let’s examine your ladder logic in operation.
1. To test rung 0, enable (Turn On) input switch #0 on the input simulator and examine the front of your MicroLogix controller. Output #0 will turn ON and in your ladder program you see ‘InputSwitch0’ and ‘Output0’ highlight indicating that the input switch and output have been turned on. If you turn off ‘Inputswitch0’ then ‘Output0’ will turn off.
2. To test rung 1, toggle (ON then OFF) ‘StartButton’ or the third switch on the input simulator. Notice ‘StartButton’ and ‘Motor1’ on the MicroLogix controller turns on.
Note: Inputs and Outputs are numbered 0,1,2, etc. This means that address I:0/2 is actually the third toggle switch on the input simulator.
Even after you turn off ‘StartButton’ the motor continues to stay on. The logic decision between StartButton and Motor1 in our input circuit is an “OR”. If either the StartButton is pressed, OR the motor is running, the motor should run. This is a perfect example of a latching circuit also called a 3-wire control circuit. If you toggle ‘StopButton’ (The second switch) on the input simulator, you will see that ‘Motor1’ turns off.
Basics of PLCs Hands-on Lab
4/29/2018 Page 34 of 48 The two inputs on rung 2 are the outputs of rungs 0 and 1. ‘RunningPilotLight’ will energize (Turn On) when the two inputs are true. So in other words, the outputs from rung 0 and rung 1 must be ON or TRUE to turn on our ‘RunningPilotLight’. This is an example of “AND” ladder logic.
Basics of PLCs Hands-on Lab
4/29/2018 Page 35 of 48 Lab 4: Using Basic Instructions in Ladder Logic
We are now going to take your program from Lab #2, modify two rungs, and create some new program logic. We are also going to program a Timer and Counter.
We will then use these in our program to see how they can be used to provide unique control capabilities. The last thing we will do is program a Limit command. The limit command is one of several powerful comparison instructions available in these MicroLogix controllers.
Going off-line with the PLC
If you are Online with the MicroLogix you must go Offline to complete this process.
1. Click the down arrow by the green box that says REMOTE RUN.
2. Select Go Offline.
3. If asked to save changes click No.
Copy and Rename your previous ladder logic program
1. From the toolbar menu, select File > Save As to create a copy of your program.
2. Type the File name and Processor Name ‘M-LAB4’ as shown below and then click Save.
Basics of PLCs Hands-on Lab
4/29/2018 Page 36 of 48 Modifying your existing ladder logic program
First, let us add an XIO Instruction to rung 1.
1. Make sure the Program Window is active (the right window title bar is colored or highlighted). If not, click on the title bar to select this window.
2. Click on the User tab.
3. Click, hold the left mouse button and drag the XIO button in between the branch and the OTE (remember when you see a green box, release the mouse button).
4. With the instruction highlighted type ‘C5:0/DN’ and then press Enter. This is the address of the XIO (eXamine If Open) instruction.
5. When asked to enter a description, type ‘Counter done bit’ and press OK.
6. When finished, verify that your rung appears as shown below:
Now, let’s Modify the 1st XIC in rung 2.
7. Double-click on the first XIC instruction in rung 2. This will open the text edit box for the instruction.
8. Type ’T4:0/DN’ and press Enter. This will overwrite the existing address. This is one of the most powerful features of a microcontroller, the ability to change the operation of a program through software. To do the same thing in the relay logic realm, an electrician would have to disconnect the wire from a normally open contact (our Input Switch 0 from rung 0) and wire the “done” output of a timer. Besides avoiding the obvious potential for mis-wiring, the microcontroller has the benefit that the timer is already built in.
9. When asked to enter a description, type ‘Timer done bit’ and click OK.
10. Verify that your rung now appears as follows:
Basics of PLCs Hands-on Lab
4/29/2018 Page 37 of 48 Adding a timer to your ladder logic program
1. Click, hold and drag the New Rung button over “0003”.
2. Click, hold and Drag the XIC button onto the left side of the rung you just created.
3. With the instruction highlighted, type ‘O:0/1’ and Enter.
Notice as soon as you entered the address ‘O:0/1’ the description ‘Motor1” was automatically shown. Once an address has a description associated with it that description is carried throughout your ladder logic program.
Your rung should now look like this
Now let’s add the Timer Instruction.
4. Click on the Timer/Counter tab near the top of the RSLogix 500 software.
5. Click, hold and Drag the TON (Timer ON delay) button onto the right side of the rung you just created.
6. Enter the following parameters for the timer by double-clicking on each parameter in the Timer instruction: . Timer: ‘T4:0’ This is the address of the timer . Description: Motor On Off Timer . Time Base: ‘1.0’ This is the increment that the timer counts, 1 second per count . Preset: ‘10’ This is the value the timer must reach to be done . Accum: ‘0’ This is the elapsed time of the timer while counting Your rung should now look like this:
Basics of PLCs Hands-on Lab
4/29/2018 Page 38 of 48 Adding a counter to your ladder logic program
Using what you have learned so far add a new rung 4.
1. Add a XIC button onto the left side of the rung you just created.
2. With the instruction highlighted Type ‘O:0/1’ and then press Enter. Your rung should now look like this:
3. Click on the Timer/Counter tab and drag the CTU (CounT Up) button onto the right side of the rung you just created.
4. Enter the following parameters for the counter by double-clicking on each parameter in the Counter instruction: . Counter: ‘C5:0’ This is the address of the counter . Description: Motor On/Off Cycle Counter . Preset: ‘10’ This is the value the counter must reach to be done . Accum: ‘0’ This is the number of counts that the counter has recorded so far Your rung should now look like this:
Now we need to add an instruction so we can reset our counter.
5. Add a new rung (rung 5).
6. Add a XIC button onto the left side of the rung you just created.
7. Type ‘I:0/3’ and then press Enter.
8. Enter the description ‘Motor On/Off Counter Reset Switch’ and click OK.
9. Click on the Timer/Counter tab and drag the RES button onto the right side of the rung you just created (this instruction will allow us to reset our counter).
10. Type ‘C5:0’ and press Enter. Your rung should now appear as follows:
Basics of PLCs Hands-on Lab
4/29/2018 Page 39 of 48 The function of the RES or reset instruction in our program is to zero out the accumulator of our C5:0 counter.
Adding a Limit instruction to your ladder logic program
1. Add a new rung (rung 6).
2. Click on the Compare tab and drag the LIM (Limit instruction) button onto the left side of the rung you just created. (this instruction will allow us to compare the value of our timer against predetermined limits).
3. Enter the following parameters for the LIM by double-clicking on each parameter in the Limit instruction: . Low Limit: ‘1’ This is the low limit we will use for our comparison . Test: ‘T4:0.ACC’ This is the value we will be evaluating . High Limit: ‘7’ This is the high limit we will use for our comparison
NOTE: The LIMit instruction is true when the timer is between 1 and 7 seconds. The question marks will disappear when you save the program
Let’s now add an output instruction to our LIM rung.
4. Click on the Bit tab and drag the OTE button onto the right side of the LIM rung you just created.
5. Type ‘O:0/4’ and press Enter.
6. Following our good programming practices, label your new output address as follows:
Basics of PLCs Hands-on Lab
4/29/2018 Page 40 of 48 Your rung should now look like this:
Verifying your ladder logic program
Program validation or a verification, checks the program you have written for errors. After verification is completed the Results window will open and gives you information about mistakes or omissions that may have been found as your program logic was inspected by the software.
There are two types of program verification. The first one verifies the file you are currently working in and only this file. The second verifies all files (Main and Subroutines) for the project you created. Because our program only resides in File #2 we will use the first program verification method.
1. Click on the Verify File button as shown below:
When the verify has completed and no errors are found all program edit markers (the ‘e’ to the left of the ladder rungs) will disappear and no errors found will be displayed at the bottom of the RSLogix 500 software screen.
2. If no errors are identified in your logic program proceed to the next section Adding rung comments to your ladder logic program.
Basics of PLCs Hands-on Lab
4/29/2018 Page 41 of 48 3. Otherwise using the results window at the bottom of RSLogix 500 locate and correct your mistakes.
REMINDER: To find errors in your ladder logic, click on the error message in the ‘Verify results’ window, the error is then highlighted in the ladder window. Fix the error and then “Verify file” again.
Basics of PLCs Hands-on Lab
4/29/2018 Page 42 of 48 Adding rung comments to your ladder logic program
1. Right mouse on rung 6 and select Edit Comment.
2. Select File/Rung and type the description ‘While the timer accumulator is between 1 and 7 seconds, the LIMit instruction will turn output #4, the 'Motor Starting Pilot Light' ON..
3. Click OK to accept your changes.
Basics of PLCs Hands-on Lab
4/29/2018 Page 43 of 48 Rung Comments can be used to describe in detail the function of a rung of ladder logic. This is a good programming practice, and a great feature of RSLogix 500 programming software.
Your rung should now look like this:
Saving your work
1. Click on the Save button.
2. Click OK for Revision note box.
Basics of PLCs Hands-on Lab
4/29/2018 Page 44 of 48 Downloading the ladder logic program to the PLC
1. From the toolbar menu, select Comms > System Comms.
You will notice that there are three primary selections:
. Online establishes the path . Upload receive from the controller . Download sends to the controller
2. Highlight the device at Node 01 and then click Download.
3. Select OK in the Revision note window.
Note: The revision note feature can be disabled if desired by checking the box in the upper left corner.
Basics of PLCs Hands-on Lab
4/29/2018 Page 45 of 48 4. Select Yes to download over our ‘M-LAB1’ program that resides in the processor.
5. If the controller is currently in RUN mode and executing a program the following screen will appear asking to switch the controller to the PROGram mode to begin the download. Click YES.
You will see the download progress window appear as the download occurs.
6. If asked to change back to run mode click No.
7. Select Yes when asked to go online. This will allow you to monitor the program that you just downloaded into your MicroLogix controller.
8. Click on the down arrow next to REMOTE PROG.
9. Select Run and then click Yes when the following window appears.
Basics of PLCs Hands-on Lab
4/29/2018 Page 46 of 48 Monitoring and testing your ladder logic program
Using the switches and watching the lights does your program work the way you expect? Let’s examine your ladder logic in operation.
1. RUNG 0 Enable (Turn On) input switch #0 on the input simulator and examine the front of your MicroLogix controller. Output #0 will turn ON and in your ladder program you see ‘InputSwitch0’ and ‘Output0’ highlight indicating that the input switch and output have been turned on. If you turn off ‘InputSwitch0’ then ‘Output0’ will turn off.
2. RUNG 1 Watching your ladder logic carefully, Toggle (ON then OFF) ‘StartButton’ or the third switch on the input simulator. Notice ‘Motor1’ turns on. Also notice that on rung 3 the timer begins to time because its input condition ‘Output1’ has been turned on and the counter has incremented by one count. Even after you turn off ‘StartButton’ the motor continues to stay on and the timer continues to time. This is a perfect example of a latching circuit also called a 3-wire control circuit. Toggle ‘StopButton’ (The second switch) on the input simulator. You now see that ‘Motor1’ turns off and the timer stops timing.
3. RUNG 2 The two inputs on rung 2 are the T4:0 done bit and the output conditions of rung 1 (O:0/1). The output ‘RunningPilotLight’ is a condition of these two inputs. In order for our ‘Runningpilotlight’ to turn on the timer needs to time for 10 seconds and Motor1 must be on then output #3 will turn ON. So once the motor has been running for at least 10 seconds the Running Pilot Light will come on.
4. RUNG 3- In order for the TON (Timer On) to start timing ‘Motor1’ must be on. The Timer starts once the motor starts running up to speed.
Basics of PLCs Hands-on Lab
4/29/2018 Page 47 of 48 5. RUNG 4- Each time ‘Motor1’ is toggled from Off to On our counter C5:0 will count up by one. This will allow us to keep track of how many times our motor has been turned on, and schedule maintenance appropriately.
6. RUNG 5- When our counter reset switch is energized this will reset counter C5:0 back to 0 . When we perform maintenance on the motor, we can reset the counter to keep track of the next maintenance cycle.
7. RUNG 6- While the timer accumulator is between 1 and 7 seconds, the LIMit instruction will turn output #4 (‘Motor Starting Pilot Light’) ON. This gives us the indication that the motor is starting up, and then turns off to conserve the use of our pilot light.
CONGRATULATIONS YOU HAVE JUST COMPLETED
THE BASICS OF PLC’s HANDS ON LAB!
Basics of PLCs Hands-on Lab
4/29/2018 Page 48 of 48