Introduction to Programmable Logic Controllers SG
Short Description
Download Introduction to Programmable Logic Controllers SG...
Description
F ot or Fo R e r R vi e ep w ro O du nly ct , io n INTRODUCTION TO PROGRAMMABLE LOGIC CONTROLLERS
N
STUDENT GUIDE
Introduction to Programmable Logic Controllers
Table of Contents INTRODUCTION ............................................................................................................. 1 OBJECTIVES .................................................................................................................. 1
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
NUMBER THEORY ......................................................................................................... 2 Identifying the Base of a Number ............................................................................... 2 Positional Notation and the Decimal Numbering System ........................................... 3 The Binary Number System ....................................................................................... 4 Binary System Positional Notation........................................................................ 5 How to Convert a Number from Binary to Decimal ............................................... 5 How to Convert a Number from Decimal to Binary ............................................... 6 The Octal Number System ......................................................................................... 7 Octal System Positional Notation ......................................................................... 7 How to Convert a Number from Octal to Decimal ................................................. 8 How to Convert a Number from Decimal to Octal ................................................. 8 Conversions between Octal and Binary ................................................................ 9 How to Convert a Number from Octal to Binary.................................................... 9 How to Convert a Number from Binary to Octal.................................................. 10 The Hexadecimal System ........................................................................................ 11 Conversions between Hexadecimal and Binary ................................................. 12 How to Convert a Number from Hexadecimal to Binary ..................................... 12 How to Convert a Number from Binary to Hexadecimal ..................................... 13
N
INTRODUCTION TO THE PLC-5.................................................................................. 14 PLC-5 Hardware ...................................................................................................... 14 Equipment Chassis............................................................................................. 15 Power Supply Module ......................................................................................... 16 Processor Module............................................................................................... 17 Key Switch .................................................................................................... 20 Front Panel LEDs .......................................................................................... 20 Battery ........................................................................................................... 22 Processor Module DIP Switches ................................................................... 22 Memory Modules ........................................................................................... 24 Input Modules, Output Modules, and Field Wiring .............................................. 24 Input Modules................................................................................................ 24 Output Modules ............................................................................................. 28 Field Wiring ................................................................................................... 30 Remote I/O Adapter Module ............................................................................... 31 PLC-5 System Operation ......................................................................................... 33 Signal Flow Paths ............................................................................................... 35 Ladder Logic and I/O Control.............................................................................. 36 Remote I/O ......................................................................................................... 38 Linking Multiple Processors ................................................................................ 39
i
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
RSLOGIX 5 INTRODUCTION ....................................................................................... 40 Screen Layout and Organization ............................................................................. 41 Ladder Window................................................................................................... 42 Project Window................................................................................................... 44 Controller Folder ........................................................................................... 45 Program Files Folder ..................................................................................... 46 Data Files Folder ........................................................................................... 47 Results Window .................................................................................................. 53 Windows Toolbar ................................................................................................ 55 Standard Toolbar ................................................................................................ 56 Instruction Toolbar .............................................................................................. 57 On-Line Toolbar.................................................................................................. 58 Finding Help ............................................................................................................. 59 FILES, MEMORY AREAS, AND ADDRESSING ........................................................... 61 Memory Areas.......................................................................................................... 61 Program Memory Area ....................................................................................... 62 How to Create a New Program File ............................................................... 63 Data Memory Area ............................................................................................. 68 How to Create a New Data File ..................................................................... 70 Addressing ............................................................................................................... 75 Logical Addressing ............................................................................................. 75 Indexed Addressing ............................................................................................ 77 Indirect Addressing ............................................................................................. 78 Symbolic Addressing .......................................................................................... 81 How to Create or Edit a Symbolic Name for an Address ............................... 82 I/O Image Addressing ......................................................................................... 85 Chassis, Slots, I/O Racks, and Groups ......................................................... 86 Slot Addressing for I/O Transfer .................................................................... 88 Examples of I/O Image Addressing ............................................................... 92
N
USING RSLOGIX 5 ....................................................................................................... 93 Going On-Line with a Controller ............................................................................... 93 How to Go On-Line with a Controller .................................................................. 93 Uploading a Project from a PLC-5 ........................................................................... 98 How to Upload a Project ..................................................................................... 98 Saving a Project ..................................................................................................... 101 How to Save a Project ...................................................................................... 101 How to Change the Default Path where Projects are Saved ............................ 104 Downloading a Project to a PLC-5 ......................................................................... 106 How to Download a Project .............................................................................. 106 Editing Ladder Logic .............................................................................................. 112 Edit Zone Markers ............................................................................................ 112 Online Editing ................................................................................................... 113 Online Editing Restrictions .......................................................................... 114 How to Verify, Accept, Test, and Assemble Online Edits ............................ 114
ii
Introduction to Programmable Logic Controllers Offline Editing ................................................................................................... 125 How to Verify a Single Rung ....................................................................... 125 How to Verify a File or Project ..................................................................... 127 UNDO and REDO............................................................................................. 127 Inserting and Appending Rungs of Ladder Logic ................................................... 128 How to Insert a Rung ........................................................................................ 128 How to Append a Rung .................................................................................... 130 Branching ............................................................................................................... 132 How to Insert a Branch ..................................................................................... 132
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
PROGRAMMING WITH BIT INSTRUCTIONS ............................................................ 135 Selected Bit Instructions ........................................................................................ 135 Examine IF CLOSED (XIC) .............................................................................. 136 Examine IF OPEN (XIO) ................................................................................... 139 Output Enable Instruction (OTE) ...................................................................... 140 Output Latch (OTL)........................................................................................... 141 Output Unlatch (OTU) ....................................................................................... 141 Using Bit Instructions ............................................................................................. 142 How to Insert Bit Instructions into a Program ................................................... 143 How to Assign a Logical Address Directly at the Instruction ............................. 148 How to Drag and Drop a Logical Address from a Data File .............................. 153 How to Search for Unused Logical Addresses ................................................. 156
N
PROGRAMMING WITH TIMERS ................................................................................ 159 Timer Operation ..................................................................................................... 159 Timer Type ....................................................................................................... 159 Timer On-Delay (TON) ................................................................................ 160 Timer Off-Delay (TOF) ................................................................................ 161 Retentive Timer On-Delay (RTO) ................................................................ 161 Timer Address .................................................................................................. 162 Timer Preset Value ........................................................................................... 162 Timer Accumulator Value ................................................................................. 162 Timer Status Bits .............................................................................................. 163 Time Base ........................................................................................................ 163 Reset Timer/Counter Instruction (RES) ................................................................. 164 Using Timer Instructions ........................................................................................ 164 How to Insert a New Timer into a Program ....................................................... 164 How to Assign or Modify a Timer Address ........................................................ 167 How to Assign or Modify a Time Base and Preset............................................ 172 Changing the Time Base ............................................................................. 172 Changing the Timer Preset ......................................................................... 174 How to Program the Timer Status Bits ............................................................. 175 How to Reset the RTO Accumulator using the RES Instruction ....................... 179 PROGRAMMING WITH COUNTERS ......................................................................... 184 Counter Operation ................................................................................................. 184 Counter Type .................................................................................................... 184 iii
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Count Up Counter (CTU)............................................................................. 185 Count Down Counter (CTD) ........................................................................ 185 Counter Address............................................................................................... 186 Counter Preset Value ....................................................................................... 186 Counter Accumulator Value .............................................................................. 186 Counter Status Bits........................................................................................... 186 Using Counter Instructions ..................................................................................... 187 How to Insert a New Counter into a Program ................................................... 187 How to Assign or Modify a Counter Address .................................................... 190 How to Assign or Modify a Preset Value at the Instruction ............................... 193 How to Assign or Modify a Preset Value using the C5 Data File ...................... 195 How to Create an Up/Down Counter ................................................................ 198
N
TROUBLESHOOTING ................................................................................................ 199 Systematic Troubleshooting ................................................................................... 199 Clearing Processor Memory .................................................................................. 200 How to Clear Processor Memory ...................................................................... 201 Forcing I/O Bits ...................................................................................................... 204 How to Determine the Status of Forces in a Project ......................................... 206 How to Install and Remove a Force Using Popup Menus ................................ 208 How to Install and Remove a Force Using the Force Tables ............................ 214 Cross Referencing Instructions .............................................................................. 221 How to Open the Cross Reference Report ....................................................... 222 From the Ladder Window ............................................................................ 222 From the Project Window ............................................................................ 224 Data Table Monitoring............................................................................................ 227 How to Open a Data Table ............................................................................... 228 From the Ladder Window ............................................................................ 228 From the Project Window ............................................................................ 230 How to Change Values Using a Data Table ..................................................... 232 Searching ............................................................................................................... 234 How to Search using Popup Menus at an Instruction ....................................... 234 How to Search using Drop Down Menus from the Windows Toolbar ............... 237 Find ............................................................................................................. 238 Replace ....................................................................................................... 240 Go To .......................................................................................................... 241 How to Search Using the Standard Toolbar ..................................................... 244 Histograms ............................................................................................................. 248 How to Create a Histogram .............................................................................. 249
iv
Introduction to Programmable Logic Controllers
List of Figures
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 1: Equipment Chassis ....................................................................................... 15 Figure 2: Power Supply Module ................................................................................... 16 Figure 3: PLC 5/15 Processor Module ......................................................................... 19 Figure 4: Processor Module Switches .......................................................................... 23 Figure 5: 1771-IAD AC Input Module ........................................................................... 26 Figure 6: 1771-OAD AC Output Module ....................................................................... 29 Figure 7: Remote I/O Adapter Module.......................................................................... 31 Figure 8: Hypothetical Circuit ....................................................................................... 33 Figure 9: Hypothetical Circuit Controlled by PLC System ............................................ 34 Figure 10: Vat Control System ..................................................................................... 36 Figure 11 Hardwired Vat Control System ...................................................................... 36 Figure 12: PLC Vat Control System ............................................................................. 37 Figure 13: Hardwired System Changes........................................................................ 37 Figure 14: PLC System Changes ................................................................................. 38 Figure 15: RSLogix 5 Main Window ............................................................................. 41 Figure 16: Ladder Window ........................................................................................... 42 Figure 17: Ladder Window with Multiple Open Programs ............................................ 43 Figure 18: Renaming a Program .................................................................................. 43 Figure 19: Project Window ........................................................................................... 44 Figure 20: Controller Properties Popup Window .......................................................... 45 Figure 21: Expanded Program Files Folder.................................................................. 46 Figure 22: Expanded Data Files Folder ........................................................................ 47 Figure 23: Cross Reference Report Popup Window .................................................... 48 Figure 24: Output Image Data File Popup Window ...................................................... 49 Figure 25: Usage Popup Window ................................................................................. 50 Figure 26: Input Image Data File Popup Window ......................................................... 51 Figure 27: Timer Data File Popup Window................................................................... 52 Figure 28: Search Results Window .............................................................................. 53 Figure 29: Results Window Moved in Display .............................................................. 54 Figure 30: Windows Toolbar ........................................................................................ 55 Figure 31: Standard Toolbar ........................................................................................ 56 Figure 32: Tool Tip ....................................................................................................... 56 Figure 33: Instruction Toolbar ...................................................................................... 57 Figure 34: Detached Instruction Toolbar ...................................................................... 57 Figure 35: On-Line Toolbar .......................................................................................... 58 Figure 36: On-line/Off-line Drop Down Menu ............................................................... 58 Figure 37: Help Window ............................................................................................... 59 Figure 38: Help Drop Down Menu ................................................................................ 60 Figure 39: Program Area File Assignments .................................................................. 62 Figure 40: Program Files Popup Window ..................................................................... 63 Figure 41: Create Program File Popup Window ........................................................... 64 Figure 42: Completed Create Data File Popup Window ............................................... 65
v
Introduction to Programmable Logic Controllers New File in Program Files Folder ................................................................ 66 LAD 50 – SUBR-1 File Open for Editing in Ladder Window ........................ 67 Data Area File Assignments ........................................................................ 68 Popup Window for New Data File ............................................................... 70 Create Data File Popup Window ................................................................. 71 Data File Type Selection ............................................................................. 72 Completed Create Data File Popup Window ............................................... 73 New Integer Data File Created .................................................................... 74 File N100 – TEST Popup Window ............................................................... 75 Status Register S:24 ................................................................................... 77 Integer Register N7 ..................................................................................... 78 Integer Data Register N7 and Indirect Addressing ...................................... 79 User-Defined N100 Data File ...................................................................... 80 N100 Data File ............................................................................................ 81 Popup Window for Symbolic Name Entry.................................................... 82 Symbolic Name Entry .................................................................................. 83 Symbolic Name Entry Completed ............................................................... 83 Symbolic Name and Description in Ladder Logic ........................................ 84 I/O Address in Ladder Logic ........................................................................ 85 Data Files Folder ......................................................................................... 87 1-Slot Addressing ........................................................................................ 89 2-Slot Addressing ........................................................................................ 90 1/2-Slot Addressing ..................................................................................... 91 Sixteen Point I/O Modules ........................................................................... 92 Starting RSLogix 5 ...................................................................................... 94 Comms Drop Down Menu/WHO ACTIVE GO ONLINE Selection ............... 95 Communications Popup Window ................................................................ 96 RSLogix On-Line with a Controller .............................................................. 97 Starting RSLogix 5 ...................................................................................... 98 Comms Drop Down Menu/UPLOAD Selection............................................ 99 Going to Online Programming State Popup Window ................................ 100 Floppy Disk Icon from Standard Toolbar ................................................... 101 File Drop Down Menu/SAVE Selection ..................................................... 102 Revision Note Popup Window ................................................................... 103 Tools Drop Down Menu............................................................................. 104 System Options Popup Window ................................................................ 105 Set Directory Popup Window .................................................................... 106 Starting RSLogix 5 .................................................................................... 107 Open Folder Icon ...................................................................................... 107 Open/Import PLC5 Program Popup Window............................................. 108 Open Project in RSLogix Display .............................................................. 109 Comms Drop Down Menu ......................................................................... 110 RSLogix 5 Popup Window......................................................................... 111 Original Ladder Logic for Online Editing Example ..................................... 114 Popup Menu for Online Editing ................................................................. 115
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 43: Figure 44: Figure 45: Figure 46: Figure 47: Figure 48: Figure 49: Figure 50: Figure 51: Figure 52: Figure 53: Figure 54: Figure 55: Figure 56: Figure 57: Figure 58: Figure 59: Figure 60: Figure 61: Figure 62: Figure 63: Figure 64: Figure 65: Figure 66: Figure 67: Figure 68: Figure 69: Figure 70: Figure 71: Figure 72: Figure 73: Figure 74: Figure 75: Figure 76: Figure 77: Figure 78: Figure 79: Figure 80: Figure 81: Figure 82: Figure 83: Figure 84: Figure 85: Figure 86: Figure 87:
vi
Introduction to Programmable Logic Controllers
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 88: New Rung for Editing (Offline)................................................................... 116 Figure 89: OTE Logical Address Changed ................................................................. 117 Figure 90: Popup Menu for Verifying Rung Edits ....................................................... 118 Figure 91: Rung Verified ............................................................................................ 119 Figure 92: Popup Menu for Accepting Rung Edits ..................................................... 120 Figure 93: Rung Edits Accepted ................................................................................. 121 Figure 94: TEST EDITS Button from Online Editing Toolbar...................................... 122 Figure 95: Test Edits Confirmation Popup Window .................................................... 122 Figure 96: Test Edits Online Indication....................................................................... 123 Figure 97: Edits Assembled ....................................................................................... 124 Figure 98: Popup Window to Verify a Single Rung of Ladder Logic ........................... 125 Figure 99: Results Window ........................................................................................ 126 Figure 100: Verify File and Verify Project Icons ......................................................... 127 Figure 101: UNDO Button (Left Arrow) and REDO Button (Right Arrow) ................... 127 Figure 102: Popup Menu with Mouse Pointer over Rung Number ............................. 128 Figure 103: New Rung Inserted ................................................................................. 129 Figure 104: Popup Window with Mouse Pointer Over Rung Number ......................... 130 Figure 105: New Rung Appended .............................................................................. 131 Figure 106: Location for New Branch ......................................................................... 132 Figure 107: Rung Icon Under USER Tab of Instruction Toolbar ................................ 132 Figure 108: Insertion Points for the New Branch ........................................................ 133 Figure 109: New Branch Inserted ............................................................................... 133 Figure 110: Dragging the Branch to the Termination Point ........................................ 134 Figure 111: New Branch Terminated.......................................................................... 134 Figure 112: XIC Instructions ....................................................................................... 136 Figure 113: XIC Instruction and the Input Image Data Table ..................................... 137 Figure 114: XIC Instruction and the Bit Data Table .................................................... 138 Figure 115: XIO Instructions ....................................................................................... 139 Figure 116: Comparison of XIC and XIO .................................................................... 140 Figure 117: OTE Instruction ....................................................................................... 140 Figure 118: OTL Instruction........................................................................................ 141 Figure 119: OTU Instruction ....................................................................................... 141 Figure 120: Arrangement of Latch And Unlatch Instructions ...................................... 142 Figure 121: Bit Instruction Icons under BIT Tab of Instruction Toolbar ...................... 143 Figure 122: Insertion Points for XIC Instruction .......................................................... 144 Figure 123: XIC Instruction Inserted into Ladder Logic .............................................. 145 Figure 124: OTE Instruction on Instruction Toolbar .................................................... 145 Figure 125: Insertion Point for OTE Instruction .......................................................... 146 Figure 126: OTE Instruction Inserted into Ladder Logic ............................................. 147 Figure 127: XIC Instruction Selected for New Address .............................................. 148 Figure 128: Starting the Logical Address ................................................................... 149 Figure 129: Available Logical Addresses ................................................................... 150 Figure 130: Logical Address Selected ........................................................................ 151 Figure 131: Logical Address Assigned to XIC Instruction........................................... 152 Figure 132: B3 Data Table File Open ......................................................................... 153
vii
Introduction to Programmable Logic Controllers
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 133: Logical Address Targets.......................................................................... 154 Figure 134: Logical Address Assigned to OTE Instruction ......................................... 155 Figure 135: I1 Input Image Data Table File ................................................................ 156 Figure 136: Logical Address Usage ........................................................................... 157 Figure 137: XIC Logical Address Changed from B3:0/0 to I:010/0 ............................. 158 Figure 138: Timer On-Delay (TON) Instruction .......................................................... 160 Figure 139: Timer Off-Delay (TOF) Instruction ........................................................... 161 Figure 140: Retentive Timer On-Delay (RTO) Instruction .......................................... 161 Figure 141: Reset Timer/Counter (RES) Instruction ................................................... 164 Figure 142: Timer Instruction Icons under TIMER/COUNTER Tab of Instruction Toolbar ............................................................................................................................. 164 Figure 143: Insertion Point for RTO Instruction .......................................................... 165 Figure 144: RTO Instruction Inserted into Ladder Logic ............................................. 166 Figure 145: T4 Data File Popup Window.................................................................... 167 Figure 146: Timer Usage............................................................................................ 168 Figure 147: Unused Timer T4:61 ............................................................................... 169 Figure 148: “Timer” Field in RTO Instruction as the Logical Address Target.............. 170 Figure 149: Completed Logical Address Assignment ................................................. 171 Figure 150: Time Base Drop Down Menu .................................................................. 172 Figure 151: New Time Base Selected ........................................................................ 173 Figure 152: New Time Base Entered ......................................................................... 173 Figure 153: New Value Typed into “Preset” Field ....................................................... 174 Figure 154: New Preset Entered ................................................................................ 174 Figure 155: XIC Instruction Inserted into Ladder Logic .............................................. 175 Figure 156: T4 Data File Popup Window.................................................................... 176 Figure 157: Timer Address Located in Data File Popup Window ............................... 177 Figure 158: XIC Instruction as the Logical Address Target ........................................ 178 Figure 159: Logical Address Assignment Complete ................................................... 179 Figure 160: Timer Instruction Icons under TIMER/COUNTER Tab of Instruction Toolbar ............................................................................................................................. 179 Figure 161: Insertion Point for RES Instruction .......................................................... 180 Figure 162: RES Instruction Inserted into Ladder Logic ............................................. 181 Figure 163: Dialog Box for Logical Address Entry ...................................................... 181 Figure 164: Logical Address for the RES Instruction .................................................. 182 Figure 165: Symbolic Name/Comment Popup Window.............................................. 182 Figure 166: Comment and Symbolic Name Information ............................................. 183 Figure 167: Logical Address, Symbolic Address, and Comment ................................ 183 Figure 168: CTU Instruction ....................................................................................... 185 Figure 169: CTD Instruction ....................................................................................... 185 Figure 170: Counter Instruction Icons under TIMER/COUNTER Tab of Instruction Toolbar ................................................................................................................. 187 Figure 171: Insertion Point for CTU Instruction .......................................................... 188 Figure 172: CTU Instruction Inserted into Ladder Logic ............................................. 189 Figure 173: C5 Data File Popup Window ................................................................... 190 Figure 174: Counter Usage ........................................................................................ 191
viii
Introduction to Programmable Logic Controllers Dialog Box for Logical Address Entry ...................................................... 191 Instruction Type Popup Menu ................................................................. 192 Logical Address Popup Menu ................................................................. 192 Completed Logical Address Assignment ................................................. 193 “Preset” Field Open for Editing ................................................................ 193 New Value Typed into “Preset” Field ....................................................... 194 New Preset Entered ................................................................................ 194 C5 Data File Popup Window ................................................................... 195 Preset Field Open for Editing .................................................................. 196 New Preset Value Entered ...................................................................... 197 Count Up/Count Down Ladder Logic ....................................................... 198 On-Line Drop Down Menu....................................................................... 201 Change Mode Confirmation Popup Window ........................................... 201 Processor in Program Mode.................................................................... 202 Comms Drop Down Menu ....................................................................... 202 Clear Memory Confirmation Popup Window ........................................... 203 Force Table Positioning Diagram ............................................................ 205 Force Status Indications .......................................................................... 206 Forces Installed but Not Enabled ............................................................ 207 Forces Installed and Enabled .................................................................. 207 Popup Menu with Install Force Selections............................................... 208 Inputs Forced ON .................................................................................... 209 Drop Down Menu with Enable Force Selection ....................................... 209 Enable Forces Confirmation Popup Window ........................................... 210 Forces Enabled ....................................................................................... 210 Multiple Forces in Project ........................................................................ 211 Popup Menu with Remove Force Selections........................................... 212 Selected Force Removed ........................................................................ 213 Force Files in Project Window ................................................................. 214 O0 (Output Force File) Popup Window ................................................... 215 Output Address to Force ......................................................................... 216 Force Installed......................................................................................... 217 Enable Forces Confirmation Popup Window ........................................... 217 Force Enabled ......................................................................................... 218 Popup Menu with Remove Force Selections........................................... 219 Force Removed ....................................................................................... 220 Cross Reference Report – Sorted by Address ........................................ 221 Cross Reference Popup Window ............................................................ 222 Cross-Reference Report for Address Selected in Ladder Window .......... 223 Data Files Folder Open in Project Window.............................................. 224 Cross Reference Report Open ................................................................ 225 Address in Ladder Window Selected from Cross-Reference Report ....... 226 Data Table............................................................................................... 227 Data Table Popup Window...................................................................... 228 Data Table for Address Selected in Ladder Window ............................... 229
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 175: Figure 176: Figure 177: Figure 178: Figure 179: Figure 180: Figure 181: Figure 182: Figure 183: Figure 184: Figure 185: Figure 186: Figure 187: Figure 188: Figure 189: Figure 190: Figure 191: Figure 192: Figure 193: Figure 194: Figure 195: Figure 196: Figure 197: Figure 198: Figure 199: Figure 200: Figure 201: Figure 202: Figure 203: Figure 204: Figure 205: Figure 206: Figure 207: Figure 208: Figure 209: Figure 210: Figure 211: Figure 212: Figure 213: Figure 214: Figure 215: Figure 216: Figure 217: Figure 218: Figure 219:
ix
Introduction to Programmable Logic Controllers Data Files Folder Open in Project Window.............................................. 230 Data Table Open ..................................................................................... 231 N10 Data Table for Address N10:22 ....................................................... 232 New Value in Data Table......................................................................... 233 Value Changed through Data Table ........................................................ 233 Find All Popup Menu ............................................................................... 234 Search Results Window for O:011/16 ..................................................... 235 Going to an Instruction in the Ladder Logic from a Search Result .......... 236 Search Drop Down Menu ........................................................................ 237 Find Popup Window ................................................................................ 238 FIND ALL Search Results ....................................................................... 239 Replace Popup Window .......................................................................... 240 Go To Popup Window ............................................................................. 241 Go To Example ....................................................................................... 241 Address/Symbol Editor Popup Window ................................................... 242 Additional Options Available through Popup Menu ................................. 242 Search Results from Address/Symbol Editor .......................................... 243 Search Entry Box and FIND Buttons ....................................................... 244 Searching for TON Instruction ................................................................. 245 Result of FIND NEXT for TON Instruction ............................................... 246 Result of FIND ALL for TON Instruction .................................................. 247 Histogram ................................................................................................ 248 Comms Drop Down Menu ....................................................................... 249 Histogram Popup Window ....................................................................... 250 Entering Target Address ......................................................................... 251 Histogram Popup Menu........................................................................... 252 Histogram Properties Popup Window ..................................................... 253 Creating Histogram Trends ..................................................................... 254
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 220: Figure 221: Figure 222: Figure 223: Figure 224: Figure 225: Figure 226: Figure 227: Figure 228: Figure 229: Figure 230: Figure 231: Figure 232: Figure 233: Figure 234: Figure 235: Figure 236: Figure 237: Figure 238: Figure 239: Figure 240: Figure 241: Figure 242: Figure 243: Figure 244: Figure 245: Figure 246: Figure 247:
x
Introduction to Programmable Logic Controllers
List of Tables
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Table 1: Number System Bases ..................................................................................... 2 Table 2: Decimal and Binary Equivalents ....................................................................... 4 Table 3: Decimal to Binary Conversion .......................................................................... 6 Table 4: Decimal, Binary, and Octal Equivalents ........................................................... 7 Table 5: Decimal to Binary Conversion .......................................................................... 8 Table 6: Binary and Octal Equivalents ........................................................................... 9 Table 7: Octal to Binary Example ................................................................................... 9 Table 8: Binary to Octal Example ................................................................................. 10 Table 9: Decimal, Binary, and Octal Equivalents ......................................................... 11 Table 10: Hexadecimal to Binary Example................................................................... 12 Table 11: Binary to Hexadecimal Example................................................................... 13 Table 12: Power Supply Ratings .................................................................................. 17 Table 13: PLC-5 Processors ........................................................................................ 18 Table 14: AC and DC Input Modules ............................................................................ 25 Table 15: AC and DC Output Modules ......................................................................... 28 Table 16: Data Files ..................................................................................................... 47 Table 17: PLC-5 Default Data Files .............................................................................. 69 Table 18: PLC-5 User Defined Data File Types ........................................................... 69 Table 19: Logical Address Format ............................................................................... 76 Table 20: I/O Image Address Format ........................................................................... 85 Table 21: Data File Type Abbreviations ..................................................................... 231
xi
Introduction to Programmable Logic Controllers
PLC Basics INTRODUCTION This course provides information on PLC concepts, hardware, software, ladder logic functions (relay contacts, timers, counters). There are hands-on exercises for configuration and programming.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
OBJECTIVES Upon completion of this course, you will be able to perform the following:
N
1. Convert a number from one base to another. 2. Describe the major components of the PLC-5. 3. Explain the basic operation of a PLC-5 system. 4. Identify the major components of the RSLogix 5 main window. 5. Access the RSLogix 5 on-line help files. 6. Describe the organization of processor memory. 7. Describe hardware and software addressing. 8. Establish a communication link to the PLC. 9. Save, restore, and create program files. 10. Edit existing rungs of ladder logic. 11. Explain the operation of bit instructions 12. Use bit instructions in a program. 13. Explain the operation of timer instructions. 14. Use timer instructions in a program. 15. Explain the operation of counter instructions. 16. Use counter instructions in a program. 17. Clear processor memory. 18. Monitor the data tables. 19. Force bit instructions on and off. 20. Describe the operation of histograms. 21. Describe a basic systematic troubleshooting process.
1
Introduction to Programmable Logic Controllers
NUMBER THEORY
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The section introduces four commonly used systems for numbering: decimal, binary, octal, and hexadecimal. You are probably most familiar with the decimal system, as this the system of numbers we use every day. Programmable logic controllers (PLCs), however, do not understand the decimal system. PLCs, along with every other computer in the world, are based on two stable states. These two states are represented most effectively using the binary number system. The octal and hexadecimal systems, which are easily derived from the binary system, are convenient for representing strings of binary numbers. Octal numbering is especially important with Allen-Bradley products as much of the technical PLC documentation is based on this system.
IDENTIFYING THE BASE OF A NUMBER
A number is a symbol that represents a quantity. The base, or radix, of a number system identifies the number of unique symbols in that particular system. The base of the decimal system is ten because we use ten unique symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) to represent all of the numbers. A number system using three symbols (0, 1, and 2) would be base three. Remember to count zero as a symbol when determining the base of a number system. The base of a number system is indicated by a subscript at the end of the number. Table 1 illustrates some examples of different number system bases. Table 1: Number System Bases
Number
Base
Ten (decimal)
100100012
Two (binary)
23458
Eight (octal)
12FA416
Sixteen (hexadecimal)
N
125710
If you do not see a subscript at the end of a number, then the number is assumed to be base ten. This means that 34510 and 345 are equivalent base 10 numbers. Only numbers written in a base other than base ten must have a subscript.
2
Introduction to Programmable Logic Controllers You should also note that the highest value symbol used in a number system is always one less than the base of the system. In base ten, the symbol with the largest value is 9; in base 5, it is 4; and in base 2, it is 1. Base 16 (hexadecimal) is a little different. Base 16 uses 16 unique symbols to represent all of the numbers. Since we run out of unique number symbols after 9, the letters A through F are used to make up the rest of the symbols.
POSITIONAL NOTATION AND THE DECIMAL NUMBERING SYSTEM
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Positional notation is a system that describes the value of a number by the position of the symbol within the number. Each position is assigned a weight. The number in the rightmost position has the lowest weighted value. Weighted values increase as you move from right to left. In the decimal system, the weighted values are 1, 10, 100, 1000, and so on. Numerical quantities are determined by multiplying the digit in a particular position by the weighted value of the position, then summing the results. Positional notation is best described through an example. The number 687 (in base 10) is made up of three digits - 6, 8, and 7. The least significant digit (LSD) is 7, and its value is 7. The next significant digit is 8 and has a value of 80 (8 x 10). The 6 is the most significant digit (MSD) and has a value of 600 (6 x 100). The 7 occupies the ones position; the 8 occupies the 10’s position; and the 6 is in the 100’s position. Using scientific notation, the number 687 is written: (6 x 102) + (8 x 101) + (7 x 100) Which is equivalent to:
(6 x 100) + (8 x 10) + (7 x 1) = 600 + 80 + 7 = 687
What about a number like 67.832? We interpret this as:
N
(6 x 101)+(7 x 100)+(8 x 10-1)+(3 x 10-2)+(2 x 10-3) Which is equivalent to: (6 x 10)+(7 x 1)+(8 x 1/10)+(3 x 1/100)+(2 x 1/1000) = 60 + 7 + 0.8 + 0.03 + 0.002 = 67.832
3
Introduction to Programmable Logic Controllers THE BINARY NUMBER SYSTEM The binary system of numbering is based on two digits, 0 and 1. Therefore, the binary number system has a base of 2. The binary numbering system is ideal for use with all digital devices, which includes PLCs and computers. All digital devices operate using two different states: off and on. The binary numbers 0 and 1 correspond nicely to these states. Normally, 0 represents the “off” state of the digital device, and 1 represents the “on” state.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Counting in binary is performed the same way as counting in decimal. Binary numbers, however, can be quite lengthy because there are so few symbols available to represent all of the numbers. Table 2 compares the first 16 decimal numbers to their binary equivalents. Table 2: Decimal and Binary Equivalents
N
Decimal
Binary
0
0000
1
0001
2
0010
3
0011
4
0100
5
0101
6
0110
7
0111
8
1000
9
1001
10
1010
11
1011
12
1100
13
1101
14
1110
15
1111
4
Introduction to Programmable Logic Controllers Binary System Positional Notation The decimal system uses powers of 10 as weighted values of particular positions within a number. The binary system, however, uses powers of 2. The following illustrates binary system positional notation: 24 23 22 20 2-1 2-2 2-3 2-4 Where:
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
24 = 2 x 2 x 2 x 2 = 1610 23 = 2 x 2 x 2 = 810 22 = 2 x 2 = 410 21 = 2 = 210 20 = 110 2-1 = 1/2 = 0.510 2-2 = 1/(2 x 2)= 0.2510 2-3 = 1/(2 x 2 x 2)= 0.12510 2-4 = 1/(2 x 2 x 2 x 2)= 0.062510
How to Convert a Number from Binary to Decimal
Converting from base 2 (binary) to base 10 (decimal) is relatively easy. Just sum the weighted values of all positions where a 1 is present in the binary number. Example: Convert the binary number 1100112 to its decimal equivalent. 1100112 = (1 x 25) + (1 x 24) + (0 x 23) + (0 x 22) + (1 x 21) + (1 x 20) = (1 x 32) + (1 x 16) + 0 + 0 + (1 x 2) + (1 x 1) = 5110
Example: Convert the binary number 0.01012 to its decimal equivalent.
N
0.01012 = (0 x 20) + (0 x 2-1) + (1 x 2-2) + (0 x 2-3) + (1 x 2-4) = 0 + 1/4 + 0 + 1/16 = 0.312510
5
Introduction to Programmable Logic Controllers How to Convert a Number from Decimal to Binary Decimals are converted to another base by successively dividing the decimal by the desired base. You begin by dividing the decimal number by the base. The remainder of this step becomes the least significant (right-most) digit in the converted number. All of the remainders from the successive divisions, when placed together, become the converted number. Example: Convert 15110 to its binary equivalent.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Begin by dividing 151 by 2, and then successively divide the result of each step by 2. The remainders, when taken together, are the converted number. The steps of each successive division are shown in Table 3. Table 3: Decimal to Binary Conversion Division 151 / 2 75 / 2 37 / 2 18 / 2 9/2 4/2 2/2 1/2
Result 75 37 18 9 4 2 1 0
Remainder 1 1 1 0 1 0 0 1
We are finished with the successive divisions when we get 0 as the result. The remainders now become the converted decimal. The remainder from the first division is the least significant digit of the base 2 conversion. So: 15110 = 100101112
N
You can check your result by converting the binary number back to its decimal equivalent. 100101112 = (1 x 27) + (0 x 26) + (0 x 25) + (1 x 24) + (0 x 23) + (1 x 22) + (1 x 21) + (1 x 20) = 128 + 0 + 0 + 16 + 0 + 4 + 2 + 1 = 15110
6
Introduction to Programmable Logic Controllers THE OCTAL NUMBER SYSTEM The octal, or base 8 system of numbering is based on eight digits: 0, 1, 2, 3, 4, 5, 6, and 7. Allen-Bradley uses the octal number system extensively with all models of PLC. Table 4 compares a decimal number to its binary and octal equivalents.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Table 4: Decimal, Binary, and Octal Equivalents Decimal Binary Octal 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 10 9 1001 11 10 1010 12 11 1011 13 12 1100 14 13 1101 15 14 1110 16 15 1111 17
Octal System Positional Notation
The octal system uses powers of 8 as the positional notation weighted values. The following illustrates the octal system positional notation: 84 83 82 80 8-1 8-2 8-3 8-4 Where:
N
84 = 8 x 8 x 8 x 8 = 409610 83 = 8 x 8 x 8 = 51210 82 = 8 x 8 = 6410 81 = 8 = 810 80 = 110 8-1 = 1/8 = 0.12510 8-2 = 1/(8 x 8)= 0.01562510 8-3 = 1/(8 x 8 x 8)= 0.00195310 8-4 = 1/(8 x 8 x 8 x 8)= 0.00024410
7
Introduction to Programmable Logic Controllers How to Convert a Number from Octal to Decimal The same principles are used to convert octal to decimal as were used to convert binary to decimal. The only difference is that octal uses 8 for the base instead of the 2 used in binary. You must also multiply the weighted value of the position by the number occupying the position. Example: Convert the binary number 1428 to its decimal equivalent.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1428 =(1 x 82) + (4 x 81) + (2 x 80) = (1 x 64) + (4 x 8) + (2 x 1) = 9810
How to Convert a Number from Decimal to Octal
Decimals are converted to octal by successively dividing a decimal number by eight. The method is the same as was used to convert decimal to binary.
Example: Convert 14910 to its octal equivalent.
Table 5: Decimal to Binary Conversion Division 149 / 8 18 / 8 2/8
Result 18 2 0
Remainder 5 2 2
We are finished with the successive divisions when get 0 as the result. The remainders now become the converted decimal. The remainder from the first division is the least significant digit of the base 8 conversion. So:
N
14910 = 2258
You can check your result by converting the octal number back to its decimal equivalent. 2258 = (2 x 82) + (2 x 81) + (5 x 80) = 128 + 16 + 5 = 14910
8
Introduction to Programmable Logic Controllers Conversions between Octal and Binary Octal numbers can be represented using three binary digits. Table 6 illustrates octal numbers and their binary equivalents. Table 6: Binary and Octal Equivalents Octal
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
0 1 2 3 4 5 6 7
Binary 000 001 010 011 100 101 110 111
How to Convert a Number from Octal to Binary
Using the information in Table 6, locate the octal number in the table then read across to the binary equivalent. Write down the binary equivalent below the octal digit being converted. Convert each octal digit using the table. The binary equivalent then becomes the string of ones and zeros that were written down for each octal digit. Example: Convert 236538 to binary.
Use Table 6 and write the binary equivalent below each octal digit. illustrated in Table 7.
This is
Table 7: Octal to Binary Example
2 0
N
Octal Binary
1
0
3 0
1
1
6 1
1
0
5 1
0
1
3 0
1
1
The binary equivalent of 236528 is 0101001101010112.
9
Introduction to Programmable Logic Controllers How to Convert a Number from Binary to Octal You can use Table 6 to convert from binary to octal, but you have to separate the binary number into groups of three digits starting on the right side of the number. You then read the octal equivalent from the table for each group of three binary digits. Example: Convert 111001002 to octal.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Separate the binary number into groups of three digits beginning from the right side. Use Table 6 and write the octal equivalent below each group of three binary digits. This is illustrated in Table 8. Add leading zeros to the last group, as in this example, to complete a group having one or two digits. Table 8: Binary to Octal Example
Binary Octal
0 3
1
1
1 4
0
0
1 4
0
0
N
The octal equivalent of 111001002 is 3448.
10
Introduction to Programmable Logic Controllers THE HEXADECIMAL SYSTEM The hexadecimal, or base 16 system of numbering is based on sixteen digits. Since we run out of unique numbers after 9, the letters A through F are used to represent the remaining numbers in the base. Table 9 compares a decimal number to its binary, octal, and hexadecimal equivalents. Table 9: Decimal, Binary, and Octal Equivalents Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Octal
Hex
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 A B C D E F
N
0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17
11
Introduction to Programmable Logic Controllers Conversions between Hexadecimal and Binary Conversions between hexadecimal and binary are similar to octal/binary conversions in that you can use a table of equivalent values to perform the conversion. The only difference is that you need four binary digits to represent a hexadecimal digit instead of the three used with octal. The most difficult part of hexadecimal conversions is remembering that a letter represents a number. How to Convert a Number from Hexadecimal to Binary
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Using the information in Table 9, locate the hexadecimal number in the table then read across to the binary equivalent. Write down the binary equivalent below the hexadecimal digit being converted. Convert each hexadecimal digit using the table. The binary equivalent then becomes the string of ones and zeros that were written down for each hexadecimal digit. Example: Convert A5F16 to binary.
Use Table 9 and write the binary equivalent below each hexadecimal digit. This is illustrated in Table 10. Table 10: Hexadecimal to Binary Example
Hexadecimal Binary
A 1
0
1
0
5 0
1
0
1
F 1
1
1
1
N
The binary equivalent of A5F16 is 1010010111112.
12
Introduction to Programmable Logic Controllers How to Convert a Number from Binary to Hexadecimal You can use Table 9 to convert from binary to hexadecimal, but you have to separate the binary number into groups of four digits starting on the right side of the number. You then read the hexadecimal equivalent from the table for each group of four binary digits. Example: Convert 111001002 to hexadecimal.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Separate the binary number into groups of four digits beginning from the right side. Use Table 9 and write the hexadecimal equivalent below each group of four binary digits. This is illustrated in Table 11. Add leading zeros to the last group, if necessary, to complete a group of four digits. Table 11: Binary to Hexadecimal Example
Binary Hexadecimal
1 E
1
1
0
0 4
1
0
0
N
The hexadecimal equivalent of 111001002 is E416 .
13
Introduction to Programmable Logic Controllers
INTRODUCTION TO THE PLC-5 This section introduces the basic operation and organization of the PLC-5 programmable logic controller. Although this training specifically discusses the PLC-5, the concepts introduced in this text are applicable to most programmable logic controllers.
PLC-5 HARDWARE
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
A programmable logic controller (PLC) is a specialized type of computer designed for industrial automation and process control. The complexity of the operating environment defines the number of PLCs in the system. Simple applications may use only one PLC. However, multiple PLCs may be connected together via a common communication network in order to provide sophisticated control over complex operating environments. The PLC-5 is a family of PLCs manufactured by Allen-Bradley. The PLC-5 is a modular system, which provides flexibility in order to meet a wide range of possible applications. A basic PLC system consists of the following components: Equipment chassis Power supply Processor module I/O modules with field wiring Remote I/O adapter module
N
• • • • •
14
Introduction to Programmable Logic Controllers Equipment Chassis
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The equipment chassis is a single, compact enclosure that holds the programmable controller module, power supply, and I/O or specialty modules that make up the system. Modules are inserted into the chassis on plastic slots and plug into the back plane connections. Four different size chassis are available: 4-slot, 8-slot, 12-slot, and 16slot. This design provides for easy system expansion and module replacement. The left-most slot of the chassis accepts the controller module (or the remote I/O adapter if the chassis is being used as a remote I/O rack). An example of an equipment chassis is shown in Figure 1.
Figure 1: Equipment Chassis
N
The power supply jumper is used to set up the system for either an internal (in the same rack) power supply, or an external power supply. The configuration plug is moved to the left side when an internal power supply is used, and to the right side for an external power supply.
15
Introduction to Programmable Logic Controllers The back plane switch assembly consists of eight rocker switches that determine the chassis output operation in the event of a fault, the addressing mode of the chassis, and the operation of memory modules. Power Supply Module
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The purpose of the power supply is to supply and regulate the power to the modules in the PLC-5 equipment chassis. The power supply module can be installed in any slot in the chassis (except the processor slot on the left side of the chassis). A variety of power supply modules are available, each with different ratings for input and output voltages. An example of a power supply module is shown in Figure 2.
Figure 2: Power Supply Module
Power supply modules can be either a single or double slot design. A typical power supply module is the model 1771-P4. The 1771 designates that the power supply is compatible with the 1771 chassis. The P4 designator indicates the power supply rating. If the power supply is a single slot module, it will be designated with an “S” such as 1771-P4S.
16
Introduction to Programmable Logic Controllers The 1771-P4 power supply is a two slot module. It accepts 120 VAC, 60 Hz input and delivers 8A, 5VDC output to the chassis back plane. This power supply contains output over-voltage, under-voltage, and over-current protection to the I/O chassis and its modules. If one of these faults occur, the power supply will shutdown. You must turn the power supply off for 15 seconds to reset it. The power supply will also shutdown if the processor line voltage drops below 92 VAC and will restart the processor when line voltage increases to 97 VAC. This prevents the processor from operating when voltage is too low, and any resulting errors.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The operation, protection features, and external wiring connectors of the power supplies are essentially the same. Table 12 lists the ratings of the various slot power supplies commonly used with the PLC-5. Table 12: Power Supply Ratings
Power Supply Model 1771-P3S 1771-P4 1771 -P4S 1771-P4S1 1771-P5 1771-P6S 1771-P6S1
Input Power 120VAC/60Hz 120VAC/60Hz 120VAC/60Hz 100VAC/60Hz 24VDC 220VAC/60HZ 200VAC/60Hz
Output Power 3A/5VDC/38W 8A/5VDC/79W 8A/5VDC/60W 8A/5VDC/60W 8A/5VDC/72W 8A/5VDC/60W 8A/5VDC/60W
Processor Module
N
The processor module is a small, rack-mounted computer. The processor module does not have a keyboard, so you must connect some type of programming interface in order to monitor or direct the operation of the device. The programming interface is usually a laptop computer, although it can be a desktop computer connected over some distance to the controller through a communication network. In either case, the programming interface runs the RSLogix 5 software. The RSLogix 5 software allows you to create the programs (application software) that tell the controller module what to do. The application software resides in the processor’s memory. Although there are different types of application software that you can write for the PLC-5, the most common type is known as ladder logic. The ladder logic ultimately controls the machines and processes associated with the PLC. If the ladder logic does not operate correctly, then the machine or process being controlled by the PLC will not operate properly.
17
Introduction to Programmable Logic Controllers There are many types of processor modules in the Allen-Bradley PLC-5 family of controllers. Differences between the types of processors generally relate to I/O capacity, remote rack capability, memory, and scan time. Table 13 summarizes the capabilities of the several models of processors. Table 13: PLC-5 Processors Memory I/O I/O Racks Rack Communication (Words) Points (Maximum) Configuration Mode 6,000 256 4 4 local None 6,000 256 4 4 local Adapter 4 local/3 6,000 512 4 Scanner/Adapter remote 4 local/7 13,000 1024 8 Scanner/Adapter remote 4 local/15 48,000 2048 16 Scanner/Adapter remote 4 local/23 64,000 3072 24 Scanner/Adapter remote
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Processor Model 5/10 5/12 5/15
5/25 5/40
N
5/60
18
Introduction to Programmable Logic Controllers
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The processor module always occupies the left-most slot in the chassis. The processor requires 2.5 Amperes of current for operation and draws this power from the chassis back plane. All processor modules have essentially the same physical appearance and operate the same internally. Figure 3 illustrates the PLC 5/15 processor module as an example.
Figure 3: PLC 5/15 Processor Module
19
Introduction to Programmable Logic Controllers A 9-pin, D-shell connector labeled PEER COMM INTFC is the communication port between the processor and the programming device. This connection lets the programming device communicate with any device on the link. Once you connect the programming device to one processor, the device can communicate with each processor on the network. There are two communication ports on the processor module located directly below the D-shell connection. The upper connector, labeled PEER COMM INTFC, is for the peer communications link (Data Highway Plus). The lower terminal labeled REM I/O is the remote I/O connector.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Key Switch
The front-panel key switch has three positions for controlling the mode of processor operation. They are RUN, PROGRAM, and REMOTE. In the RUN mode, you can run the loaded program, force I/O, and save programs to a disk drive. In this mode you cannot: • • • •
Create or delete ladder or data files. Program on-line. Modify the size of a data file. Change mode of operation through the programming device.
In the PROGRAM mode, you can enter a program, modify ladder files, down load to an EEPROM module, and save or restore programs. In this mode, outputs are disabled, inputs are not updated, and the processor does not scan the program. In the REMOTE mode, you can change between remote program, remote test, and remote run modes through the programming device. Be aware that the outputs are disabled in Remote Test mode, even though the ladder logic executes. Note that you cannot create or delete ladder logic or data files while in the Remote Test mode. Front Panel LEDs
• • • • • •
N
The processor module has six LED status indicators. These are: COM (Communication Active) REM I/O (Remote I/O) ADPT (Adapter) BATT (Battery) PROC (Processor) FORCE
20
Introduction to Programmable Logic Controllers COM (Communication Active) LED The COM LED indicates the operation of the PLC-5 processor within the Peer Communication Link, and provides indication of communication faults. The Peer Communication Link allows the PLC-5 processor to communicate with other PLC-5 processors and with the industrial terminal. The maximum number of stations you can connect to the Peer Communications Link is 64. The status indications of the COM LED are as follows: Blinking Green: Processor transmitting/receiving on the communication link Steady Bright Red: Watchdog timer time out Steady Dull Red: Duplicate station address selected Off: No communication
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
• • • •
REM I/O (Remote I/O Active) LED
The REM I/O LED light indicates the operation of the remote I/O rack and provides indication of a remote I/O fault. The status indications of the REM I/O LED are as follows: • • • •
Steady Green: Active remote I/O link Steady Red: Remote I/O link fault Blinking Green/Red: Partial remote I/O link fault Off: No remote I/O selected
ADPT (Adapter) LED
The ADPT (adapter) LED indicates the mode of operation of the PLC-5 processor. The processor may operate in Adapter Mode or Scanner Mode.
• • • • •
N
When in the Adapter Mode, the PLC-5 processor communicates with a supervisory processor capable of remote I/O and it controls the I/O in its local chassis. In the Scanner Mode, the processor communicates with I/O in up to three remote I/O chassis and with its local I/O. The ADPT LED will be on when in adapter mode and off in scanner mode. The ADPT LED status indications are as follows: Steady Green: Active remote I/O link Steady Red: Duplicate station address selected Blinking Green: No communication with host processor Sporadic Green: Bad communication with host processor Off: Not in Adapter mode.
21
Introduction to Programmable Logic Controllers BATT (Battery) LED The BATT LED indicates the status of the battery. The LED is off if the battery is good and on if the battery is low. PROC (Processor) LED The PROC LED indicates the condition and program mode of operation within the processor. The PROC LED status indications are as follows: Steady Green: Run Mode. The program is running. Steady Red: Major Fault Off: Program Mode, Test Mode, or the processor is not receiving power. The program is not running.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
• • •
FORCE LED
The FORCE LED is amber. It indicates that a force exists within the processor. The FORCE LED is on steady when forces are installed and enabled, blinks when forces are installed but not enabled, and off when no forces are installed. Battery
The processor houses one AA lithium battery. If power is not applied to the processor module, the battery retains the processor memory for up to one year. The battery is held beneath a cover on the front of the processor module. The date the battery was installed should be written on the front of the module. Processor Module DIP Switches
N
The processor module is configured for operation through three groups of DIP switches. These switches, labeled SW1, SW2, and SW3, are located inside the processor module as illustrated in Figure 4.
22
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Introduction to Programmable Logic Controllers
Figure 4: Processor Module Switches
Switch assembly SW1 is an eight-switch assembly. It is used to determine the station number of the processor module when it is configured in a peer communications link (data highway plus). This switch assembly also configures the processor for scanner or adapter operation. Switch assembly SW2 is also an eight-switch assembly. It sets the number of words exchanged between the host processor and the PLC-5 processor when the PLC-5 processor is in adapter mode. The PLC 5/15 can transfer eight words between the host PLC-5 and the adapter module per scan. This switch assembly also establishes the beginning I/O group number assigned to the PLC-5 processor, and the I/O rack number of the processor module when it is in adapter mode.
N
Switch assembly SW3 is a four-switch assembly that connects a terminator across the line when the processor module is the last device in a peer communications link remote I/O link. The specific switch settings for this module are found in the processor technical bulletin.
23
Introduction to Programmable Logic Controllers Memory Modules Each processor module contains a base memory. This is usually an adequate level for most applications. However, due to system expansion and increased needs, additional memory may be required. These memory modules are installed into the memorymodule slot on the bottom of the processor module. There are three memory modules that may be added to the processor: EEPROM Module (1785-MJ) - Provides up to 6K words of nonvolatile memory backup.
•
CMOS RAM Module (1785-MR) - Provides 4K words of RAM memory in addition to the processor’s base memory.
•
CMOS RAM Module (1785-MS) - Provides 8K words of RAM memory in addition to the processor’s base memory.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
•
The EEPROM module may be used in any processor. The two CMOS RAMs are only available for use with the PLC 5/15 and 5/25 processors. Input Modules, Output Modules, and Field Wiring
Input modules accept input signals from field devices and condition them to meet the power requirements of the processor. Output modules accept the control signals from the processor and energize the designated output module point. Field wiring connects the modules to signaling or control devices in the facility. Input Modules
N
An input is any signal that supplies information to the programmable controller. The interface between all physical inputs and the controller is the input module. The input module receives the signal from the input device, transforms the signal to a format that is recognizable by the ladder logic, and then passes the information on to the controller through common connection in the equipment rack. Common types of input devices are push buttons, limit and proximity switches, control relays, sensors, and operator controls.
24
Introduction to Programmable Logic Controllers There are several types of input modules. Input modules are available in 8-point (8 input signal terminals), 16-point, and 32-point designs and accept AC or DC input signals. The type of input module selected for a particular application depends on the type of input signal. This includes analog inputs, digital inputs, and specialty modules for inputs from thermocouples, resistance-temperature devices, and encoders. Table 14 summarizes the rating characteristics of the various AC and DC input modules commonly used with the PLC-5. Table 14: AC and DC Input Modules Input Voltage Rating
Number of Input Points 8 16 8 8 16 32 8 16 8 8 16 8 16 8 8 32
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Model Number
1771-IA 1771-IAD 1771-IA2 1771-IB 1771-IBD 1771-IBN 1771-IC 1771-ICD 1771-IH 1771-IM 1771-IMD 1771-IN 1771-IND 1771-IQ 1771-IT 1771-IVN
92-138 VAC/VDC 77-138 VAC 92-138 VAC 10-27 VDC 10-30 VDC 10-30 VDC 42-56 VDC 20-60 VDC 24-50 VDC 184-276 VAC/VDC 184-250 VAC 12-28 VAC 10-30 VAC 5-30 VDC 10-27 VDC 10-30 VDC
N
A typical input module is the 1771-IAD. This number provides descriptive information about the module. The “1771” identifies the PLC-5 family and indicates that the module fits into a 1771-series universal chassis. The “I” indicates an input module, the “A” indicates an AC module, and the “D” indicates high density. A high-density module is a module with 16 or more points. This module converts sixteen individual 120VAC inputs to a logic level compatible with the processor. Typical field device inputs to this module are proximity switches, limit switches, and push buttons. The input signals are filtered within the module to limit the effects of voltage transients caused by contact bounce and electrical noise. This prevents false data input to the processor. The input circuits within the input module are optically isolated from the back plane of the chassis.
25
Introduction to Programmable Logic Controllers
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The power used to operate the logic circuitry within the input module is drawn from the chassis back plane. Each input module requires approximately 0.25 Amperes of current. Figure 5 illustrates the 1771-IAD module.
Figure 5: 1771-IAD AC Input Module
26
Introduction to Programmable Logic Controllers The 1771-IAD module occupies one slot in the universal chassis and can be placed in any location within the universal chassis except for the very first slot to the left, which is reserved for the processor. To install the module, slide it into the slotted track located within the chassis. To remove the module, pull outward on the tab located on the top of the module.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The field devices are wired to the terminal block on the front of the module. This terminal block is hinged on the bottom and connected to the universal chassis. This eases the removal and replacement of a module. Note that the first four terminals (A, B, C, D) are not used on input modules. The next sixteen terminals are numbered 00 through 17 (octal). The last terminal (E) is for the common ground connection. A hinged plastic cover protects the terminals. The input status indicators are located on the front of the module above the terminal strip. The status indicators show the condition of the module and its inputs. The green ACTIVE LED when the module is powered and the opto-isolator data paths are functioning properly. The remaining sixteen LEDs (00 to 17) illuminate red when the associated input has power present on the terminal.
N
The input module fault mode selection configuration plug is located on the top of the module. The purpose of this plug is to determine the status of the inputs to the processor during a module failure. The plug has two positions: “last-state” and “reset.” In the laststate position, the inputs to the processor from the module remain in the last known valid state when a failure is detected. In the reset position, the inputs are reset to the off position when a module failure occurs.
27
Introduction to Programmable Logic Controllers Output Modules An output from the programmable controller causes an external event to occur. The interface between the controller and a physical output is the output module. The output interface module interprets the control signals controller from the controller then outputs the signals that actually change the position of equipment or modify processes. Typical output devices include relays, solenoids, lamps, and system displays or monitors.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
There are several types of output modules. As with the input module, the type of output module depends on the application. Types of output modules include those for analog and digital signals, and linear position transducers. Table 15 summarizes the rating characteristics of the various AC and DC output modules commonly used with PLC-5. Table 15: AC and DC Output Modules
Model Number Output Voltage Rating 1771-OA 1771-OAD 1771-OB 1771-OBD 1771-OBN 1771-OC 1771-OM 1771-OMD 1771-ON 1771-OQ 1771-OVN 1771-OW 1771-OYL
92-138 VAC 10-138 VAC 10-27 VDC 10-60 VDC 10-30 VDC 42-53 VDC 184-276 VAC 184-250 VAC 20-30 VAC 24 VDC 10-30 VDC 24-138 VAC 0-24 VAC/VDC
Number of Output Points 8 16 8 16 32 8 8 16 8 8 32 8 8
N
A typical output module is the 1771-OAD. This number provides descriptive information about the module. The “1771” identifies the PLC-5 family and indicates that the module fits into a 1771-series universal chassis. The “O” indicates an output module, the “A” indicates AC module, and the “D” indicates high density. A high-density module is a module with 16 or more points. This module converts the signals from the processor in order to energize the 16 individual outputs associated with the module. The module outputs can accommodate a range of 12 to 120 VAC. Typical field device connections to the module are AC motor starters, solenoids, and indicators. The outputs of the module are fused by one 10 Ampere, 250V fuse to protect the module from damage in the event of a field device short circuit. The fuse is located on the left side of the module.
28
Introduction to Programmable Logic Controllers
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The power used to operate the logic circuitry within the output module is drawn from the chassis back plane. Each output module requires approximately 0.7 Ampere of current. Figure 6 illustrates the 1771-OAD module.
Figure 6: 1771-OAD AC Output Module
29
Introduction to Programmable Logic Controllers The 1771-OAD module occupies one slot and can be placed in any location within the chassis except for the very first slot to the left, which is reserved for the processor. The module is installed and removed in the same manner as its corresponding input module.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The field devices are wired to the terminal block on the front of the module. This terminal block is hinged on the bottom to allow easy module removal without removing the field device wiring. A hinged plastic cover protects the terminals. AC power is supplied to this module through the four terminals labeled L1. These four terminals should be jumpered together to prevent overstressing any single point. Power is supplied to all four points to protect from exceeding the total surge rating of the module. Field devices are connected to terminals 00 to 17 (octal). The connection paths are from the module to the field device to ground. The last terminal (L2) may or may not be used as a common ground with the field device. If it is not used, no connection to this point is necessary. The output status indicators operate in a manner similar to the input module. The ACTIVE LED indicates power to the output module and opto-isolation data path operation. The red output LEDs (00-17) indicate that the processor has commanded an output on. They do not indicate the presence of power on a given terminal. One additional indicator is present on the status panel. It is the FUSE indicator. When illuminated, it indicates that the output fuse has blown. The output module fault mode selection configuration plug is located on the bottom of the module. This plug determines the state of the outputs following a module failure. The possible plug positions are “last state” and “reset.” In the last-state position, the outputs will remain in the last known current state should a module failure occur. In the reset position, the outputs will reset to off following a module failure. The module configuration plug operates independently of the last-state switch on the I/O chassis back plane. The module plug position takes precedence when a module fault occurs. The I/O chassis back plane plug takes precedent if a rack fault occurs. Field Wiring
N
All inputs and outputs are connected to the programmable controller by field wiring. Field wiring is all wiring, junction boxes, and connectors used to connect the programmable controller to external devices. Field wiring completes the PLC-5 connections to the field devices.
30
Introduction to Programmable Logic Controllers Remote I/O Adapter Module The 1771-ASB Remote I/O Adapter module is an interface between remote racks and the processor module. Essentially, the remote I/O adapter takes the place of the processor module in the remote racks. The adapter communicates with the other I/O modules in the remote rack, and the processor module communicates with the adapter.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The adapter occupies one slot in the universal chassis and must be placed in the leftmost slot, just as with the processor module. The power to operate the module is drawn from the chassis back plane. The module requires 1.2 Amperes of current. Figure 7 illustrates the Remote I/O Adapter module.
Figure 7: Remote I/O Adapter Module
31
Introduction to Programmable Logic Controllers The terminal block on the front of the module is used for connection of external I/O communication cables and an optional chassis restart button. The module has built-in fault detection capabilities. If a fault should occur in a remote I/O chassis containing inputs, the inputs to the processor will remain in their last pre-fault state. As a result, when a fault occurs, the outputs in an un-faulted local or remote rack will remain in the last state ordered prior to the fault.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Two switch assemblies are located inside the 1771-ASB Remote I/O adapter module. These switches are labeled SW-1 and SW-2. They are used to set group numbers and rack numbers in both a complimentary and non-complimentary I/O configuration. The positioning procedures for these switches are contained in the equipment technical bulletin. The module has three status indicators. The ACTIVE indicator is green. When on, it indicates: that there is active communication between the processor and the adapter module, that DC power is on and supplying the entire I/O rack, and that the I/O adapter module is actively controlling the modules. When it is OFF it indicates there is no communication between the processor and the adapter module. When flashing it indicates that a communication link is established between the processor and the remote I/O adapter module, the processor is in the program or test mode, and the remote I/O adapter module is not actively controlling the I/O modules. The ADAPTER FAULT indicator is red. When on it indicates that the module is not operating properly, there is a fault, and that the I/O rack response is in the manner denoted by the last state switch (switch number one of the I/O chassis back plane switch assembly). When it is flashing, it shows that the processor restart lockout switch on the I/O chassis back plane switch assembly is on. Depress the I/O rack restart push button (if installed) to clear the restart lockout.
N
The I/O RACK FAULT indicator is red. When on, it indicates that a fault has been detected at the remote I/O adapter module on the logic side of the I/O modules.
32
Introduction to Programmable Logic Controllers PLC-5 SYSTEM OPERATION The major components of a PLC are the equipment chassis, processor module, input module, output module, and power supply. A programming terminal is used to program the processor, but it is not considered a major component because once the processor is programmed, the terminal may be disconnected. The operation of these major components is best illustrated by developing a hypothetical hardwired circuit, then implementing the same circuit using the major PLC components.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 8 illustrates the hypothetical circuit for this example. This circuit controls two different lamps. Switch 1 and Switch 2 are normally open push button switches. Lamp 1 illuminates when switch 1 is closed, and lamp 2 illuminates when switch 2 is closed.
N
Figure 8: Hypothetical Circuit
33
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 9 shows the same switches and lamps under the control of a PLC system. The push button switches connect to an input module in the PLC system instead of directly to the lamps. The lamps are connected to the output module. Notice also that the input module is indirectly connected to the output module via the processor.
Figure 9: Hypothetical Circuit Controlled by PLC System
N
The processor is programmed to connect Switch 1 to Lamp 1, and Switch 2 to Lamp 2 through software. This software is also known as ladder logic since it appears similar to a standard electrical ladder diagram. The processor is programmed using a terminal (laptop) connected to a communication port on the processor. The operation of the hardwired lamp system and the PLC-controlled system appear identical. When Switch 1 is closed, Lamp 1 lights, and when Switch 2 closes, Lamp 2 lights. The major differences between the two models relate to the signal flow paths.
34
Introduction to Programmable Logic Controllers Signal Flow Paths When a push button is pressed in the hardwired system, power moves from the voltage source through the switch to the lamp, and then to ground. Electrical power simply follows the wire conductors to the lamp. When the switch is opened, power is interrupted and the light goes out.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
In the PLC controlled system, power moves from the voltage source, through the switch, into the input module. The input module senses the presence of this voltage and in turn, sends a small signal voltage into the processor through the back plane connections to the equipment chassis. The voltage from the switch is isolated from the voltage signal that the module sends into the processor. This isolation is necessary since the fragile processor chip operates at very low voltage and current levels. The signal received by the processor is analyzed and interpreted by the ladder logic. The ladder logic generates a low-voltage output signal from the processor to the output module. This output signal not only contains the ON signal to the lamp, but also tells the output module to which terminal the lamp is connected to on the module. This allows the output module to discriminate between Lamp 1 and Lamp 2. An observer of both hardwired and PLC controlled systems would not notice any difference in the system operation. In both systems, Switch 1 controls Lamp 1, and Switch 2 controls Lamp 2.
N
The greatest advantage of a programmable logic controller becomes evident when a change is needed in the circuits previously discussed. For example, if you needed to change the circuits of a hardwired system to have Switch 1 control Lamp 2, and Switch 2 control Lamp 1, it would take several minutes to rewire them, and would involve exchanging the wires at the switches or the lamps. With a PLC, a simple editing operation can make these changes internal to the program. This eliminates the need for rewiring and this process takes only a fraction of the time required to change a hardwired system
35
Introduction to Programmable Logic Controllers Ladder Logic and I/O Control
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
A practical application demonstrating the flexibility of a PLC ladder program is illustrated in the next example. Figure 10 shows a vat containing a liquid. In this system, a motor is energized to rotate the stirrer and mix the contents of the vat when certain conditions of temperature and pressure are met.
Figure 10: Vat Control System
N
Figure 11 illustrates the hardwired method for vat control. In this example, a pressure switch and a temperature switch are hardwired in series. This means both switches must be energized at the same time before the motor will start. A manual override push button is also installed in order to bypass the temperature and pressure switches and start the motor on demand.
Figure 11 Hardwired Vat Control System
36
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 12 illustrates the vat control circuit implemented in PLC ladder logic. Notice that the three different inputs (pressure switch, temperature switch, and manual override) are represented by the contacts 000, 001, and 002, respectively. The actual pressure switch and the temperature switch would be hardwired to two different terminals on an input module. The manual override push button would be hardwired to a third input terminal. The motor, represented by the coil labeled 110, would be hardwired to a terminal on an output module.
Figure 12: PLC Vat Control System
N
It now becomes quite easy to change the operating logic in the PLC without physically moving a wire connection. Figure 13 shows how a traditional circuit would be reconnected in order to make temperature a critical path for the motor to work. As you can see, the wiring of the switch must be physically changed, which could involve extensive work depending on its location.
Figure 13: Hardwired System Changes
37
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 14 shows how the PLC ladder logic is reprogrammed to implement the same changes without ever touching a wire.
Figure 14: PLC System Changes
Remote I/O
Complex operating environments may require more input and output terminals than a single, fully populated equipment chassis can provide. When this is the case, additional racks of I/O modules may be connected to the processor. These additional racks are known as remote I/O because they are located remotely from the equipment chassis that contains the processor module. Note that any I/O modules that reside in the same chassis as the processor are known as resident I/O.
N
A remote I/O chassis consists of various input and output modules, a power supply, and an interface adapter. There is no processor module in the remote I/O rack. The interface adapter, which is installed in the left-most slot of the chassis in place of the processor, provides a serial communication link from the remote racks to the processor.
38
Introduction to Programmable Logic Controllers Individual racks are normally connected to the processor using a daisy chain or star configuration via one or two twisted-pair conductors or a single coaxial cable. The distance a remote rack can be placed away from the processor varies between manufacturers, but can be as much as two miles. Remote I/O offers tremendous savings on wiring materials and labor costs for large systems in which the field devices are in clusters at various spread-out locations. With the processor in a central area, only the communication link is brought back to the processor, instead of hundreds of field wires. Distributed I/O also offers the advantage of allowing subsystems to be installed and started up independently, as well as allowing maintenance on individual subsystems while others continue to operate.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Linking Multiple Processors
N
Data Highway Plus (DH+) is a communications network used to transfer information between multiple processors in a network. Each processor on the highway is assigned a unique address, which identifies the station on the network. Up to sixty-four (64) stations are allowed on a single data highway plus network, with station number assignments ranging from 08-778. Multiple processors may be connected in a daisy chain or, in a trunkline/dropline architecture.
39
Introduction to Programmable Logic Controllers
RSLOGIX 5 INTRODUCTION
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
This section introduces the RSLogix 5 software. RSLogix 5 operates using a Windowsbased environment. This section discusses the major components found in the main operating window of the software, and introduces several basic software functions.
40
Introduction to Programmable Logic Controllers SCREEN LAYOUT AND ORGANIZATION The RSLogix 5 main window is the interface between you and the PLC-5. The major components of the main window, shown in Figure 15, are as follows: Ladder window Project window Results window Windows toolbar Standard toolbar Instruction toolbar On-line toolbar
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
• • • • • • •
ONLINE TOOLBAR
WINDOWS TOOLBAR
STANDARD TOOLBAR
INSTRUCTION TOOLBAR
LADDER WINDOW
N
PROJECT WINDOW
RESULTS WINDOW
Figure 15: RSLogix 5 Main Window
41
Introduction to Programmable Logic Controllers Ladder Window
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The ladder window displays the ladder logic for the project that is open. This may be software that is actively running on a PLC-5 processor, or ladder logic that is under development off-line. The ladder window is shown in Figure 16.
N
Figure 16: Ladder Window
42
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
You can have more than one ladder program open at a time. Each open program is identified by a tab at the bottom of the window as shown in Figure 17. Just click on a tab to bring that program to the front on the display.
Figure 17: Ladder Window with Multiple Open Programs
N
Programs can be renamed by double-clicking the tab. This opens the Rename popup window shown in Figure 18. Type the new name in the “Name” field then click the OK button to change the name.
Figure 18: Renaming a Program
43
Introduction to Programmable Logic Controllers Project Window
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The project window, shown in Figure 19, contains a variety of files associated with the open project. The actual project files are stored in the various folders in the window. You can expand each folder to see the project files inside by clicking the small “+” (plus sign) located in the box to the left of the folder. A “-” (minus sign) to the left of the folder means that the folder is expanded to show the project files within.
N
Figure 19: Project Window
44
Introduction to Programmable Logic Controllers Controller Folder
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Controller folder contains the files for configuring communication between the controller and various system devices. The controller folder also allows you to define each equipment chassis in the system, along with the number and types of cards in each chassis. Double click a particular file to open a popup window containing the configuration options for that file. The Controller Properties popup window is shown in Figure 20 as an example.
N
Figure 20: Controller Properties Popup Window
45
Introduction to Programmable Logic Controllers Program Files Folder
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Program Files folder contains all of the ladder logic that makes up the project. An example of an expanded Program Files folder is shown in Figure 21. Since each controller can run a different project, the actual files in the Program Files folder may change depending on which controller is being examined.
Figure 21: Expanded Program Files Folder
The SYS 0 file is a system file that is automatically created by RSLogix for a new project. Other than adding a name and description, you cannot change SYS 0 file.
N
Although it is not shown, there is also a SYS 1 file that is automatically created by RSLogix. The SYS 1 file is a system file for programs written using Sequential Function Chart (SFC). You will not see the SYS 1 file until you create an SFC program. The other files in the Program Files folder are user-defined and contain the actual ladder logic that makes up the project. The number of files in the folder can vary depending on the application. RSLogix 5 allows you to create up to 997 individual program files for ladder logic. These program files are numbered LAD 2 through LAD 999. (Remember that 0 and 1 are system files). The fact that you can add program files helps to segment a large program into smaller pieces, such as subroutines, that are easier to isolate and troubleshoot. Ideally, the name that you give each file should describe the function performed by the ladder logic in that section of the program.
46
Introduction to Programmable Logic Controllers Data Files Folder
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Data Files folder contains information about instructions, I/O, and data used by the program files. An expanded Data Files folder is shown in Figure 22. A list of data file types is found in Table 16 following the figure.
Figure 22: Expanded Data Files Folder Table 16: Data Files
I1 S2 B3 T4 C5 R6 N7 F8 9 - 999
File Type
Output image table Input image table Status Bit or binary Timers Counters Control Integer Floating-point User assigned
N
File No. O0
Notes
Bits in this memory area control the status of all outputs. Bits in this memory area indicate the status of all inputs.
A processor configuration and status report. Binary (0 or 1) information. Timer information. Counter information. Used for advanced file instructions. Integer values in the range -32,768 to +32,767. Numbers containing a decimal point such as 5.6 or 6.2. User assigned file types as needed. Timers and counters may also use these file numbers.
47
Introduction to Programmable Logic Controllers Cross Reference Data File
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Cross Reference data file is a list of every instruction used in the main program and its associated subroutines. Double click on the Cross Reference icon in the Data Files folder to open the Cross Reference Report popup window, which is shown in Figure 23. The popup lists the address and type of each instruction in the project. The crossreference report is also useful because it shows you where the open addresses are in the event you need to insert an instruction. Double clicking a specific entry in the crossreference report closes the popup and places the cursor over that instruction in the program.
N
Figure 23: Cross Reference Report Popup Window
48
Introduction to Programmable Logic Controllers Output Image Data File (O0)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Output Image data file displays the status of all of the active and inactive outputs. These are physical outputs attached to the terminals of the output modules in the rack. Double click the O0 icon in the Data Files folder to open the Output Image Data File O0 popup window, which is shown in Figure 24. The display is arranged to show the 16 bits associated with each output word. A “1” in the display represents an active output at the address, and a “0” represents an inactive output.
N
Figure 24: Output Image Data File Popup Window
49
Introduction to Programmable Logic Controllers The Radix drop down menu changes the format of the displayed data between binary, octal, decimal, Hex/BCD, or ASCII. Input and Output image tables are best displayed in the binary format as shown in Figure 24.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The USAGE button on the popup window shows the user data memory locations that are actually used by the program. For instance, one word in a binary file has sixteen bits. Not all of these bits are necessarily used by the program. The Usage popup window, shown in Figure 25, identifies the used bits with an X. Unused bits are identified with a period (.). A description can be added to each bit to further identify the usage. Left click the DATA FILE button to return to the previous display.
Figure 25: Usage Popup Window
50
Introduction to Programmable Logic Controllers Input Image Data File (I1)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Input Image data file displays the status of all of the active and inactive inputs. These are physical inputs attached to the terminals of the input modules in the rack. Double click the I1 icon in the Data Files folder to open the Input Image Data File I1 popup window, which is shown in Figure 26. The display is arranged to show the 16 bits associated with each input word. A “1” in the display represents an active input at the address, and a “0” represents an inactive input.
N
Figure 26: Input Image Data File Popup Window
51
Introduction to Programmable Logic Controllers Timer Data File (T4)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Timer data file is a summary of all of the timers used in the program. Double click the T4 icon in the Data Files folder to open the Timer Data File T4 popup window, which is shown in Figure 27. Notice how the entries for timer T4:0 in the popup window correspond to the entries for the timer in the ladder logic. The popup window makes it easy to view the operation of multiple timers without actually having the ladder logic containing the timer in the active display.
N
Figure 27: Timer Data File Popup Window
52
Introduction to Programmable Logic Controllers Results Window
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Results window, which is usually located at the bottom of the screen, contains two tabs: Build and Search Results. The Search Results tab displays the results of searches for particular instructions. Searches are performed to find all of the instances of a specific instruction within a program. The instances are listed at the bottom of the screen in the results window under the Search Results tab. Clicking an entry in the Results window moves the cursor over that instruction in the ladder logic as shown in Figure 28.
N
Figure 28: Search Results Window
53
Introduction to Programmable Logic Controllers The Build tab of the results window displays errors that occurred after the file or project is verified. Types of errors include unknown instruction types, addressing errors, and user-defined label usage.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
You can detach the Results window from the bottom of the screen and move it anywhere in the display. This is illustrated in Figure 29. Move the mouse pointer to the outside border of the Results window, hold the left mouse button down then drag the mouse to where you would like to move the window. RSLogix will remember the position of the Results window if you close it without moving it back to the bottom of the screen. You can move the window back to its original position by dragging it below the ladder window before releasing the left mouse button.
Figure 29: Results Window Moved in Display
54
Introduction to Programmable Logic Controllers Windows Toolbar
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The Windows toolbar provides easy access to the global functions performed by RSLogix. The Windows toolbar, located at the top of the screen, is a series of drop down menus that operate in a manner identical to that of all Windows-based programs. Left clicking one of the menu items opens the respective drop down menu. The FILE drop down menu is shown in Figure 30 as an example of the options available through the Windows toolbar.
N
Figure 30: Windows Toolbar
55
Introduction to Programmable Logic Controllers Standard Toolbar The standard toolbar is the row of icons located directly below the Windows toolbar. The standard toolbar, shown in Figure 31, represents the functions of RSLogix used most frequently during programming or software manipulation.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 31: Standard Toolbar
Functions found on the standard toolbar allow you to do the following: • • • • • • • • •
Create a new project Open an existing project Save your work to disk Cut, copy and paste sections of ladder logic Undo and redo Search for instructions Verify a file or project Zoom in and out of the ladder logic display Open an instruction palette
N
Holding the cursor over an icon on the standard toolbar opens a small tool tip window that identifies the function of the icon. An example of a tool tip is shown in Figure 32.
Figure 32: Tool Tip
56
Introduction to Programmable Logic Controllers Instruction Toolbar The instruction toolbar contains all of the instructions supported by RSLogix 5. The instruction toolbar, shown in Figure 33, is located above the ladder window.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 33: Instruction Toolbar The instructions on the toolbar are grouped by function. The tabs below the actual instructions identify these functional groups. Clicking the tab displays the instructions within the group. The left and right arrow buttons allow you to scroll through the tabs and instructions that are not visible in the display. You use an instruction in your program by dragging it from the instruction toolbar with the mouse. First, locate the instruction under the appropriate tab then move the mouse pointer over the desired instruction. Hold the left mouse button down, drag the instruction to the point in the ladder logic where you want to use it, and then release the mouse button. The instruction will then be inserted into the ladder logic.
N
You may also detach the instruction toolbar and move it to another area of the screen. Just move the mouse pointer within the toolbar to a point above the row of instructions or below the row of tabs. Hold the left mouse button down then drag the toolbar to the new location. An example of a detached instruction toolbar is shown in Figure 34. Double click the mouse over the PLC5 Instructions title bar in the toolbar window to move it back to its original position over the ladder window.
Figure 34: Detached Instruction Toolbar
57
Introduction to Programmable Logic Controllers On-Line Toolbar
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The on-line toolbar allows you to change operational status of the processor, identify forces, determine the PLC node in communication with RSLogix, and identify the communications driver being used with the node. The on-line toolbar, shown in Figure 35, is located above project window in the RSLogix display.
Figure 35: On-Line Toolbar
The node number of the PLC is identified in the lower, right-hand corner of the toolbar. The node number can be either an octal or a decimal number. An octal format is identified by the lower case “o” at the end of the node number. The PLC is brought on-line with RSLogix or off-line using the drop down menu in the upper, left-hand corner of the toolbar as shown in Figure 36. Note that you must have the key switch on the processor in the REM position before you can change to PROGRAM mode using RSLogix.
N
Figure 36: On-line/Off-line Drop Down Menu
58
Introduction to Programmable Logic Controllers FINDING HELP
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
A variety of on-line help features is available through RSLogix. These help features cover all aspects of instruction usage, menu functions, and toolbar selections. The easiest way to access the on-line help is by pressing the F1 key on the keyboard. This opens a popup window with help information for whatever is active at the time. For example, if the cursor is over an instruction in the ladder window, pressing the F1 key opens a help window containing information for that specific instruction. This is illustrated in Figure 37. The cursor is over the XIC instruction in the ladder window. The topic discussed in the help window covers the XIC instruction.
Figure 37: Help Window
59
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
All help functions are available through the drop down menu under the Help selection of the Windows toolbar. The Help drop down menu is shown in Figure 38.
N
Figure 38: Help Drop Down Menu
60
Introduction to Programmable Logic Controllers
FILES, MEMORY AREAS, AND ADDRESSING Memory is the place in the PLC-5 processor where information is stored. There are two basic types of PLC-5 processor memory: program and data. The program area of memory holds the instructions that make up the ladder logic of the application. These are the program files of the project. The data area is generally used for temporary storage of information required by the project files. The project files use various methods of addressing to move information into and out of the data areas.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
MEMORY AREAS
N
Memory is an information storage area for the processor. Exactly what is stored and where it is stored depends on how the processor module was engineered. The important point here is that not all processors use memory in the same way. However, all PLC-5 processors have two basic memory areas: program and data.
61
Introduction to Programmable Logic Controllers Program Memory Area
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The program area of processor memory is where the ladder logic is stored. Ladder logic includes the main control program, subroutines, fault handling routines, and any processor input interrupts. The program area is also where the system files for the processor are stored. The PLC5/20 processor supports up to 16 main control programs. User-defined ladder logic files may be numbered from 2 to 999. Subroutines, fault routines, and interrupts are numbered from 3 to 999. These files appear in the Project Files folder of the Project window as shown in Figure 39.
Figure 39: Program Area File Assignments
62
Introduction to Programmable Logic Controllers How to Create a New Program File 1. Go off-line with the processor, or place the processor in the program mode. You will not be able to create a program data file if you are on-line with a processor.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Move the mouse pointer over the Program Files folder in the Project window and right-click the mouse. This opens the popup window shown in Figure 40.
N
Figure 40: Program Files Popup Window
63
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Left-click NEW from the popup window. This opens the Create Program File popup window shown in Figure 41.
Figure 41: Create Program File Popup Window
N
4. Type a number for the file in the “Number:” field. The number 50 is used as an example in this illustration.
64
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Enter a name for the new file and a description in the respective fields. A name can be up to 10 characters in length, and a description up to 50 characters. Remember that the file name and description should relate to the function of the software. Keep in mind that any documentation you associate with the file may be useful for troubleshooting problems at some future date. As an example, this ladder file is given the name “SUBR-1” with a description of “sample ladder file.” An example of the completed popup window is shown in Figure 42.
N
Figure 42: Completed Create Data File Popup Window
65
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
6. Select the OK button after you enter the name and description. This enters the new file with the assigned name in the Program Files folder as shown in Figure 43.
N
Figure 43: New File in Program Files Folder
66
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
7. Double click the “LAD 50 – SUBR-1” program file to open the file for programming. Notice the new file opens over anything you may already have open in the ladder window as shown in Figure 44. The name you entered for the file appears on the tab at the bottom of the ladder window, and the description you entered, as well as the name of the file, appear in the title bar the top of the ladder window.
N
Figure 44: LAD 50 – SUBR-1 File Open for Editing in Ladder Window
67
Introduction to Programmable Logic Controllers Data Memory Area
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The smallest storage location in processor memory is a bit. Eight bits are grouped together to form a byte. Sixteen bits (2 bytes) are grouped together to form a word. The Allen-Bradley PLC-5/40 processor has 48 K-words of data area memory space. This memory space is set aside for the requirements of the data table. The data table includes the input image, output image, bit, timer, counter, and other files in the Data Files folder of the Project window. An example of the files in the Data Files folder is shown in Figure 45.
Figure 45: Data Area File Assignments
68
Introduction to Programmable Logic Controllers Files with numbers zero through 8 are default files for the PLC-5. The letter and number designations for each data file relate to the type (format) of information that can be stored in the file as described in Table 17. Table 17: PLC-5 Default Data Files
I1 S2 B3 T4 C5 R6 N7 F8
File Type
Notes
Output Image Table Input Image Table Status Bit or binary Timers Counters Control Integer Floating-point
Bits in this memory area control the status of all outputs. Bits in this memory area indicate the status of all inputs. A processor configuration and status report. Binary (0 or 1) information. Timer information. Counter information. Used for advanced file instructions. Integer values in the range -32,768 to +32,767. Numbers containing a decimal point such as 5.6 or 6.2.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
File No. O0
Data files numbered 9 through 999 are user defined to contain a specific data type. The user defined data file types are listed in Table 18. Table 18: PLC-5 User Defined Data File Types
N
Identifier
B T C R N F A D BT
PD SC MG ST
File Type Bit or binary Timers Counters Control Integer Floating-point ASCII BCD/Hexadecimal Block Transfer Control PID Control SFC Status Message Control ASCII String
69
Introduction to Programmable Logic Controllers How to Create a New Data File You must first determine the format of the data that is going to be stored in the file. You then pick a new file type that is consistent with the format of this data. Assume for this example that additional space is required in memory to store integer data. Based on the information in Table 18, we are going to create a data file having an “N” identifier. This example creates an integer data file with a file number of 100. Note that this number assignment is arbitrary, but it must be in the range of 9 to 999, which are reserved for the user-defined files. Follow these steps to create a new data file, which, in this case, is identified as N100.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Go off-line with the processor, or place the processor in program mode. You will not be able to create a new data file if you are on-line with a processor.
N
2. Move the mouse pointer over the Data Files folder in the Project window and right-click the mouse. This opens the popup window shown in Figure 46.
Figure 46: Popup Window for New Data File
70
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Left-click NEW from the popup window. This opens the Create Data File popup window shown in Figure 47.
Figure 47: Create Data File Popup Window
N
4. Type “100” in the “File:” field. This is the user defined reference number of the new file for this example. Valid file numbers are from 9 to 999.
71
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Open the “Type:” drop down menu and select INTEGER from the list as shown in Figure 48.
Figure 48: Data File Type Selection
N
6. Enter a name for the new file and a description in the respective fields. A name can be up to 10 characters in length, and a description up to 50 characters. The name and description should reflect what information is being held in the file. Keep in mind that any documentation you associate with the file may be useful for troubleshooting problems at some future date.
72
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
7. Enter the number of elements the file contains in the “Elements:” field. The number of elements is the number of individual pieces of information being stored in the file. This sets aside sufficient data memory to hold your information. This example uses 10 elements of memory. The completed popup window is shown in Figure 49.
N
Figure 49: Completed Create Data File Popup Window
73
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
8. Click the OK button from the bottom of the popup window. This creates the new integer file N100 – TEST in the Data Files folder of the Project window as shown in Figure 50.
N
Figure 50: New Integer Data File Created
74
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
You can examine the contents of any data file by double-clicking the mouse over it. This opens a popup window for that data file with the memory contents displayed. Double clicking the mouse over the new N100 – TEST file opens the popup window shown in Figure 51. Notice the description in the title bar, and that the file contains ten elements labeled 0 through 9. All ten elements contain 0 for data as shown in Figure 51.
Figure 51: File N100 – TEST Popup Window
ADDRESSING
An address is a location in memory where information is stored. Addressing is the method by which this information is moved to that location. RSLogix uses a variety of addressing schemes in order to manipulate data. You must understand these schemes to ensure that the information you need goes where you want at the time you want it there. There are several basic types of addressing schemes as follows: Logical Indexed Indirect Symbolic I/O image
N
• • • • •
Logical Addressing Logical addresses are codes that specify the location of information in the data table. Variations of a logical addressing allow indexed and indirect addressing schemes. The general format of a logical address is as follows:
#TN:0.s/b
75
Introduction to Programmable Logic Controllers Table 19 explains the details of the logical address format. Table 19: Logical Address Format Symbol Description The # symbol indicates an indexed address. # Omit the # symbol if you are not using an indexed address.
:
0
.
s
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
N
This indicates the file type. Any of the following letters are valid file types: • B – binary • A - ASCII • C – counter • D – BCD • F – floating-point • BT – block transfer • I – input • MG – message • O – output • PD – PID • N - integer • SC – SFC status • S - status • ST – ASCII string • R – control • CT – ControlNet Transfer • T – timer
This indicates the file number. Allowable numbers are from 0 to 999. The file number is that which is associated with the file type for the files in the Data File folder. The ‘:’ symbol is a delimiter separating the file reference from the word reference (which is the location within the file where the data is found). The 0 is the word number within the file. This number must be in octal for input or output files, and decimal for other file types.
The ‘.’ Symbol is a delimiter that indicates a structure member mnemonic follows. The ‘s’ represents the structure member mnemonic of a counter, timer, or control file. The structure member mnemonic is an abbreviation that is two or three characters long.
N
T
/
The ‘/’ is a delimiter indicating a bit number reference follows.
b
The b represents a bit number reference. This number must be in octal (008 through 078 and 108 through 178) for input or output files, and decimal (00 through 15) for other file types.
76
Introduction to Programmable Logic Controllers Indexed Addressing Indexed addressing adds the contents of a special register, known as the index register, to a base address in order to form a new (indexed) address. The PLC-5 uses status register S:24 as the index register. The contents of S:24 are added to the base address to form the indexed address. The program then goes to the indexed address to retrieve or store data. It is up to the programmer to make sure the index register S:24 is loaded with the correct offset before using an indexed address.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Indexed addresses are especially useful with loop structures. The index register can be forced to increment or decrement with each iteration of a loop. The offset from the status register is then combined with the base address, providing access to a sequential range of data registers. Indexed addresses in a program begin with the pound sign (#). The easiest way to understand the operation of an indexed address is by an example.
N
Start by examining the contents of status register S:24, shown in Figure 52. Recall that you can open the status register by double clicking the S2 file from the Data Files folder. From the figure, you can see that the binary number 00000000000000112 is stored in the register, which is equivalent to 3 in decimal.
Figure 52: Status Register S:24
77
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Now consider the logical address N7:0, which is the address of the first integer in the N7 data file. The contents of this register are displayed in Figure 53. The data stored at address N7:0 is 1.
Figure 53: Integer Register N7
Now modify the logical address N7:0 to form the indexed address #N7:0. When the program encounters the # at the base address, the software goes to status register S:24 to get the offset. In this case, the offset is 3 as shown in Figure 52. This value is added to the base address of N7:0 to yield an indexed address of N7:3. The data at this memory location is 50, which is the value that would be used in any calculation by the program. Indirect Addressing
Like indexed addressing, indirect addressing is a modification of a basic logical address. The significant difference is that an indirect address points to another address, which then points to the data. After calculating the offset, the indexed address points to the actual data.
N
Indirect addresses are identified by brackets somewhere in the instruction. An example of an indirect addressing format is N[N7:2]:1. The value within the brackets becomes part of the address.
78
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Consider the contents of integer data register N7 shown in Figure 54 as an example. The data at location N7:2 is 100.
N
Figure 54: Integer Data Register N7 and Indirect Addressing
79
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The indirect instruction retrieves this data (100) and substitutes it for what is in the brackets. In this case, N[N7:2]:1 becomes N100:1. N100 is a user-defined data file that will be found in the Data Files folder of the Project window, as shown in Figure 55.
N
Figure 55: User-Defined N100 Data File
80
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
N100:1 is a logical address that points to word number 1 in the file. The N100 data file is shown in Figure 56. The data at location N100:1 is 33. This value, 33, would then be used in any calculation referenced using the indirect address. This example used an integer register for the indirect address. Valid registers for indirect addressing include the following types: N, T, C, R, B, I, O, and S.
Figure 56: N100 Data File
Symbolic Addressing
Symbolic addressing allows you to substitute a name for a logical address. This symbolic name can then describe the information contained at the address, which should make the program flow easier to understand. There are several restrictions on symbolic names: 1. The symbolic name is limited to 20 characters in length. Allowable characters are: The letters A through Z (uppercase) The numbers 0 through 9 The underscore ( _ ) character
N
• • •
2. A symbolic name cannot be only numbers. 3. The following characters are not allowed in a symbolic name: ~ ` ! @ # $ % ^ & * ()+=[]{}\|:;“?/,. 4. A symbolic name cannot be a number followed by a D, O, H, E, or B. These are considered representations of decimal, octal, hexadecimal, exponential, and binary numbers, respectively.
81
Introduction to Programmable Logic Controllers 5. You cannot start a symbolic name with the letters O, I, or S, and then follow that letter with a number. These are considered representations of logical addresses for output, input, or status files, respectively. 6. No blank spaces are allowed. How to Create or Edit a Symbolic Name for an Address There are several ways to create or edit a symbolic name for an address. These steps illustrate one of the easier methods.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Determine the name you are going to assign. The name should describe some attribute of the function occurring at the address, and help you to understand the flow of the ladder logic. A little thought at this step could provide a great deal of help during fault diagnosis and troubleshooting.
N
2. Right click the mouse over the symbol for which you are assigning a symbolic name. This opens the popup window shown in Figure 57.
Figure 57: Popup Window for Symbolic Name Entry
82
Introduction to Programmable Logic Controllers This opens a popup
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Select EDIT DESCRIPTION from the popup window. window for the symbol shown in Figure 58.
Figure 58: Symbolic Name Entry
N
4. Enter or change the description of function in the “Edit Description Type” field, and the actual symbolic name in the “Symbol” field. Be as descriptive as possible with your entries. An example of a completed description and symbolic name is shown in Figure 59.
Figure 59: Symbolic Name Entry Completed
83
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Select the OK button when you are satisfied with the information in the popup window. This enters the symbolic name and description into the ladder logic as shown in Figure 60.
N
Figure 60: Symbolic Name and Description in Ladder Logic
84
Introduction to Programmable Logic Controllers I/O Image Addressing I/O image addressing is used to move data between the processor module and the I/O modules in the equipment chassis. The general format of a logical address is as follows:
M:rng/tb Table 20 explains the details of this format.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Table 20: I/O Image Address Format
Symbol Description This indicates the file type. The following letters are valid file types: M • I – input • O – output rn
g
/
tb
This indicates the I/O rack number. The rack number, which must be in octal format, has a maximum allowable range of 008 to 278. The actual allowable range depends on the model of the PLC-5 processor.
This indicates the I/O group number. The I/O group number is in octal format and ranges from 08 to 78. The / is a delimiter separating the I/O group number from the terminal number.
This indicates the terminal (bit) on an I/O module to which the I/O point is connected.
N
Figure 61 illustrates how an I/O address appears in the ladder logic.
Figure 61: I/O Address in Ladder Logic
85
Introduction to Programmable Logic Controllers Chassis, Slots, I/O Racks, and Groups This section of the text describes how the software talks to the I/O modules of the hardware. There are several basic concepts that are easily confused. These concepts include the following: Chassis Slot Rack Group
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
• • • •
Chassis and slots are concepts that refer to the hardware, while racks and groups relate to the software. Chassis and Slots
N
The chassis is the piece of equipment that holds the modules. Each module is connected to a slot in the chassis. A single chassis can have up to 16 slots to hold the various modules. Other common chassis sizes are 8-slot and 12-slot.
86
Introduction to Programmable Logic Controllers I/O Rack An I/O rack is not the same as an I/O chassis. The chassis is the hardware. Racks are files in software. This means a rack is a logical device, not a physical one.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
One I/O rack is 8 words of the output image table and 8 words of the input image table. Remember that these image tables are the first two files in the Data Files folder in the RSLogix 5 Project window. The contents of the Data Files folder are shown in Figure 62. The output image table is labeled O0, and the input image table is labeled I1.
Figure 62: Data Files Folder
87
Introduction to Programmable Logic Controllers I/O Group An I/O group is comprised of two words, one input word (16 bits) and one output word (16 bits) in the data table. This means that one I/O rack consists of 8 I/O groups (because 1 rack is 8 words in each of the output and input image tables). Slot Addressing for I/O Transfer
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Allen-Bradley offers a good deal of flexibility in the types and sizes of I/O modules that you may install in a rack. If, for example, you purchase a digital input module with provisions for 16 inputs, then the inputs from the module correspond nicely to the 16 bits available in an I/O group of the input image table. In this case, the transfer of data between the input module and the processor is relatively straightforward. Digital input modules, however, have 8, 16, or 32 inputs, depending on the model selected for the application. These inputs somehow have to relate to the input image table, which has a defined size of 16 bits per group and 8 groups per rack. Allen-Bradley accounts for this by providing three different slot addressing schemes through RSLogix. These slot addressing schemes are as follows: 1-slot 2-slot ½-slot
N
• • •
88
Introduction to Programmable Logic Controllers 1-Slot Addressing When 1-slot addressing is selected, the processor addresses one slot in the rack as one group. Therefore, a 16-slot chassis contains two logical racks (rack 0 and rack 1) when 1-slot addressing is used. The physical address of each group corresponds to an input and output image table word. The type of module you install determines the number of bits and the type of word that are used.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
With 1-slot addressing, 16 input bits and 16 output bits are available in the processor’s image table for each I/O group. Therefore, you can use any mix of 8-point or 16-point modules in any order, and you need only eight slots of a chassis to achieve up to 128 I/O points. When you use 8-point I/O modules with 1-slot addressing, only eight bits of the I/O image table word, for that I/O group, are used. Figure 63 illustrates 1-slot addressing.
Figure 63: 1-Slot Addressing
89
Introduction to Programmable Logic Controllers 2-Slot Addressing Two-slot addressing forces the processor to address two I/O module slots as one I/O group. Therefore, a 16-slot chassis contains one rack (rack 0) when 2-slot addressing is used. Each I/O group is then allotted one word (16 points) in the input image table and one word in the output image table. This means you cannot use a 32-point card with 2-slot addressing because only 16 points are reserved in the respective image table.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
You can use 8-point or 16-point I/O modules with 2-slot addressing. If you are using 16point cards, you must alternate an input card with an output card in the chassis. Alternating the cards is the only way to match the points on the card with the corresponding points in the image tables. An example of 2-slot addressing is shown in Figure 64.
Figure 64: 2-Slot Addressing
90
Introduction to Programmable Logic Controllers 1/2-Slot Addressing When you select 1/2-slot addressing, the processor addresses one-half of an I/O module slot as one I/O group. Therefore, a 16-slot chassis contains four racks (rack 0, rack 1, rack 2, and rack 3) when 1/2-slot addressing is used. The physical address of each I/O slot corresponds to two input and two output image table words. The type of module you install determines the number of bits in these words that are used.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Since 16 input bits and 16 output bits are available in the processor’s image table for each I/O group, you can mix 8, 16 and 32-point I/O modules in any order in the I/O chassis. A 32-point I/O module (two 1/2-slot I/O groups) uses two words of the image table. Fewer I/O points are available by using 1/2–slot addressing with 8 or 16-point I/O modules. Figure 65 illustrates 1/2-slot addressing.
Figure 65: 1/2-Slot Addressing
91
Introduction to Programmable Logic Controllers Examples of I/O Image Addressing
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Sixteen-point I/O modules have 16 input terminals or 16 output terminals. A 16-point I/O module uses a full word in the input or output image table. Figure 66 illustrates how 16-point I/O modules are mapped to the image tables.
Figure 66: Sixteen Point I/O Modules
92
Introduction to Programmable Logic Controllers
USING RSLOGIX 5 This section discusses the more common operations performed using RSLogix. This includes going on-line with a controller, along with basic editing and file manipulation commands.
GOING ON-LINE WITH A CONTROLLER
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
You must be on-line with a controller in order to see what is happening with the project that the controller is currently running. Follow these steps to start RSLogix and go online with a controller. How to Go On-Line with a Controller
These steps assume that the laptop and the controller have already been configured to communicate with each other. You will need to set up the communication link using the RSLinx software package if the communication protocol has changed or is otherwise incorrect.
N
1. Connect the communications interface cable between the laptop computer that is running RSLogix and the controller.
93
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Start the RSLogix software package. This will generally be through a shortcut icon on the desktop of the computer you are using. RSLogix opens to a blank screen as shown in Figure 67.
N
Figure 67: Starting RSLogix 5
94
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Open the “Comms” drop down menu. The Comms drop down menu is shown in Figure 68.
N
Figure 68: Comms Drop Down Menu/WHO ACTIVE GO ONLINE Selection
95
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Select WHO ACTIVE GO ONLINE from the Comms drop down menu. This opens the Communications popup window shown in Figure 69. If you see a large red “X” over any device then communication is not established with that device. If this is the case then check the configuration of the communications driver using RSLinx.
N
Figure 69: Communications Popup Window
96
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Click the ONLINE button. RSLogix now attempts to go on-line with the connected controller. RSLogix reads the name of the project from the controller and attempts to find a file with the same name on the hard drive. When the matching file is located, the ladder logic appears in the display as shown in Figure 70.
N
Figure 70: RSLogix On-Line with a Controller
97
Introduction to Programmable Logic Controllers UPLOADING A PROJECT FROM A PLC-5 Uploading a project is the process of transferring a program loaded on a PLC-5 processor into memory of the programming interface connected to the processor. Uploading is necessary because RSLogix requires that you have a copy of the project on the hard disk before you can go on line to the controller. You will be prompted to upload the project if you attempt to go on-line and RSLogix cannot find a copy of the project on the hard disk.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
How to Upload a Project These steps assume that the laptop and the controller have already been configured to communicate with each other. You will need to set up the communication link using the RSLinx software package if the communication protocol has changed or is otherwise incorrect. 1. Connect the communications interface cable between the laptop computer that is running RSLogix and the controller.
N
2. Start the RSLogix software package. This will generally be through a shortcut icon on the desktop of the computer you are using. RSLogix opens to a blank screen as shown in Figure 71.
Figure 71: Starting RSLogix 5
98
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Open the “Comms” drop down menu. The Comms drop down menu is shown in Figure 72.
N
Figure 72: Comms Drop Down Menu/UPLOAD Selection
99
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Select UPLOAD from the Comms drop down menu. RSLogix then searches for a project saved in the default directory on the hard disk for a file with the same name as that on the controller. If RSLogix cannot locate a file then the Going to Online Programming State popup window opens. The Going to Online Programming State popup window is shown in Figure 73. This popup window allows you to create a new file in the default directory, merge the file with one of those identified in the bottom half of the popup window, or browse for a location to store the file. You will be prompted to go on-line with the controller after the upload is finished.
N
Figure 73: Going to Online Programming State Popup Window
100
Introduction to Programmable Logic Controllers SAVING A PROJECT Saving your project writes a current copy of your work to the hard drive. Be sure to save your work frequently if you are working off-line. How to Save a Project Follow these steps to save a copy of your work to the hard disk.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Left click the icon of the floppy disk from the standard toolbar located at the top of the screen. This icon is shown in Figure 74.
N
Figure 74: Floppy Disk Icon from Standard Toolbar
101
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Note that you may also select SAVE from the File drop down menu to accomplish the same thing. The File drop down menu is shown in Figure 75.
N
Figure 75: File Drop Down Menu/SAVE Selection
102
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Selecting either the icon from the standard toolbar or the SAVE selection from the File drop down menu method opens the Revision Note popup window shown in Figure 76. This window allows you to enter some descriptive comment regarding any corrections or updates to the software. It is also helpful to enter the date that the software changes were made.
Figure 76: Revision Note Popup Window
N
3. Click the OK button after the revision note is entered. This saves the project to the default location on the hard drive.
103
Introduction to Programmable Logic Controllers How to Change the Default Path where Projects are Saved Changing the default path prevents the need to browse for the location where projects are stored. This also changes the default path for upload operations. Follow these steps to change the default project path.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Select Tools from the menu bar at the top of the screen. This opens the Tools drop down menu shown in Figure 77.
N
Figure 77: Tools Drop Down Menu
104
Introduction to Programmable Logic Controllers This opens the System
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Select OPTIONS from the Tools drop down menu. Options popup window shown in Figure 78.
N
Figure 78: System Options Popup Window
105
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Select the top BROWSE button from the three shown in the lower, right-hand corner of the popup window. This is the BROWSE button for the “Project Files Search Path” field. Selecting this button opens the Set Directory popup window shown in Figure 79.
Figure 79: Set Directory Popup Window
4. Select the new default location from the list of folders available, then left click the OK button from the Set Directory popup window. This closes the popup window and returns you to the System Options popup window. 5. Left click the OK button from the System Options popup window. This closes the popup and changes the default location for saving files.
DOWNLOADING A PROJECT TO A PLC-5
N
Downloading a project moves a copy of the software on the programming interface (laptop) to the PLC-5 controller. Projects are downloaded after completing any offline edits and you are ready to run the project. Note that you must be in the OFFLINE mode with RSLogix before you can download a project to a controller. How to Download a Project These steps assume that the laptop and the controller have already been configured to communicate with each other. You will need to set up the communication link using the RSLinx software package if the communication protocol has changed or is otherwise incorrect. 1. Connect the communications interface cable between the laptop computer that is running RSLogix and the controller.
106
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Start the RSLogix software package. This will generally be through a shortcut icon on the desktop of the computer you are using. RSLogix opens to a blank screen as shown in Figure 80.
Figure 80: Starting RSLogix 5
N
3. Left click the icon of the open folder, shown in Figure 81, from the standard toolbar. This opens the Open/Import PLC5 Program popup window from which you can select a file to open. You must open the file on the hard drive before you can download it to the controller.
Figure 81: Open Folder Icon
107
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Select the desired file from the Open/Import PLC5 Program popup window, as shown in Figure 82. You can browse for a file in a different folder by clicking the GOTO button located near the middle of the window. Notice the revision notes for the project located at the bottom of the window.
N
Figure 82: Open/Import PLC5 Program Popup Window
108
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Left click the OPEN button after selecting a project. This opens the project in the RSLogix display as shown in Figure 83.
N
Figure 83: Open Project in RSLogix Display
109
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
6. Open the Comms drop down menu. The Comms drop down menu is shown in Figure 84.
N
Figure 84: Comms Drop Down Menu
110
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
7. Select DOWNLOAD from the drop down menu. This opens the RSLogix 5 popup window shown in Figure 85.
Figure 85: RSLogix 5 Popup Window
N
8. Click YES from the popup window and the program in the display will be downloaded to the controller. You will be asked if you want to go on-line after the download completes.
111
Introduction to Programmable Logic Controllers EDITING LADDER LOGIC Editing is the process of adding, inserting, and deleting rungs, branches, and instructions to the ladder logic. RSLogix usually provides multiple ways to perform a task, and editing ladder logic is no exception. The methods presented in this text are designed to familiarize you with some of the capabilities of RSLogix.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
A project can be edited in one of two ways: online and offline. Zone markers in the ladder logic identify the rungs being edited. These zone markers change to allow you to track the status of your edits, and offer you opportunities to easily remove unwanted changes. Edit Zone Markers
Online edits are indicated in the project by the upper case zone markers “I,” “R,” and “D.” Uppercase markers indicate edits that are present in controller memory. These markers appear between the rung number and the vertical bar (power rail) on the left side of the ladder logic. I (Insert): These are new rungs that have been inserted into the ladder logic.
•
R (Replace): These rungs have been replaced in controller memory. Rungs marked with an “R” will continue to function until new edits have been tested.
•
D (Delete): These rungs have been deleted in controller memory. Rungs marked with a “D” will continue to function until the new edits have been tested.
N
•
112
Introduction to Programmable Logic Controllers Offline edits are indicated in the project by the lower case zone markers “e,” “i,” “r,” and “d.” Lowercase markers indicate edits that are present in computer memory. These markers also appear between the rung number and the vertical bar (power rail) on the left side of the ladder logic. e (edit): These are new rungs that have been inserted into the ladder logic and are currently being edited. This zone marker disappears after the ladder logic is verified, indicating that the edits are now included in the project.
•
i (insert): These rungs have been inserted into the ladder logic in computer memory while online with a controller. Rungs marked with an “i” are not moved to controller memory until the rung is accepted. Once accepted, the lower case “i” is replaced by the uppercase “I.”
•
r (replace): These rungs are marked for replacement. Rungs marked with an “r” are not moved to controller memory until the rung is accepted. Once accepted, the lower case “r” is replaced by the uppercase “R.”
•
d (delete): These rungs are marked to be deleted. The lower case “d” means that these rungs still reside in computer memory. Rungs marked with a “d” are not moved to controller memory until the rung is accepted. Once accepted, the lower case “d” is replaced by the uppercase “D.”
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
•
Online Editing
Online editing allows you to change a project while you are online with RSLogix 5 to ladder logic that is actively running on a controller. There are four steps involved in online editing. These are verify, accept, test, and assemble. Verifying edits is the process in which RSLogix checks your new programming for syntax errors. Syntax errors are those that involve incorrect or improper use of ladder logic instructions. Syntax errors must be corrected before the controller will accept the new instructions.
•
Edits are accepted after they are verified. This takes any offline edits (those marked with an “e”) and moves them into controller memory. These rungs will then be marked with an “I” (insert).
•
Edits are tested after they are accepted. Any rungs that are marked with an “I” (insert) are used in the ladder logic in place of those marked with an “R” (replace). This allows you to check your work before finalizing the changes.
N
•
113
Introduction to Programmable Logic Controllers •
Edits are assembled after they are tested. Edit zone markers are removed at this stage. Rungs marked with an “I” are incorporated into the ladder logic, and those rungs marked with an “R” are removed. You cannot undo any edits after they are assembled.
Online Editing Restrictions
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
RSLogix does not permit you to resize the data tables, create project files, or delete project files while you are online. You must go offline with the controller before performing these types of operations. How to Verify, Accept, Test, and Assemble Online Edits
N
1. Go online with the controller being edited, and locate the rung where changes are being made. This example replaces the OTE instruction at logical address B3:0/0 on rung 0000 with an OTE instruction at logical address O:012/3. The original ladder logic is shown in Figure 86.
Figure 86: Original Ladder Logic for Online Editing Example
114
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Right click the mouse over the number of the rung being edited. This opens the popup window shown in Figure 87.
N
Figure 87: Popup Menu for Online Editing
115
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Select START RUNG EDITS from the popup window. This inserts a duplicate of the rung being edited above the original as shown in Figure 88. RSLogix keeps track of the original rung until the edits are tested and assembled. This allows you to back out of any changes if they do not work as planned. The original rung (which is now rung0001) is marked by the lower case letter “r” shown just to the right of the rung number. This rung will be replaced by the rung being edited. The rung being edited (rung 0000) is marked by the lower case letter “e.” Lower case letters mean that the edits are offline.
N
Figure 88: New Rung for Editing (Offline)
116
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Make the changes to the rung marked with the “e.” This example changes the OTE instruction from logical address B3:0/0 to O:012/3 as shown in Figure 89.
N
Figure 89: OTE Logical Address Changed
117
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Right click the mouse over the number of the rung being edited. This opens the popup menu shown in Figure 90.
N
Figure 90: Popup Menu for Verifying Rung Edits
118
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
6. Select VERIFY RUNG from the popup menu. This checks the syntax of the rung being edited. The rung is marked for insertion as shown in Figure 91, if the rung does not contain errors. Notice that the edits are still offline as indicated by the lower case letters.
N
Figure 91: Rung Verified
119
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
7. Right click the mouse over the number of the rung being edited. This opens the popup menu shown in Figure 92.
N
Figure 92: Popup Menu for Accepting Rung Edits
120
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
8. Select ACCEPT RUNG EDITS from the popup menu. This moves the edits from computer RAM to the controller. The rung is now marked by a capital letter “I” to indicate the edits are online. The online bar above the project window now indicates that edits exist in the controller as shown in Figure 93.
N
Figure 93: Rung Edits Accepted
121
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
You must now test the edits to ensure correct operation of the changes. During testing the rung marked “I” takes precedence over the rung marked “R” during execution of the ladder logic. Testing edits can be performed using selections from another popup menu, however this example uses the online editing toolbar icons located just above the ladder logic. The TEST EDITS button is the second from the right as shown in Figure 94.
Figure 94: TEST EDITS Button from Online Editing Toolbar
N
9. Left click the TEST EDITS button to initiate testing. This opens the confirmation popup window shown in Figure 95.
Figure 95: Test Edits Confirmation Popup Window
122
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
10. Left click YES from the confirmation popup window. This allows you to test the edits in the project. The ladder logic display will not change, however the online bar indicates edits are active as shown in Figure 96.
N
Figure 96: Test Edits Online Indication
123
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
11. Assemble the edits when you are satisfied the program works correctly. You may either assemble the edits using a popup menu selection, or select the ASSEMBLE EDITS button, as in this example. Once the edits are assembled, the rung marked for removal is actually removed from the ladder logic, and the rung marked for insertion becomes part of the project as shown in Figure 97.
N
Figure 97: Edits Assembled
124
Introduction to Programmable Logic Controllers Offline Editing Offline editing allows you to change a project residing in computer memory (RAM). Offline edits need only be verified as correct before the program is downloaded to the PLC-5. During verification, RSLogix checks for unknown instruction types in the ladder logic and ensures that the addresses in the ladder logic are defined in the data tables. Any errors found during verification are reported under the BUILD tab of the Results window, which is located at the bottom of the screen. There are various methods for verifying edits. You may verify a single rung, a file, or an entire project.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
How to Verify a Single Rung
N
1. Right click the mouse over the number of the rung being verified. This opens the popup menu shown in Figure 98. Rungs that need to be verified are marked by the lower case letter “e” shown just to the right of the rung number.
Figure 98: Popup Window to Verify a Single Rung of Ladder Logic
125
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Select VERIFY RUNG from the popup window. RSLogix will verify the rung and display any errors in the Results window at the bottom of the screen. The Results window is shown in Figure 99. Note that double-clicking the mouse over the error message moves the cursor to the instruction in the ladder logic that contains the error.
N
Figure 99: Results Window
126
Introduction to Programmable Logic Controllers How to Verify a File or Project
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Verifying a file or project is similar to verifying a single rung. The major difference relates to the scope of the verification. Selecting the respective icon located at the top of the screen verifies a file or project. The icons are shown in Figure 100. The file verification icon is on the left side, and the project verification icon is on the right side. Errors are displayed in the Results window regardless of which verification is selected.
Figure 100: Verify File and Verify Project Icons
UNDO and REDO
UNDO and REDO are functions designed to help you back out of mistakes. UNDO and REDO are two buttons found on the standard toolbar at the top of the screen as shown in Figure 101. The UNDO button is on the left with the arrow that points to the left, and the REDO button is on the right with the arrow that points to the right.
Figure 101: UNDO Button (Left Arrow) and REDO Button (Right Arrow)
N
The UNDO button reverses your last step. If you insert a rung in the wrong place, incorrectly change the text of an instruction, or make just about any other mistake, the UNDO button will back you up to where you were before you made the mistake. UNDO can be used on up to 200 previous actions. If you make a mistake with the UNDO button and remove something you did not mean to, the REDO button will restore the object you just removed with the UNDO button.
127
Introduction to Programmable Logic Controllers INSERTING AND APPENDING RUNGS OF LADDER LOGIC New rungs of ladder logic can be added to a program by either inserting the rung or appending the rung. Rungs are inserted above the current location of the cursor in the ladder window, while appended rungs are added below the location of the cursor. How to Insert a Rung
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Move the mouse pointer over the rung number where you want the new rung to go then right-click the mouse. This opens the popup menu shown in Figure 102. Rung 0001 is highlighted in this example. Remember that inserting a rung places it above the location of the cursor.
Figure 102: Popup Menu with Mouse Pointer over Rung Number
128
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Select INSERT RUNG from the popup menu. This pushes the existing ladder logic down one rung and inserts a new rung at the location of the cursor. The new rung is shown in Figure 103. Notice the number of the new rung is 0001. The lower case letter “e” to the right of the rung number indicates that new edits are present.
N
Figure 103: New Rung Inserted
129
Introduction to Programmable Logic Controllers How to Append a Rung
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Move the mouse pointer over the rung number where you want the new rung to go then right-click the mouse. This opens the popup menu shown in Figure 104. Rung 0002 is highlighted in this example. Remember that appending a rung places it below the location of the cursor.
N
Figure 104: Popup Window with Mouse Pointer Over Rung Number
130
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Select APPEND RUNG from the popup menu. The new rung is then inserted at rung number 0003, which is below the location of the cursor. The new rung is shown in Figure 105, along with rung 0001 which was inserted in the previous example.
N
Figure 105: New Rung Appended
131
Introduction to Programmable Logic Controllers BRANCHING Branches are parallel flow paths within the ladder logic. Branches allow you to program conditional instructions in which one branch or another is taken for a given set of inputs. How to Insert a Branch
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Decide where you are going to put the branch. This may seem obvious, but there are many ways in which to insert a branch. Your ladder logic can quickly become a confused jumble of lines if you are not careful about what you are doing. This example inserts a branch on rung 0000 across the XIO instruction labeled “First Scan of Ladder or SFC Step” at S:1/15, which is highlighted in Figure 106.
Figure 106: Location for New Branch
N
2. Hold the left mouse button down over the branch icon under the USER tab of the instruction toolbar. The rung icon is shown in Figure 107.
Figure 107: Rung Icon Under USER Tab of Instruction Toolbar
132
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Drag the mouse into the ladder window. A series of red boxes appears in the ladder logic as soon as you drag the mouse into the window. These red boxes, shown in Figure 108, represent valid positions at which you can place the branch. You will also notice that the mouse pointer changes to the rung icon as soon as the pointer is over the ladder logic. As you move the mouse around the window, you will notice that one of the red boxes changes color from red to green and contains a small “X” within the box. This green box represents the point at which the branch will be inserted.
Figure 108: Insertion Points for the New Branch
N
4. Release the mouse pointer when the branch is over the desired position. This inserts a new branch at the location as shown in Figure 109.
Figure 109: New Branch Inserted
133
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Hold the left mouse button down over the red box on the end of the branch then drag it to the termination point. The series red boxes again appear in the window as shown in Figure 110. These red boxes indicate valid termination points for the branch. One of the boxes will change color from red to green as you drag the mouse. This indicates the point at which the branch will terminate when the mouse button is released.
Figure 110: Dragging the Branch to the Termination Point
N
6. Release the left mouse button. This places the branch across the XIC instruction as shown in Figure 111.
Figure 111: New Branch Terminated
134
Introduction to Programmable Logic Controllers
PROGRAMMING WITH BIT INSTRUCTIONS More than 120 instructions make up the PLC-5 programming language. The simplest and most common instructions control the flow of data to a single point, or bit. Therefore, these single point instructions are known collectively as bit instructions.
SELECTED BIT INSTRUCTIONS
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Bit instructions provide the interface between discrete components and the application software. Discrete I/O consists of those field devices that are either on or off. Examples of discrete components are limit switches, photo sensors, or LED’s. Bit instructions also read and write information to internal processor memory, such as the S2 (status) and B3 (binary) data files. There are a number of different bit instructions. The bit instructions discussed in this text that are supported by the PLC-5 are as follows: Examine If Closed (XIC) Examine If Open (XIO) Output Energize (OTE) Output Latch (OTL) Output Unlatch (OTU)
N
• • • • •
135
Introduction to Programmable Logic Controllers Examine IF CLOSED (XIC)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Examine If Closed is a bit-input instruction identified by the mnemonic XIC. Two XIC instructions are shown on the left side of Figure 112.
N
Figure 112: XIC Instructions
136
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
An XIC address beginning with the letter “I” is used with devices that are physically connected to the terminals of a discrete input module. When one of these input devices closes a circuit, a “1” is written to the input image table at the address corresponding to that input device as illustrated in Figure 113. The processor then verifies that the circuit is still closed when the XIC instruction referencing the address is encountered in the user program. If the circuit is still closed, then the processor sets the logic for the XIC instruction as true, which will energize an output instruction on the same rung as the XIC instruction.
N
Figure 113: XIC Instruction and the Input Image Data Table
137
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
An XIC address beginning with the letter “B” is used with internal processor memory instead of physical devices. When another instruction (such as an output enable) writes a “1” to a bit in memory, then a “1” is written to the bit data table at the address corresponding to that memory location as illustrated Figure 114. The processor then verifies that the memory address still contains a “1” when the XIC instruction referencing the memory address is encountered in the user program. If the address still contains a “1” then the processor sets the logic for the XIC instruction as true, which will energize an output instruction on the same rung as the XIC instruction.
N
Figure 114: XIC Instruction and the Bit Data Table
138
Introduction to Programmable Logic Controllers Examine IF OPEN (XIO)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Examine If Open is a single bit input instruction identified by the mnemonic XIO. Two XIO instructions are shown in Figure 115.
Figure 115: XIO Instructions
N
The XIO instruction is similar to the XIC instruction except, when encountered in the program, the XIO instruction looks for a “0” (zero) value at the address to which it is attached in the data table. As with XIC, the XIO instruction may begin with the letter “I” for physical devices connected to the terminals of a discrete input module, or begin with the letter “B” for internal processor memory.
139
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The XIO instruction looks for a “0” value at the address with which it is associated in order to make the ladder logic true. As an example, compare the XIC instruction to the XIO instruction in Figure 116. Output O:000/00 will be energized if I:002/17 is on and O:000/01 will be energized if I:002/17 is off.
Figure 116: Comparison of XIC and XIO
Output Enable Instruction (OTE)
N
OTE is a single bit output instruction. The output remains true (on) for as long as rung continuity to the OTE instruction remains true. Output Enable instruction addresses begin with the letter “O” for physical outputs, or the letter “B” for internal outputs. An example of the Output Enable instruction is shown in Figure 117 on the right side of the rung.
Figure 117: OTE Instruction
140
Introduction to Programmable Logic Controllers Output Latch (OTL)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Once the Output Latch instruction becomes true/energized, it remains on even if rung continuity is removed. It is considered a retentive device. Retentive devices retain their value until they are reset by another rung of logic. Latches remain in their last state even if the machine is powered off and on again. An example of the OTL instruction is shown in Figure 118.
Figure 118: OTL Instruction
Output Unlatch (OTU)
N
The Output Unlatch instruction is used to clear a latched output. Therefore, the Output Unlatch is normally paired with, and given the same address as, an Output Latch instruction. An example of an Output Unlatch instruction is shown in Figure 119.
Figure 119: OTU Instruction
141
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Latch and unlatch instructions are usually arranged so they cannot both be on at the same time. An example of this arrangement is shown in Figure 120. If power is applied to the unlatch, the output device associated with the latch/unlatch address will be deenergized, regardless of the state of the latch.
Figure 120: Arrangement of Latch And Unlatch Instructions
USING BIT INSTRUCTIONS
N
There are two basic steps involved in programming with bit instructions: inserting the instruction and assigning an address. Inserting the instruction is relatively straightforward. Just drag the part from the instruction toolbar to the desired position in the ladder logic. There are then several options for assigning an address. These options include typing the address directly (if you know it), or assigning an address from a data file. You may also search for unused addresses that you may assign to an instruction.
142
Introduction to Programmable Logic Controllers How to Insert Bit Instructions into a Program Input instructions are always on the left side of the ladder logic, and output instructions are on the right side. This means that continuity through a rung is from left (input) to right (output).
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Left click the BIT tab on the instruction menu. This displays all of the bit instructions under the tab as shown in Figure 121. If you forget the name of a particular instruction, holding the mouse pointer over the instruction will display the name in a popup window.
Figure 121: Bit Instruction Icons under BIT Tab of Instruction Toolbar
N
2. Hold the left mouse button down over the specific bit instruction in the instruction toolbar. An XIC instruction (located on the far left side of the instruction toolbar) is used in the following steps.
143
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Drag the mouse into the ladder window. A series of red boxes appears in the ladder logic as soon as you drag the mouse into the window. These red boxes, shown in Figure 122, represent valid positions at which you can place the instruction. You will also notice that the mouse pointer changes to the XIC icon as soon as the pointer is over the ladder logic. As you move the mouse around the window, you will see that one of the red boxes changes color from red to green and contains a small “X” within the box. This green box represents the point at which the branch will be inserted. In this example, the insertion point for the instruction is rung 0003.
N
Figure 122: Insertion Points for XIC Instruction
144
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Release the left mouse button. This inserts the instruction on rung 0003 as shown in Figure 123. The small question mark above the instruction means that an address has not yet been assigned.
Figure 123: XIC Instruction Inserted into Ladder Logic
N
5. Now insert an OTE instruction on the rung. Begin by holding the left mouse button down over the desired instruction in the instruction toolbar. Note that the OTE instruction is the third icon from the left as shown in Figure 124.
Figure 124: OTE Instruction on Instruction Toolbar
145
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
6. Drag the mouse into the ladder window. Move the OTE instruction to the right side of the insertion point on rung 0003 as shown in Figure 125. Be sure you are close enough to the insertion point so that the box changes color from red to green.
N
Figure 125: Insertion Point for OTE Instruction
146
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
7. Release the left mouse button. This inserts the instruction on the rung as shown in Figure 126. You now need to assign addresses to the new parts.
N
Figure 126: OTE Instruction Inserted into Ladder Logic
147
Introduction to Programmable Logic Controllers How to Assign a Logical Address Directly at the Instruction
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Select the part for which the address is being assigned. This example uses the XIC instruction on rung 0003 as shown in Figure 127.
N
Figure 127: XIC Instruction Selected for New Address
148
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Begin typing a valid address. Depending on the application, the letters “B” (binary), which is used in this example, or “I” (input) would be acceptable logical addresses for the XIC instruction. Typing the first letter of the logical address opens the drop down menu shown in Figure 128.
N
Figure 128: Starting the Logical Address
149
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Double click B, BINARY from the drop down list. The options in the drop down list change to reflect some of the available logical addresses as shown in Figure 129.
N
Figure 129: Available Logical Addresses
150
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Double click one of the options from the drop down list, or continue typing if the displayed options are not acceptable. The first option in the drop down list is selected in this example as shown in Figure 130.
N
Figure 130: Logical Address Selected
151
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Left click the mouse somewhere in the ladder window. This assigns the logical address to the component as shown in Figure 131.
N
Figure 131: Logical Address Assigned to XIC Instruction
152
Introduction to Programmable Logic Controllers How to Drag and Drop a Logical Address from a Data File You may assign a logical address by dragging it from any data table file then dropping the address onto the component.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Open the data table file from which the address is being selected. This example uses the B3 (binary) file as shown in Figure 132.
N
Figure 132: B3 Data Table File Open
153
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Hold the left mouse button down over the desired logical address in the B3 data table window and drag the address into the ladder window. The target for the logical address in this example is the OTE instruction on rung 0003. A series of red boxes appears in the ladder logic as soon as you drag the mouse into the window. These red boxes, shown in Figure 133, represent valid targets for the logical address. You will also notice that the mouse pointer identifies the selected logical address as soon as the pointer is over the ladder logic. As you move the mouse around the window, you will see that one of the red boxes changes color from red to green and contains a small “X” within the box. This green box represents the component for which the address will be assigned.
N
Figure 133: Logical Address Targets
154
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Release the left mouse button. This assigns the logical address to the component as shown in Figure 134. Any symbolic address or description previously assigned to the logical address will also transfer to the target component and appear in the display.
N
Figure 134: Logical Address Assigned to OTE Instruction
155
Introduction to Programmable Logic Controllers How to Search for Unused Logical Addresses You can easily search for an open logical address if you require an address that is not already assigned to another component in the project.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Open the data file in which to search. As an example, the I1 (input image) data table is open in Figure 135.
N
Figure 135: I1 Input Image Data Table File
156
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Left click the USAGE button from the bottom of the data table window. This changes the display to reflect the logical address usage as shown in Figure 136. Any address marked by an “X” has already been assigned in the project. A “W” states that the address is used at the word level with the project.
N
Figure 136: Logical Address Usage
157
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. You can assign or reassign the logical address of a component by dragging the address from the data table window to the target component. As an example, the logical address of the XIC instruction on rung 0003 shown in Figure 137 is being changed from B3:0/0 to I:010/0. Just drag the I:010/0 address from the open data table window to the target then release the mouse.
N
Figure 137: XIC Logical Address Changed from B3:0/0 to I:010/0
158
Introduction to Programmable Logic Controllers
PROGRAMMING WITH TIMERS Timers are devices that delay the energizing or de-energizing of an output signal for a selected amount of time. They provide many of the same capabilities available with timing relays and solid-state timing devices. There are three timer instructions available through RSLogix 5: Timer On-Delay (TON) Timer Off-Delay (TOF) Retentive Timer On-Delay (RTO)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
• • •
TIMER OPERATION
Several parameters define the operation of timers. following: • • • • • •
These parameters include the
Timer type (on-delay, off-delay, or retentive on-delay) Timer address Time base Timer preset value Timer accumulator value Timer status bits
Timer Type
The type defines how the timer affects the output signal. instructions supported by the PLC-5. These are as follows: Timer On-Delay (TON) Timer Off-Delay (TOF) Retentive Timer On-Delay (RTO)
N
• • •
There are three timer
159
Introduction to Programmable Logic Controllers Timer On-Delay (TON)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The timer on-delay instruction is used to delay an output from going on after an input to the timer goes on. The length of the delay is programmed into the timer. The timer ondelay instruction is identified by the mnemonic TON. An example of a TON instruction is shown in Figure 138.
Figure 138: Timer On-Delay (TON) Instruction
The timer is assigned the address T4:26 in the example provided in Figure 138. The timer is programmed with a time base of 0.01 seconds and a preset value of 100. The calculated on delay of the timer would then be 0.01 x 100 = 1.0 seconds.
N
The input signal to the timer is provided through the XIC instructions at address B3:1/0 and address B3:1/7. The timer begins accumulating time towards the calculated ondelay when both XIC instructions are true. This accumulated value appears in the “Accum” field at the bottom of the timer instruction. The “Done Bit” from the timer then becomes true after the accumulated value equals the preset value, which means the timer has reached the calculated on-delay time (which is 1.0 seconds).
160
Introduction to Programmable Logic Controllers Timer Off-Delay (TOF)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The timer-off delay instruction is used to delay an output from going off after the input to the timer goes off. The length of the delay is programmed into the timer. The timer offdelay instruction is identified by the mnemonic TOF. An example of a TOF instruction is shown in Figure 139.
Figure 139: Timer Off-Delay (TOF) Instruction
The timer-enable bit (EN) is de-energized when the input rung goes false. The timertiming bit turns on when the input goes false and stays energized while the timer instruction is timing. The timer-timing bit turns off when the preset value equals the accumulator value. The timer-done bit turns off when the accumulator is equal to the preset value, or when the timer finishes timing. The timer-done bit also turns on when the input logic to the timer goes false. Retentive Timer On-Delay (RTO)
N
The retentive timer instruction is used to maintain the accumulator value if the input to the timer goes false. The retentive timer instruction lets the timer stop and start without resetting the accumulated value. A reset instruction (RES) with the same address as the timer has to be programmed on another rung in order to reset the retentive timer accumulator value. The retentive timer on-delay instruction is identified by the mnemonic RTO. An example of a RTO instruction is shown in Figure 140.
Figure 140: Retentive Timer On-Delay (RTO) Instruction
161
Introduction to Programmable Logic Controllers The RTO instruction begins timing when the input to the timer goes true. The timer updates the accumulated value until it reaches the preset value for as long as the rung remains true. The RTO instruction retains its accumulated value, even if one of the following occurs: • • •
The rung goes false. The PLC-5 is changed from run to program mode. The processor faults or loses power.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
When the processor resumes operation or the rung goes true, timing continues from the retained accumulated value. By retaining its accumulated value, retentive timers measure the cumulative period during which the input rung is true. Timer Address
Each timer has a unique address in the data table of the PLC-5 memory. Data file T4 is reserved for timers. There is room for 1000 timers in data file T4 numbered from T4:0 to T4:999. Use the lowest available number when programming a new timer in order to conserve memory space. Each timer address references three words of data table memory. One of these words holds the timer preset value, one word holds the accumulated value, and one word holds the status bits that are used for output control of the timer. Timer Preset Value
The range for the timer preset is a value from 0 to 32,767. The preset value establishes the number of timed intervals (0.01 or 1 second) to be timed. When the accumulator equals the preset, the time delay is complete. The time delay is calculated by multiplying the preset value by the time base. If the preset is equal to 1000, and the time base is equal to 0.01 second, then the time delay equals 10 seconds (1000 x 0.01 seconds = 10 seconds).
N
Timer Accumulator Value
The timer accumulator accumulates time base increments (while the timer is timing) until it matches the timer preset. The accumulator counts the number of timed intervals that have elapsed since the timer was activated.
162
Introduction to Programmable Logic Controllers Timer Status Bits There are three status bits in the timer status word. These status bits can be used in the ladder program to trigger some event. The processor changes the state of status bits depending on the condition of the timer. Timers have the following status bits: Timer Enable Bit (EN) (bit 15) is set (on) when the input to the timer is true, and reset (off) when the input is false or when timer is reset by a RES instruction.
•
Timer Timing Bit (TT) (bit 14) is set (on) when the timer is actively timing. This means that for an off-delay timer, the TT bit is set (on) when the input to the timer is off, and the TT bit is reset (off) when the input is on. For an on-delay timer, the status of the TT bit follows the input signal to the timer (on when the input is true and off when the input is false). The TT bit is also reset (off) when the timer is reset by a RES instruction.
•
Timer Done Bit (DN) (bit 13) indicates when the accumulator value equals the preset value, meaning that the timer has timed-out. For an on-delay timer, the DN bit is off until the accumulator reaches the preset. The DN bit then changes state to on and remains on until the input to the timer goes false. For an offdelay timer, the DN bit is on until the accumulator reaches the preset. The DN bit then changes state to off and remains off until the input to the timer changes state to on The TT bit is also reset (off) for both the on-delay and the off-delay when the timer is reset by a RES instruction.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
•
Time Base
N
A timer can count in increments of 0.01 or 1 seconds. This is the time base of the timer. The time base is multiplied by the timer preset value to determine the delay time of the timer.
163
Introduction to Programmable Logic Controllers RESET TIMER/COUNTER INSTRUCTION (RES)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
There is one reset instruction used with both timers and counters. Of the three timer instructions, only the retentive timer, which retains the accumulator value, requires the use of the reset instruction. TON and TOF timers are normally reset by the removal of the input signal enabling the timer. The reset instruction is identified by the mnemonic RES. An example of a RES instruction is shown in Figure 141. Note how the logical address of the RES instruction corresponds to that of the RTO instruction.
Figure 141: Reset Timer/Counter (RES) Instruction
USING TIMER INSTRUCTIONS
This section of the module discusses programming with timers. This includes dragging a timer into a program, setting up or modifying the time-base, and using the timer status bits as indicators. How to Insert a New Timer into a Program
A timer is a type of output instruction. This means it is programmed on the right side of the ladder logic.
N
1. Left click the TIMER/COUNTER tab on the instruction menu. This displays all of the timer and counter instructions under the tab as shown in Figure 142. If you forget the name of a particular instruction, holding the mouse pointer over the instruction will display the name in a popup window.
Figure 142: Timer Instruction Icons under TIMER/COUNTER Tab of Instruction Toolbar
164
Introduction to Programmable Logic Controllers 2. Hold the left mouse button down over the specific timer instruction in the instruction toolbar. An RTO instruction (located third from the left side of the instruction toolbar) is used in the following steps.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Drag the mouse into the ladder window. A series of red boxes appears in the ladder logic as soon as you drag the mouse into the window. These red boxes, shown in Figure 143, represent possible positions at which you can place the instruction. You will also notice that the mouse pointer changes to the RTO icon as soon as the pointer is over the ladder logic. As you move the mouse around the window, you will see that one of the red boxes changes color from red to green and contains a small “X” within the box. This green box represents the point at which the instruction will be inserted. In this example, the insertion point for the instruction is rung 0001. Since the timer is an output instruction, the insertion point is to the right of the box on the far right side of the rung.
N
Figure 143: Insertion Point for RTO Instruction
165
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Release the left mouse button. This inserts the instruction on rung 0001 as shown in Figure 144. The small question mark in the “Timer” field means that an address has not yet been assigned to the instruction.
N
Figure 144: RTO Instruction Inserted into Ladder Logic
166
Introduction to Programmable Logic Controllers How to Assign or Modify a Timer Address Timer addresses are entered in the “Timer” field of the instruction. This address links the timer to a specific location in the T4 data file. There is more than one way to assign an address to a timer. The example searches for an unused address in the T4 data file and then assigns that address to the timer.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Double click the T4 file from the Data Files folder in the project window of RSLogix. This opens the T4 data file popup window shown in Figure 145.
N
Figure 145: T4 Data File Popup Window
167
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Left click the USAGE button from the bottom of the data table window. This changes the display to reflect the logical address usage as shown in Figure 146. Timer addresses are indicated under the “Offset” column. A “W” in the column labeled “FW” indicates timers that are already used in a program.
N
Figure 146: Timer Usage
168
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Move the mouse pointer over the scroll bar located on the right side of the window. Hold the left mouse button down and drag the scroll bar down until you find a timer that is not used. This example uses timer T4:61 as shown in Figure 147.
N
Figure 147: Unused Timer T4:61
169
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Move the mouse pointer over the desired timer address in the “Offset” column of the T4 data file popup window. Hold the left mouse button down and drag the address to the “Timer” field in the RTO instruction as shown in Figure 148. A red box appears in the “Timer” field as soon as you drag the mouse into the window. This red box turns green when the logical address is properly positioned over the “Timer” the field in the instruction.
N
Figure 148: “Timer” Field in RTO Instruction as the Logical Address Target
170
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Release the left mouse button. This assigns the logical address to the timer. A “W” in the “FW” column of the T4 data file popup window identifies the logical address as assigned in the project. The completed logical address assignment is shown in Figure 149.
N
Figure 149: Completed Logical Address Assignment
171
Introduction to Programmable Logic Controllers How to Assign or Modify a Time Base and Preset Two time base settings are available: 0.01 seconds and 1 second. The preset value can be an integer value between 0 and 32,767. Remember that the time base multiplied by the preset value determines the time delay interval of the timer. Changing the Time Base
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Double click the value in the “Time Base” field. This opens the drop down menu shown in Figure 150 containing the two time base options.
N
Figure 150: Time Base Drop Down Menu
172
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Left click the desired time base from the drop down menu. This changes the time base display as shown in Figure 151.
Figure 151: New Time Base Selected
3. Press the ENTER key on the keyboard, or left click the mouse pointer somewhere in the ladder display in order to move the cursor from the “Time Base” field. This enters the new time base into the timer. Note that if you press the ENTER key, the cursor automatically moves down to the “Preset” field for you to change the preset value as illustrated in Figure 152.
N
Figure 152: New Time Base Entered
173
Introduction to Programmable Logic Controllers Changing the Timer Preset 1. Double click the value in the “Preset” field. This opens the field for editing as illustrated in Figure 152.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Enter the new value for the preset using the keyboard as shown in Figure 153. This value should be an integer (which is a number that does not have a decimal point) between 0 and 32767. However, if you enter zero as a preset then your timer will not provide a delay.
Figure 153: New Value Typed into “Preset” Field
N
3. Left click the mouse in a blank area of the ladder logic. This enters the new preset into the timer as shown in Figure 154.
Figure 154: New Preset Entered
174
Introduction to Programmable Logic Controllers How to Program the Timer Status Bits The three timer status bits (timer enabled, timer timing, timer done) provide an indication of what the timer is doing. The timer status bits are programmed using bit input and bit output instructions. A specific status bit is linked to an input (XIC) instruction. The XIC instruction is then programmed to an output (OTE) instruction to reflect the condition of the status bit.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
All three status-bits are programmed in the same manner. This example uses only the timer timing (TT) status bit to illustrate the process of programming. Any actual program usage would depend entirely on your application and individual need. 1. Insert an XIC instruction at the desired location in the ladder logic. The insertion point depends on how you are going to use the instruction. For this example, the XIC instruction will energize the OTE instruction at O:000/11. The output will be on while the timer is timing, and go off when the timer is not timing. The XIC instruction and the OTE instruction are both on rung 0002 as illustrated in Figure 155.
N
Figure 155: XIC Instruction Inserted into Ladder Logic
175
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Double click the T4 file from the Data Files folder in the project window of RSLogix. This opens the T4 data file popup window shown in Figure 156.
N
Figure 156: T4 Data File Popup Window
176
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Scroll the popup window down until you locate the address of the timer. This example uses the retentive timer at address T4:61, which is shown in Figure 157.
N
Figure 157: Timer Address Located in Data File Popup Window
177
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Move the mouse pointer over the “TT” field of timer T4:61. Hold the left mouse button down and drag the mouse to the XIC instruction. Red boxes appear in the ladder logic field as soon as you drag the mouse into the ladder window to indicate valid targets for the logical address assignment. Be sure you drag the mouse to the correct instruction in the ladder logic or you could overwrite an existing logical address at some other bit instruction in the program. The red box over the target XIC instruction turns green when the logical address is properly positioned as shown in Figure 158.
N
Figure 158: XIC Instruction as the Logical Address Target
178
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Release the left mouse button. This assigns the logical address of the timer to the XIC instruction as shown in Figure 159. Notice also the “TT” indication below the XIC instruction instead of a bit number. This reflects the assignment of the XIC instruction to the timer timing status bit of timer T4:61. The timer enabled and timer done status bits carry the abbreviations “EN” and “DN,” respectively, in place of the “TT” indication.
Figure 159: Logical Address Assignment Complete
How to Reset the RTO Accumulator using the RES Instruction
Do not reset a delay timer-off (TOF) with a reset (RES) instruction. This is because the RST instruction resets not only the accumulator, but also the done (.DN) and timing (.TT) status bits as well. Resetting the done bit of a TOF instruction is an indication that the timer is done timing, which could affect the operation of any machine that uses this bit as a trigger.
N
1. Left click the TIMER/COUNTER tab on the instruction menu. This displays all of the timer and counter instructions under the tab as shown in Figure 160. If you forget the name of a particular instruction, holding the mouse pointer over the instruction will display the name in a popup window. The reset instruction is the one on the right side.
Figure 160: Timer Instruction Icons under TIMER/COUNTER Tab of Instruction Toolbar 2. Hold the left mouse button down over the RES instruction in the instruction toolbar.
179
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Drag the mouse into the ladder window. A series of red boxes appears in the ladder logic as soon as you drag the mouse into the window. These red boxes, shown in Figure 161, represent possible positions at which you can place the instruction. You will also notice that the mouse pointer changes to the RES icon as soon as the pointer is over the ladder logic. As you move the mouse around the window, you will see that one of the red boxes changes color from red to green and contains a small “X” within the box. This green box represents the point at which the branch will be inserted. In this example, the insertion point for the instruction is rung 0003. Since the reset is an output instruction, the insertion point is to the right of the box on the far right side of the rung.
N
Figure 161: Insertion Point for RES Instruction
180
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Release the left mouse button. This inserts the instruction on rung 0003 as shown in Figure 162. The small question mark above the instruction field means that a logical address has not yet been assigned.
Figure 162: RES Instruction Inserted into Ladder Logic
N
5. Double click question mark in the highlight bar above the RES instruction. This opens a dialog box, shown in Figure 163, in which the logical address of the timer is entered.
Figure 163: Dialog Box for Logical Address Entry
181
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
6. Type the logical address of the timer. For this example, the RTO at logical address T4:61 is used as shown in Figure 164. Be sure to include the leading letter “T” and the colon in the address. An alternative to directly typing the logical address is opening the T4 data file and dragging the desired timer address to the RES instruction.
Figure 164: Logical Address for the RES Instruction
N
7. Press the ENTER key on the keyboard. This opens a popup for the entry of a symbolic address or descriptive comments as shown in Figure 165.
Figure 165: Symbolic Name/Comment Popup Window
182
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
8. Enter a functional description of the component in the “Edit Description Type” field and, if desired a symbolic address in the “Symbol” field as illustrated in Figure 166.
Figure 166: Comment and Symbolic Name Information
N
9. Left click the OK button from the bottom of the popup window. This enters the symbolic address and comment with the logical address as shown in Figure 167.
Figure 167: Logical Address, Symbolic Address, and Comment
183
Introduction to Programmable Logic Controllers
PROGRAMMING WITH COUNTERS Counters are used to keep track of the number of times that a certain event happens. There are two types of counters: count up and count down. Count-up counters increment an accumulator for each instance of an event, and count-down counters decrement an accumulator. Counters are retentive instructions that maintain their accumulated value regardless of the condition of the input rung. As with the RTO instruction, the accumulator value of a counter is zeroed using a reset (RES) instruction. There are two counter instructions available through RSLogix 5: Count Up Counter (CTU) Count Down Counter (CTD)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
• •
COUNTER OPERATION
Several parameters define the operation of counters. These parameters include the following: • • • • •
Counter type (up counter or down counter) Counter address Counter preset value Counter accumulator value Counter status bits
Counter Type
N
The type defines how the accumulator value changes as the counter keeps track of the triggering events. The up counter increments the accumulator and the down counter decrements the accumulator. The type also defines how the status bits are used with the counter.
184
Introduction to Programmable Logic Controllers Count Up Counter (CTU)
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The count-up counter is represented by the CTU instruction in the ladder logic. An example of a CTU instruction is shown in Figure 168.
Figure 168: CTU Instruction
The CTU instruction counts up over a range of -32,768 to +32,767. The accumulator increments by one unit each time the input to the instruction goes from false to true. When the accumulated value equals or exceeds the preset value, the CTU instruction sets the done (DN) status bit. The accumulated value of the counter is retentive. The accumulator is reset to zero using the reset (RES) instruction. Count Down Counter (CTD)
N
The count-down counter is represented by the CTD instruction in ladder logic. example of a CTD instruction is shown in Figure 169.
An
Figure 169: CTD Instruction
The CTD instruction counts down over a range from +32,767 to -32,768. The accumulator decrements by one unit each time the input to the instruction goes from false to true. The done (DN) status bit is set as long as the accumulated value is greater than or equal to the preset value. The DN bit is reset to zero when the accumulated value is less than the preset value. The accumulated value of the counter is retentive. The accumulator is reset to zero using the reset (RES) instruction.
185
Introduction to Programmable Logic Controllers Counter Address Each counter has a unique address in the data table of the PLC-5 memory. Data file C5 is reserved for counters. There is room for 1000 counters in data file C5 numbered from C5:0 to C5:999. Use the lowest available number when programming a new counter in order to conserve memory space. Each counter address references three words of data table memory. One of these words holds the counter preset value, one word holds the accumulated value, and one word holds the status bits that are used for output control of the counter.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Counter Preset Value
The counter preset specifies the target to which the counter is counting. Acceptable preset values are integer numbers ranging from -32,768 to +32,767, regardless of whether the counter is counting up or down. You cannot enter a preset value that contains a decimal point. Counter Accumulator Value
The accumulator stores the current value of the counter. The accumulator either increments (for up counters) or decrements (for down counters) each time the counter is triggered. The accumulator continues to change with each trigger, even though the preset value is exceeded. Counter Status Bits
There are five status bits in the counter status word. These status bits can be used in the ladder program to trigger some event. The processor changes the state of status bits depending on the condition of the counter. Counters have the following status bits: Count Up Enable Bit (CU) (bit 15) is set when the rung goes true to indicate that the counter is enabled as an up counter. The CU bit is reset when the rung goes false or when reset by a RES instruction.
•
Count Down Enable Bit (CD) (bit 14) is set when the rung goes true to indicate that the counter is enabled as a down counter. The CD bit is reset when the rung goes false or when reset by a RES instruction.
N
•
186
Introduction to Programmable Logic Controllers Done Bit (DN) (bit 13) is set by the processor when the accumulated value is greater than or equal to the preset value. This means that the DN bit is set (on) for a down counter while a down counter is in the process of counting down to the preset value. The DN bit is reset (off) for an up counter while the counter is in the process of counting up to the preset. The done bit is reset when the accumulated value count is less than the preset value. The done bit is also reset by the RES instruction.
•
Count Up Overflow Bit (OV) (bit 12) is set by the processor to show that the up counter has exceeded the upper limit of +32,767 and has wrapped around to 32,768. The CTU instruction continues to count up from there.
•
Count Down Underflow Bit (UN) (bit 11) is set by the processor to show that the down counter has exceeded the lower limit of -32,768 and has wrapped around to +32,767. The CTD instruction continues to count down from there.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
•
All of the bits are reset with a RES instruction that has the same address as the counter instruction. Wrapping around to -32,768 with a CTU instruction can reset the underflow bit, and wrapping around to +32767 with a CTD instruction can reset the overflow bit.
USING COUNTER INSTRUCTIONS
This section of the module discusses programming with counters. This includes dragging a counter into a program, and resetting the counter. Creating a counter that counts up and down is also discussed. How to Insert a New Counter into a Program
A counter is a type of output instruction. This means it is programmed on the right side of the ladder logic.
N
1. Left click the TIMER/COUNTER tab on the instruction menu. This displays all of the timer and counter instructions under the tab as shown in Figure 170. If you forget the name of a particular instruction, holding the mouse pointer over the instruction will display the name in a popup window.
Figure 170: Counter Instruction Icons under TIMER/COUNTER Tab of Instruction Toolbar
187
Introduction to Programmable Logic Controllers 2. Hold the left mouse button down over the specific counter instruction in the instruction toolbar. A CTU instruction (located third from the right side of the instruction toolbar) is used in the following steps.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Drag the mouse into the ladder window. A series of red boxes appears in the ladder logic as soon as you drag the mouse into the window. These red boxes, shown in Figure 171, represent possible positions at which you can place the instruction. You will also notice that the mouse pointer changes to the CTU icon as soon as the pointer is over the ladder logic. As you move the mouse around the window, you will see that one of the red boxes changes color from red to green and contains a small “X” within the box. This green box represents the point at which the instruction will be inserted. In this example, the insertion point for the instruction is rung 0012. Since the counter is an output instruction, the insertion point is to the right of the box on the far right side of the rung.
Figure 171: Insertion Point for CTU Instruction
188
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Release the left mouse button. This inserts the instruction on rung 0012 as shown in Figure 172. The small question mark in the “Counter” field means that an address has not yet been assigned to the instruction.
N
Figure 172: CTU Instruction Inserted into Ladder Logic
189
Introduction to Programmable Logic Controllers How to Assign or Modify a Counter Address Timer addresses are entered in the “Counter” field of the instruction. This address links the counter to a specific location in the C5 data file. There is more than one way to assign an address to a counter. The example searches for an unused address in the C5 data file and then assigns that address to the counter by typing it into the “Counter” field of the instruction.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Double click the C5 file from the Data Files folder in the project window of RSLogix. This opens the C5 data file popup window shown in Figure 173.
N
Figure 173: C5 Data File Popup Window
190
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Left click the USAGE button from the bottom of the data table window. This changes the display to reflect the logical address usage as shown in Figure 174. Counter addresses are indicated under the “Offset” column. A “W” in the column labeled “FW” indicates counters that are already used in a program.
Figure 174: Counter Usage
3. Scroll the data file window down, if necessary, to locate an unused counter. Since there are already several available counters in the window, this example uses timer C5:2 as shown in Figure 174.
N
4. Double click the “Counter” field from the counter instruction whose logical address is being assigned. This opens a dialog box, shown in Figure 175, in which the logical address of the counter is entered.
Figure 175: Dialog Box for Logical Address Entry
191
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Type the first letter of the logical address of the counter, which in this example is the letter “C.” This opens a small popup menu shown in Figure 176 from which you can select from a list of instruction types and other instructions beginning with that letter.
Figure 176: Instruction Type Popup Menu
6. Double click the “C, Counter” instruction type from the popup menu. This opens another popup menu, shown in Figure 177, that shows the available logical addresses for the counter. The entry in the list is that of the first open C5 data file address, C5:2, which is what is being assigned in this example.
N
Figure 177: Logical Address Popup Menu
192
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
7. Double click the “5:2” entry from the popup menu, then left click the mouse anywhere in an open area of the ladder logic. This assigns the logical address for the counter as shown in Figure 178.
Figure 178: Completed Logical Address Assignment
How to Assign or Modify a Preset Value at the Instruction
1. Double click the value in the “Preset” field. This opens the field for editing as illustrated in Figure 179.
N
Figure 179: “Preset” Field Open for Editing
193
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Enter the new value for the preset using the keyboard as shown in Figure 180. Acceptable preset values are integer numbers ranging from -32,768 to +32,767, regardless of whether the counter is counting up or down. You cannot enter a preset value that contains a decimal point.
Figure 180: New Value Typed into “Preset” Field
3. Left click the mouse in a blank area of the ladder logic. This enters the new preset into the counter as shown in Figure 181.
N
Figure 181: New Preset Entered
194
Introduction to Programmable Logic Controllers How to Assign or Modify a Preset Value using the C5 Data File
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Double click the C5 file from the Data Files folder in the project window of RSLogix. This opens the C5 data file popup window shown in Figure 182.
N
Figure 182: C5 Data File Popup Window
195
Introduction to Programmable Logic Controllers 2. If necessary, scroll the data file window down to the counter being changed. This example uses counter at logical address C5:2.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Double click the value in the “PRE” field for the counter whose preset value is being changed. This opens a dialog box, shown in Figure 183, in which to enter the logical address of the timer.
N
Figure 183: Preset Field Open for Editing
196
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Type the new preset value into the “pre” field then press the enter key on the keyboard. This enters the new preset value into the data file. The change is also reflected at the counter as shown in Figure 184.
N
Figure 184: New Preset Value Entered
197
Introduction to Programmable Logic Controllers How to Create an Up/Down Counter
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
A counter that counts up and counts down can be created with a CTU instruction and a CTD instruction that have the same logical address. This allows both counters to share the same preset, accumulator, and status bits. When the CTU rung goes true, the accumulator value will increase and when the CTD rung goes true, the same accumulator value will decrease. It is important to discriminate between the inputs to the two different counters. Poor programming could cause both counters to try to count up and count down at the same time. The ladder logic in Figure 185 shows how the count up/count down counters are programmed.
N
Figure 185: Count Up/Count Down Ladder Logic
198
Introduction to Programmable Logic Controllers
TROUBLESHOOTING This section introduces a variety of tools available through RSLogix that enable you to quickly locate and isolate problems. These tools allow you to search for specific instructions; override, or force bit inputs and outputs in the ladder logic; and trend the flow of information almost anywhere in a project.
SYSTEMATIC TROUBLESHOOTING
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The following steps outline a systematic method of locating and isolating control system faults. Keep in mind that the majority of problems will be in the plant, not in a PLC program. 1. Locate the output in the ladder logic that is not energizing.
2. Trace the output backwards across the rung to the input instruction that is breaking logical continuity. 3. Right click the mouse over the input instruction that is breaking continuity and select FIND ALL from the popup menu. This displays all instances of the logical address in the Search Results window located at the bottom of the display. 4. Left click the instance in the Search Results window where the logical address is attached to an output instruction. This moves the cursor to that instruction in the ladder logic.
N
5. Repeat from step 1 until you find the “real world” input device causing the problem.
199
Introduction to Programmable Logic Controllers There are a few exceptions to the systematic troubleshooting process. Make sure none of these exceptions apply before using the systematic process. If the output that is not energizing is located within a subroutine, make sure the subroutine is actually being called. None of the instructions within a subroutine will execute until the main program calls the subroutine.
•
Make sure the output being investigated is not within an active JMP to LBL zone or MCR zone. Any instructions within these active zones will be skipped.
•
If the address attached to an instruction being investigated is a status bit address, make sure to search for the full address and not the status bit address (For example, instead of searching for T4:0/TT, search for T4:0 because a timer is an output instruction).
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
•
CLEARING PROCESSOR MEMORY
N
Clearing processor memory removes any program currently running on the processor, and switches the processor offline. You must be online with the processor with the processor in program mode before you can clear memory. You will then have to download a project to the processor to resume operation.
200
Introduction to Programmable Logic Controllers How to Clear Processor Memory Clearing memory erases any project that is currently running on the processor. This will stop production if the line is operating normally.
1. Go online with the processor whose memory is being cleared.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Open the on-line drop down menu as shown in Figure 186.
Figure 186: On-Line Drop Down Menu
This opens the confirmation
N
3. Select PROGRAM from the drop down menu. popup window shown in Figure 187.
Figure 187: Change Mode Confirmation Popup Window
201
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Left click the YES button from the popup window. This switches the processor to the program mode as indicated by the on-line bar shown in Figure 188.
Figure 188: Processor in Program Mode
N
5. Open the Comms drop down menu as shown in Figure 189.
Figure 189: Comms Drop Down Menu
202
Introduction to Programmable Logic Controllers 6. Select CLEAR PROCESSOR MEMORY from the drop down menu. This opens the confirmation popup window shown in Figure 190.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 190: Clear Memory Confirmation Popup Window
N
7. Left click the OK button from the popup window. This clears processor memory and takes the processor off line. Another confirmation popup opens asking if you want to save changes to your program. Make the appropriate selection from the confirmation window. You may then go online with the processor or download another project to the controller.
203
Introduction to Programmable Logic Controllers FORCING I/O BITS Use extreme caution when forcing I/O bits. Forcing a point may cause sudden or unexpected movement in associated equipment. This could cause injury to nearby personnel or damage to the equipment.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Forcing I/O turns specific I/O bits on or off and they remain in that state until the force is removed. A force can be thought of as a software jumper because it allows you to bypass a device. If an input sensor fails during production, for example, the input could be forced in the software in order to complete the production run. The faulty sensor can then be replaced during the down turn.
204
Introduction to Programmable Logic Controllers RSLogix uses force tables to keep track of the points that are forced in the software. These force tables, which are similar to data tables, are logically located between the I/O modules and the image tables. The positioning of the force tables relative to the image tables is illustrated in Figure 191. INPUT IMAGE TABLE 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OUTPUT IMAGE TABLE
OUTPUT MODULE
INPUT MODULE
........ ........ . . . . . . . . . . . . . .0 .
........ ....... ........ ....... . . . . . . . . 1. . . . . . .
1
1
INPUT FORCE TABLE
OUTPUT FORCE TABLE
LOAD
PB
I:002
OFF
01
O:003
ON
07
Figure 191: Force Table Positioning Diagram
N
The position of the force tables has a significant impact on the program execution in the following ways: •
Input instructions that examine the input image table are affected by what is in the input force table.
•
Output instructions that control a bit/bits in the output image table do not affect the output force table.
•
Input instructions that examine the output image table cannot be forced.
•
Output instructions that control a bit in the input image table cannot be forced.
205
Introduction to Programmable Logic Controllers Only live I/O points can be forced (bits that are in an input or an output word). Live I/O points are those I/O points that are physically attached to and configured in the system. Forces cannot be applied to timers, counters, binary, or integer bits. There are two steps involved in forcing a bit in a project. These are: • •
Install the force. Enable the force.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Forces are installed individually at each instruction in the ladder logic. When you enable forces, however, all of the forces installed in the project become active at the same time. Forces should be removed from the software when no longer needed. Any forces that are not removed become active again when forces are enabled.
How to Determine the Status of Forces in a Project
Always check the status of forces before installing a new force. Enabling forces with other forces previously installed may cause immediate and unexpected equipment motion.
N
The status of forces is displayed in two status lines of the on-line bar as shown in Figure 192. The upper status line identifies whether a project has forces installed or not. The bottom status line identifies whether the forces are enabled or disabled. Figure 192 illustrates a project with no forces installed.
Figure 192: Force Status Indications
206
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The online bar for a project with at least one force installed but not enabled is shown in Figure 193. The upper force status line indicates “Forces Installed” and the background color changes from white to green.
Figure 193: Forces Installed but Not Enabled
The online bar for a project with at least one force installed and enabled is shown in Figure 194. The lower force status line indicates “Forces Enabled” and the background color changes from white to yellow.
N
Figure 194: Forces Installed and Enabled
207
Introduction to Programmable Logic Controllers How to Install and Remove a Force Using Popup Menus Installing a force at one logical address forces the instruction everywhere it is used in the project.
1. Move the part being forced into the ladder logic display.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Install the force. Right click the mouse over the part being forced. This opens the popup menu shown in Figure 195. The actual menu selections will depend on the status of the instruction. An instruction that is not already forced, as in this example, has two options: FORCE ON and FORCE OFF located at the bottom of the popup menu.
Figure 195: Popup Menu with Install Force Selections
208
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Choose the appropriate selection from the popup menu. Note that forcing an XIO instruction ON will turn the instruction OFF. Likewise, forcing an XIO instruction OFF will turn the instruction ON. This example forces ON the input instruction at address I:000/4. The instruction on rung 0003 is an XIC, and the instruction on rung 0004 is an XIO. However, both instructions share the same logical address. Figure 196 illustrates the appearance of an instruction that is forced ON. The label “ON” appears at the bottom of the part, just to the left of the bit number. The online bar has been moved into the ladder logic to show how RSLogix reflects the status of the installed forces.
Figure 196: Inputs Forced ON
N
4. Enable the force. Left click the mouse over the “Forces Disabled” down-arrow from the online bar. This opens the drop down menu shown in Figure 197.
Figure 197: Drop Down Menu with Enable Force Selection
209
Introduction to Programmable Logic Controllers 5. Left click ENABLE ALL FORCES. This opens the confirmation popup window shown in Figure 198.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Figure 198: Enable Forces Confirmation Popup Window
N
6. Left click the YES button from the confirmation window. All of the installed forces in the project now become active as illustrated in Figure 199. The “ON” text below the instruction changes color from black to red, and a “>” (greater than) symbol appears next to the text indicating the part is now forced ON. Highlight bars also appear on either side of the instruction to reflect the current status, and the online bar indicates that forces are enabled in the project. Notice the difference between the XIO and XIC instructions in Figure 199, even though both parts are forced ON.
Figure 199: Forces Enabled
210
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
7. Remove the force. You may remove any force without first disabling it. This allows all of the other forces in the project to remain active while you remove only the forces that are no longer required. The I:000/5 instruction on rung 0003 has been forced OFF, as shown in Figure 200, to illustrate the response of RSLogix when selected forces are removed.
N
Figure 200: Multiple Forces in Project
211
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
8. Right click the mouse over the part whose force is being removed. This opens the popup menu shown in Figure 201. The actual menu selections will depend on the status of the instruction. An instruction that is already forced ON, as in this example, has two options: REMOVE FORCE and FORCE OFF located at the bottom of the popup menu.
N
Figure 201: Popup Menu with Remove Force Selections
212
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
9. Select REMOVE FORCE from the popup window. This removes the force from the selected logical address, but leaves other forces in the project active as indicated in Figure 202.
N
Figure 202: Selected Force Removed
213
Introduction to Programmable Logic Controllers How to Install and Remove a Force Using the Force Tables
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Forces can be installed using the two force files located in the Force Files folder of the Project window as shown in Figure 203. The two force files are labeled O0 (output force file) and I1 (input force file).
N
Figure 203: Force Files in Project Window
214
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Double click the O0 (output force file) or I1 (input force file) icon in the Force Files folder of the Project window. This opens a popup window for the respective force file. The Output Force File is shown in Figure 204 as an example. A “1” in the display means that the corresponding logical address is forced ON, and a “0” means the corresponding address is forced OFF. A “.” (period) represents an address that is not forced.
N
Figure 204: O0 (Output Force File) Popup Window
215
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Scroll down in the popup window until you see the address being forced. This example uses output address O:015/7 as shown in Figure 205.
Figure 205: Output Address to Force
N
3. Left click the address being forced in the popup window.
216
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Install the force. Type a “1” or a “0” to set the force ON or OFF, respectively, and then press the ENTER key on the keyboard. The force data is reflected in both the popup window and at the instruction in the ladder logic as shown in Figure 206. Notice how the force installation is reflected in the online bar.
Figure 206: Force Installed
5. Enable the force. Left click the ENABLE button from the popup window. This opens the confirmation popup window shown in Figure 207.
N
Figure 207: Enable Forces Confirmation Popup Window
217
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
6. Left click the YES button from the confirmation window. All of the installed forces in the project now become active as illustrated in Figure 208. The “ON” text below the instruction changes color from black to red, and a “>” (greater than) symbol appears next to the text indicating the part is now forced ON. All of the status information in the popup window changes color from black to red, indicating forces are enabled.
N
Figure 208: Force Enabled
218
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
7. Remove the force. You may remove any force without first disabling it. This allows all of the other forces in the project to remain active while you remove only the forces that are no longer required. Right click the mouse over the address of the instruction with the force being removed. This opens the popup menu shown in Figure 209. The actual menu selections will depend on the status of the instruction. An instruction that is already forced OFF as in this example, has several options including removing or changing the force at the selected address, removing all forces, or disabling all forces.
N
Figure 209: Popup Menu with Remove Force Selections
219
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
8. Select REMOVE FORCE – O:015/7 from the popup menu. This removes the force from the instruction as shown in Figure 210. The force indication on the online bar also changes since this was the only force in the software.
N
Figure 210: Force Removed
220
Introduction to Programmable Logic Controllers CROSS REFERENCING INSTRUCTIONS
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
The cross-reference report is a list of all instances of a given logical address in the ladder logic. The cross-reference list, shown in Figure 211, includes the project file number, rung number, description, and symbolic address of each instruction the project.
N
Figure 211: Cross Reference Report – Sorted by Address
221
Introduction to Programmable Logic Controllers How to Open the Cross Reference Report The cross-reference report opens from either the ladder window or the project window. From the Ladder Window 1. Scroll the ladder window to the instruction being cross-referenced.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Right-click the mouse over the address of the instruction. This opens the popup menu for the instruction as shown in Figure 212. If you are opening the popup from an instruction containing multiple data fields, as with the timer in Figure 212, make sure you highlight the address of the instruction and not some other data field. You will not get the cross-reference option in the popup menu if the mouse is not over the address.
Figure 212: Cross Reference Popup Window
222
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Select CROSS REFERENCE from the popup window. This selection will also indicate the target address of the cross-reference report. The cross-reference report opens with the target address at the top of the window as shown in Figure 213.
N
Figure 213: Cross-Reference Report for Address Selected in Ladder Window
223
Introduction to Programmable Logic Controllers From the Project Window
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Open the Data Files folder in the project window. The cross-reference selection is the first file in the folder as shown in Figure 214.
N
Figure 214: Data Files Folder Open in Project Window
224
Introduction to Programmable Logic Controllers This opens the cross-reference
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Double click the CROSS REFERENCE file. report shown in Figure 215.
Figure 215: Cross Reference Report Open
N
3. Scroll the display in the cross-reference report down until the desired address is in the display.
225
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Double click the rung number for the instruction. This moves the cursor in the ladder window over the instruction at the selected rung as shown in Figure 216.
N
Figure 216: Address in Ladder Window Selected from Cross-Reference Report
226
Introduction to Programmable Logic Controllers DATA TABLE MONITORING The data table files are all of the files within the Data File folder in the Project window. Each file contains information specific to the logical addresses contained within the file. Any data table file can be used to monitor or change the information stored at a specific address. You can also use the data tables to determine which logical addresses are used in the ladder logic.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
An example of a data table is shown in Figure 217. Each data table consists of a grid of logical addresses that displays the data stored at each address. The data table also displays any symbolic address or description associated with a selected address.
N
Figure 217: Data Table
227
Introduction to Programmable Logic Controllers How to Open a Data Table The data tables open from either the ladder window or the project window. From the Ladder Window 1. Scroll the ladder window to the instruction for which the data table is being opened.
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Right-click the mouse over the address of the instruction. This opens the popup menu for the instruction as shown in Figure 218.
Figure 218: Data Table Popup Window
228
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Select GO TO DATA TABLE from the popup window. This selection will also indicate the target address of the data table. The data table opens with the target address highlighted in the as shown in Figure 219.
N
Figure 219: Data Table for Address Selected in Ladder Window
229
Introduction to Programmable Logic Controllers From the Project Window
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Open the Data Files folder in the project window. The data files are listed below the cross-reference file as shown in Figure 214.
N
Figure 220: Data Files Folder Open in Project Window
230
Introduction to Programmable Logic Controllers 2. Double click the desired data file. The file type abbreviations are described in Table 21 Table 21: Data File Type Abbreviations File Type
Notes
Output image table Input image table Status Bit or binary Timers Counters Control Integer Floating-point User assigned
Bits in this memory area control the status of all outputs. Bits in this memory area indicate the status of all inputs. Processor configuration and status report. Binary (0 or 1) information. Timer information. Counter information. Used for advanced file instructions. Integer values in the range -32,768 to +32,767. Numbers containing a decimal point such as 5.6 or 6.2. User assigned file types as needed. Timers and counters may also use these file numbers.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
File No. O0 I1 S2 B3 T4 C5 R6 N7 F8 9 - 999
N
Double clicking any abbreviation opens a data file for the corresponding selection. An example of the T4 (timer) data table is shown in Figure 221.
Figure 221: Data Table Open
231
Introduction to Programmable Logic Controllers How to Change Values Using a Data Table
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Open the data table and locate the desired address within the table. The N10 (integer) data table is shown in Figure 222 as an example. Figure 222 shows address N10:22 contains the value “10” which is being used in a division instruction.
N
Figure 222: N10 Data Table for Address N10:22
232
Introduction to Programmable Logic Controllers 2. Left click the mouse over the value in the data table that is being changed.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Type the new value. As an example, type “1550” as illustrated in Figure 223.
Figure 223: New Value in Data Table
N
4. Press the ENTER key on the keyboard. This changes the value in the data table, which changes the data at the instruction as shown in Figure 224.
Figure 224: Value Changed through Data Table
233
Introduction to Programmable Logic Controllers SEARCHING Search functions allow you to locate specific addresses, data types, or descriptions within the ladder logic, and then navigate to the various instances returned by the search. There are a variety of ways to perform a search. These include using popup menus at the instruction, using drop down menus from the Windows toolbar, and using specific buttons on the standard toolbar. How to Search using Popup Menus at an Instruction
N
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Right click the mouse over an instruction in the ladder logic. This opens a popup window at the instruction as shown in Figure 225. The output instruction at logical address O:011/16 is used in this example.
Figure 225: Find All Popup Menu
234
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Select FIND ALL from the popup menu. This opens the Search Results window at the bottom of the display. The results window, shown in Figure 226, displays all instances of the address in the project. The results contain the project file number and rung number of the instruction, and the instruction type.
N
Figure 226: Search Results Window for O:011/16
235
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Left click any instance in the Search Results window to go to the instruction in the ladder logic. An example is shown in Figure 227, in which the XIC instruction of rung 0148 was selected from the Search Results window.
N
Figure 227: Going to an Instruction in the Ladder Logic from a Search Result
236
Introduction to Programmable Logic Controllers How to Search using Drop Down Menus from the Windows Toolbar
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Left click the SEARCH selection from the Windows toolbar located at the top of the RSLogix window. This opens the Search drop down menu shown in Figure 228. There are several functions available through the drop down menu including: FIND, REPLACE, GOTO, FIND NEXT, and FIND PREVIOUS.
N
Figure 228: Search Drop Down Menu
237
Introduction to Programmable Logic Controllers Find
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Selecting FIND from the Search drop down menu opens the Find popup menu shown in Figure 229.
Figure 229: Find Popup Window
1. Enter the address or mnemonic of the instruction into the “Find What:” field. 2. Select the “Direction” as either UP or DOWN. When initiated, the search will proceed in the selected direction from the current location of the cursor in the ladder logic.
N
3. Select the “Scope” as either GLOBAL if you want to search all program files in the project, or LOCAL if you want to restrict the search to the ladder file that is currently open in the display. 4. Selecting the various items in the “Advanced” field allows you to search for more than one item at a time. You cannot search for a field if it is not checked.
238
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Left click the FIND NEXT button to search for the next instance of the instruction, or FIND ALL to locate all instances of the instruction. Selecting FIND ALL opens the Search Results window at the bottom of the display with all instances of the instruction. The results of a FIND ALL search are shown in Figure 230. Selecting any entry from the Search Results window moves the cursor to that location in the ladder logic.
N
Figure 230: FIND ALL Search Results
239
Introduction to Programmable Logic Controllers Replace
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Selecting REPLACE from the Search drop down menu opens the Replace popup menu shown in Figure 231. The functions in the Replace window are similar to that of the Search window, with the exception of the “Replace With:” field, and the REPLACE and REPLACE ALL buttons. The search criteria that you enter into the “Find What:” window will be replaced with the entry in the “Replace With:” field when you start the replacement function. The REPLACE button replaces only one instance at a time. The REPLACE ALL button replaces every instance at one time.
N
Figure 231: Replace Popup Window
240
Introduction to Programmable Logic Controllers Go To
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Selecting GOTO from the Search drop down menu opens the popup window shown in Figure 232. The Go To popup window allows you to quickly find a specific project file; data table file; rung or address in the ladder logic; or cross-reference report.
Figure 232: Go To Popup Window
N
1. Enter the search criteria into the “Enter program location:” field. RSLogix recognizes the format of the search criteria and will change the “Go to What:” button to match the format of your input. However, you open the cross-reference report by first clicking the CROSS REFERENCE button. The symbolic name “PL8” is entered as an example of a program location as shown in Figure 233. The “Go to What:” button automatically changes to ADDRESS/SYMBOL.
Figure 233: Go To Example
241
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Left click the GOTO button. This opens the selected file. The Address/Symbol Editor popup window opens if, as in this example, a symbolic name is entered as the go to target. The popup window opens with the desired symbol highlighted in the display as shown in Figure 234.
Figure 234: Address/Symbol Editor Popup Window
N
3. Right click the mouse over the selected address to open a popup menu, shown in Figure 235, with additional options for data manipulation and searching.
Figure 235: Additional Options Available through Popup Menu
242
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
4. Selecting FIND ALL from the popup menu opens the Search Results window, which displays all instances of the selected instruction. An example of the Search Results window is shown in Figure 236. You can select from any entry in the Search Results window and navigate to that instruction in the ladder logic. Note that you may have to close the Address/Symbol Editor window, or drag the window out of the way, to view the ladder logic behind it.
N
Figure 236: Search Results from Address/Symbol Editor
243
Introduction to Programmable Logic Controllers How to Search Using the Standard Toolbar
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
Searches can be performed from the standard toolbar using the search entry box in combination with the three FIND buttons shown in Figure 237. The FIND buttons are FIND PREVIOUS, FIND NEXT, and FIND ALL.
N
Figure 237: Search Entry Box and FIND Buttons
244
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
1. Type the search criteria into the search entry box. The search criteria can be a specific address (such as B3:000/1) or an instruction type (such as TON or XIC). Consider an example that searches for a delay timer-on instruction as shown in Figure 238. Notice that TON is entered for the search criteria, and the current position of the cursor in the ladder logic is over the TON on rung 0105.
N
Figure 238: Searching for TON Instruction
245
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Left click FIND NEXT button or FIND PREVIOUS button to search the ladder logic forward or backward, respectively, for the next instance of the search criteria. The search proceeds from the current position of the cursor. Figure 239 illustrates the results after selecting FIND NEXT. The cursor has moved from TON instruction on rung 0105 to the TON instruction on rung 0112.
N
Figure 239: Result of FIND NEXT for TON Instruction
246
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Left click the FIND ALL button to locate all instances of the selected search criteria. Selecting FIND ALL opens the Search Results window, shown in Figure 240, below the display with a list of everything meeting the search criteria. Selecting any instance of the instruction from the Search Results window moves the cursor to that location in the ladder logic.
N
Figure 240: Result of FIND ALL for TON Instruction
247
Introduction to Programmable Logic Controllers HISTOGRAMS
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
A histogram is a graph of how the data is changing at a particular location in the ladder logic. A histogram can only be developed for one word address at time. Histogram data can either be viewed on the display or saved in a file on disk for later analysis. An example of a histogram is shown in Figure 241.
Figure 241: Histogram
The histogram contains the following components:
START/STOP buttons: These buttons start or stop the development of the trend in the lower portions of the window.
•
Address field: The address contains the address of the word being trended by the histogram. You may type this directly, or drag an address from a data file.
•
Mask field: The mask allows you to inhibit trending of specific bits within a word of data. The mask is a hexadecimal-format number (FH = 11112, and FFFFH = 11111111111111112). A “1” in the mask allows trending, and a “0” in the mask inhibits trending.
N
•
248
Introduction to Programmable Logic Controllers Radix field: The radix is the base of the number being trended in the top half of the split window. Selections available through the drop down menu are decimal, binary, octal, and hexadecimal.
•
Time Base field: The time base defines how often the address is examined in order to build the histogram. The maximum rate of sampling is 10 ms.
•
Elapsed Time field: Identifies the time elapsed from when the START button was pressed. The elapsed time will reset to zero if the histogram is stopped then restarted.
•
Log to File/Log to View: These fields allow you to save to disk or view on the display the histogram. When saved to disk the default file name of the histogram is Hist.log. This history log will continue to grow until the hard disk is filled, if the histogram is selected to run that long.
•
Split window display: The upper half of the split window displays the raw data of the target address, and the lower half is a graphical display of how the data changes at each bit within the target.
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
•
How to Create a Histogram
N
1. Open the Comms drop down menu from the Windows toolbar as shown in Figure 242.
Figure 242: Comms Drop Down Menu
249
Introduction to Programmable Logic Controllers This opens the
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
2. Left click HISTOGRAM from the Comms drop down menu. Histogram popup window shown in Figure 243.
N
Figure 243: Histogram Popup Window
250
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
3. Enter the target address of the data being sampled in the “Address” field. You may type the address directly, or drag an address from the ladder logic or data file as shown in Figure 244.
Figure 244: Entering Target Address
N
4. Change the mask, radix, time base, and log destination options as necessary.
251
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
5. Right click the mouse while the mouse pointer is over the Histogram popup window. This opens the Histogram Properties popup menu shown in Figure 245.
N
Figure 245: Histogram Popup Menu
252
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
6. Left click PROPERTIES from the Histogram popup window. This opens the Histogram Properties popup window shown in Figure 246. You may change the target destination of the log file if the histogram is being saved to disk, change graph colors, and assign names to each pen through the Histogram Properties popup window. Pen names are assigned by left clicking the desired bit, entering the new name, then pressing the ENTER key on the keyboard. The default name of “Bit 0” is changed to “Test Bit” in the example shown in Figure 246.
N
Figure 246: Histogram Properties Popup Window
7. Left click the OK button from the Histogram Properties popup window when you are satisfied with the setup. This closes the window and returns you to the Histogram window.
253
Introduction to Programmable Logic Controllers
F ot or Fo R e r R vi e ep w ro O du nly ct , io n
8. Left click the START button to begin trending. The raw data will scroll in the upper half of the split window, and the histogram begins building in the lower half of the window as shown in Figure 247. Notice the label for bit 0 reflects the text that was entered in the Histogram Properties window.
Figure 247: Creating Histogram Trends
N
9. Left click the STOP button to halt the histogram.
254
View more...
Comments