INTRODUCTION TO
PROGRAMMABLE LOGIC
CONTROLLERS
Second Edition
by
Gary Dunning
Introduction to Programmable Logic Controllers, Second Edition by Gary Dunning
Business Unit Director: Alar Elken
Acquisitions Editor: Mark Huth Development: Dawn Daugherty
Executive Marketing Manager: Maura Theriault
Channel Manager: Mona Caron
Executive Production Manager: Mary Ellen Black
Production Editor: Barbara L. Diaz Art/Design Coordinator: Rachel Baker
Cover Design:
Cummings Advertising/Art, Inc
NOTICE TO THE READER
Publisher does not warrant or guarantee any of the products described herein or perform any independent analysis in connection with any of the product information contained herein. Publisher does not assume, and expressly disclaims, any obligation to obtain and include information other than that provided to it by the manufacturer.
The reader is expressly warned to consider and adopt all safety precautions that might be indicated by the activities herein and to avoid all potential hazards. By following the instructions contained herein, the reader willingly assumes all risks in connection with such instructions. The Publisher makes no representation or warranties of any kind, including but not limited to, the warranties of fitness for particular purpose or merchantability, nor are any such representations implied with respect to the material set forth herein, and the publisher takes no responsibility with respect to such material. The publisher shall not be liable for any special, consequential, or exemplary damages resulting, in whole or part, from the readers use of, or reliance upon, this material.
COPYRIGHT2002 by Delmar, a division of Thomson Learning, Inc. Thomson Learning is a trademark used herein under license Printed in the United States of America
1 2 3 4 5 XXX 05 04 02 01 00 For more information contact Delmar, 3 Columbia Circle, PO Box 15015, Albany, NY 12212-5015.
Or find us on the World Wide Web at http://www.delmar.com
ALL RIGHTS RESERVED. Portions of this work1998. No part of this work covered by the copyright hereon may be reproduced or used in any form or by any means graphic, electronic, or mechanical, including photocopying, recording, taping, Web distribution or information storage and retrieval systems without written permission of the publisher.
For permission to use material from this text or product, contact us by
Tel (800) 730-2214 Fax (800) 730-2215 www.thomsonrights.com
Library of Congress Cataloging-in-Publication Data Dunning, Gary.
Introduction to programmable logic controllers / by Gary Dunning. 2nd ed.
p. cm. Includes index.
ISBN 0-7668-1768-7 (alk. paper) 1. Programmable controllers. I. Title.
TJ223.3.3.P76 D86 2001
TABLE OF CONTENTS
Preface ix
Acknowledgments xi
Part I Introduction to PLCs
CHAPTER 1 Welcome to the World of Programmable Logic Controllers. . . . 3
What Is a Programmable Logic Controller (PLC)? . . . . 4
Where Did the PLC Come From?. . . . 5
Why Use a PLC? . . . . 6
What Makes a PLC Work? . . . . 8
How Do PLCs Know What They Are Supposed to Do? . . . . 8
How Do Instructions Get into the PLC’s Memory? . . . . 9
Innovations Incorporated into the Programmable Controller . . . . 11
Introduction to Fixed and Modular PLC Hardware . . . . 16
The Central Processing Unit. . . . 23
CHAPTER 2 Micro Programmable Logic Controllers . . . . 31
Overview of Selected Micro PLCs . . . . 33
GE Fanuc Automation VersaMax Controllers . . . . 33
GE Fanuc Automation Series 90 Micro PLC . . . . 37
The Mitsubishi FX2N Super Micro . . . . 39
Omron’s CPM1A Series Micro PLC. . . . 44
Rockwell Automation’s MicroLogix 1000 Microcontroller . . . . 45
Rockwell Automation’s MicroLogix 1500 Microcontroller . . . . 46
Siemens Simatic S7-200 Micro PLC. . . . 50
CHAPTER 3 Programming a Programmable Controller . . . . 57
Handheld Programming Terminals . . . . 58
Desktop Personal Computers (PCs) and PLC Programming . . . . 63
Notebook Personal Computers and PLC Programming . . . . 68
Windows CE-based Handheld Personal Computers . . . . 71
Industrial Computers. . . . 73
Industrial Monitors. . . . 77
Open PLC Systems. . . . 77
The IEC 1131-3 Programming Standard . . . . 78
Soft PLC or Open-architecture Control . . . . 88
One Step Further: Production Data from PLC to Office Databases . . . . 88
CHAPTER 4 Number Systems . . . . 95
Number System Characteristics . . . . 96
The Decimal Number System . . . . 97
Decimal Place Values. . . . 97
Binary and Binary-coded Decimal Numbers . . . . 98
Binary Numbers . . . . 98
Bit Position and Weighting. . . . 99
Binary Coding . . . . 100
Binary-coded Decimal (BCD) Numbers . . . . 102
BCD Number Representation of Numbers Between 10 and 99 . . . . 105
BCD Representation of the Decimal Numbers 100 through 999 . . . . 106
BCD Representation of Four-digit Decimal Values. . . . 106
Applications of BCD . . . . 106
The Octal Number System. . . . 108
Valid Octal Numbers . . . . 108
Octal-to-decimal Conversion . . . . 109
Binary-to-octal Conversion . . . . 110
Octal-to-binary Conversion . . . . 111
The Hexadecimal Number System . . . . 111
CHAPTER 5 Introduction to PLC Operation. . . . 119
The Digital Concept . . . . 120
Analog Signals . . . . 121
The Binary Concept . . . . 122
Binary Data Representation . . . . 123
Correlation of 16-bit Words to Input Signals . . . . 124
The Input Status File. . . . 128
The Output Status File . . . . 129
Input and Output Status Files and Fixed PLCs . . . . 131
Differentiating One I/O Screw Terminal from Another. . . . 133
Sixteen-point I/O Modules with Decimal Addressing . . . . 135
I/O Interaction with the Input and Output Status Files . . . . 137
Fixed PLC I/O Addressing When I/O Is Expanded . . . . 140
PLC Memory and How It Is Used. . . . 141
Data Formats . . . . 141
PLC System Memory . . . . 145
PLC Application Memory . . . . 146
CHAPTER 6 Introduction to Logic . . . . 153
Conventional Ladders versus PLC Ladder Logic. . . . 153
What is Logic? . . . . 156
Overview of Logic Functions . . . . 157
Series—The AND Logic Function . . . . 158
Three-input AND Logic . . . . 160
Parallel Circuits—The OR Logic Function . . . . 162
NOT Logic . . . . 164
Analysis of Rung #1 . . . . 165
Analysis of Rung #2 . . . . 165
Parallel NOT Logic . . . . 166
Exclusive OR Logic . . . . 167
Analysis of Exclusive OR Logic . . . . 168
Combinational Logic . . . . 169
Priority of Logic Elements . . . . 170
CHAPTER 7 Input Modules. . . . 177
Input Modules . . . . 178
Discrete Input Module. . . . 180
Discrete AC Input Module . . . . 180
AC Input Module Specifications. . . . 183
DC Input Modules . . . . 189
Sinking and Sourcing. . . . 190
DC Input Module Operation . . . . 194
DC Sinking Input Module Specifications . . . . 195
Solid-state Sensor Interface to DC Input Modules . . . . 198
A Final Note on Sinking and Sourcing. . . . 200
Analog Inputs . . . . 200
Specialty Modules . . . . 208
CHAPTER 8 Output Modules. . . . 215
Discrete Output Modules . . . . 216
Transistor-Transistor Logic (TTL) Output Modules. . . . 221
Relay Output Modules . . . . 221
Module Selection Considerations . . . . 226
Choosing the Proper Output Module . . . . 227
Isolated Output Modules. . . . 228
Interposing Relays . . . . 228
Surge Suppression and Output Modules . . . . 230
High-density I/O Interface. . . . 231
Analog Outputs . . . . 231
Emergency-stop Switches and PLC Applications. . . . 232
I/O Modules in Hazardous Locations . . . . 234
Hardware Considerations Before Installing PLCs in Class 1, Division 2, Areas . . 235 CHAPTER 9 Putting Together a Modular PLC. . . . 241
Racks, Chassis, or Baseplates . . . . 242
The Local, or Base, PLC . . . . 248
Local Expansion . . . . 248
Remote I/O Expansion . . . . 249
PLC Networking . . . . 251
Selection and Placement of I/O Modules . . . . 251
Power Supply Selection . . . . 253
I/O Racks and Expansion . . . . 263
CHAPTER 10 PLC Processors . . . . 275
The Processor’s Function . . . . 276
The Processor’s Operating System . . . . 276
Processor Scanning. . . . 279
Omron CQM1 Operating Cycle . . . . 281
The Watchdog Timer . . . . 283
Processor Ports . . . . 285
The RS-232C Communication Standard . . . . 287
Serial Communication Between a Personal or Industrial Computer and the PLC . 288 Interfacing to non-RS-232 PLC Processors . . . . 292
Processor-operating Modes . . . . 292
On-line Editing. . . . 295
Battery Backup for the Processor’s Volatile Memory . . . . 295
Lithium Battery Handling and Disposal . . . . 297
Nonvolatile Memory: EEPROM . . . . 298
Passwords . . . . 299
The Allen-Bradley SLC 500 Modular Processors . . . . 301
Rockwell Automation’s Logix 5550 Controller . . . . 308
The General Electric Series 90-30 Processors . . . . 310
Choosing the Correct Processor for an Application. . . . 318
Part II PLC Instructions CHAPTER 11 Processor Data Organization . . . . 327
SLC 500 Files. . . . 328
Data Files . . . . 330
User-defined Files . . . . 339
CHAPTER 12 The Basic Relay Instructions . . . . 347
Bit, or Relay, Instructions . . . . 348
The Normally Open Instruction . . . . 348
The Output Instruction . . . . 349
Modular SLC 500 Instruction Addressing . . . . 350
The Normally Closed Instruction . . . . 352
The One-shot Instruction . . . . 354
The Output-latching Instruction. . . . 356
The Negated Output Instruction . . . . 359
Internal Bit-type Instructions . . . . 359
CHAPTER 13 Understanding Relay Instructions and the Programmable Controller Input Modules. . . . 367
Interfacing a Start-stop Push-button Station to a Programmable Controller . . . . 371
User Program Development for a Start-stop, Push-button Interface . . . . 374
Motor Starter Circuits and the Overload Contacts . . . . 381
Special Considerations for PLC Control of Motor Starters. . . . 382
CHAPTER 14 Documenting Your PLC System . . . . 387
Why Add Documentation to User Program? . . . . 388
Information to Include in PLC Documentation . . . . 388
Documentation and Software Packages . . . . 390
Types of Documentation . . . . 391
Adding Documentation When Developing a New Application . . . . 397
CHAPTER 15 Timer and Counter Instructions . . . . 409
Timer Instructions . . . . 410
SLC 500 Timers . . . . 410
The On-delay Timer Instruction. . . . 413
The Off-delay Timer Instruction. . . . 415
The Retentive Timer Instruction . . . . 416
The Reset Instruction . . . . 418
PLC Counter Instructions . . . . 418
Allen-Bradley SLC 500 Counters . . . . 420
How Counters Work . . . . 422
The Count-up Instruction . . . . 423
The Count-down Instruction . . . . 424
The High-speed Counter Instruction . . . . 426
The Counter Reset Instruction . . . . 426
The Clear Instruction . . . . 427
Combining Timers and Counters . . . . 428
CHAPTER 16 Comparison and Data-Handling Instructions . . . . 435
Comparison Instructions . . . . 436
Data-handling Instructions . . . . 440
Logical Instructions . . . . 452
CHAPTER 17 Sequencer Instructions . . . . 467
The Sequencer . . . . 468
Sequencer Instructions. . . . 468
The SLC 500 Sequencer Output Instruction . . . . 469
Programming the Sequencer Output Instruction . . . . 475
Multiple Sequencers and File Designation . . . . 476
Applying Hexadecimal Numbers and Masks With SLC 500 Programming Instructions . . . . 477
Mask Data Representation . . . . 480
APPENDIX A Instruction Set Reference. . . . 485
APPENDIX B Status File Overview . . . . 491
APPENDIX C Applying Hexadecimal Numbers in PLC Masking Applications . . . . . 495
Glossary 499 Index 511 viii TABLE OF CONTENTS
PREFACE
Welcome to the world of programmable logic controllers. Since their development in the early 1970s, programmable logic controllers (PLCs) have literally taken control of practically every modern manufacturing process.
The second edition text has been brought up to date, providing the latest possible infor-mation on and introduction to PLC products. We have added PLC inforinfor-mation and pictures from AEG Schneider Automation/Square D-Modicon and Mitsubishi Electric Automation, Inc. A new chapter two introduces the newer and smaller micro and pico PLCs. Also, this second edition presents explanatory pictures in two colors. This way the specific object re-ferred to in the text is highlighted for easy understanding. The accompanying lab manual has been updated from Rockwell Automation’s older APS programming software to the current RSLogix 500 Windows programming software. All chapters and lab exercises were devel-oped to be an easy-to-understand introduction to the world of PLCs.
Developed as a first quarter or semester introductory textbook, Introduction to
Pro-grammable Logic Controllers, Second Edition, discusses the top players in today’s PLC
market and their products, including Rockwell Automation/Allen-Bradley, General Elec-tric, Mitsubishi, Omron, Schneider Automation, and Siemens. The text was developed to be as generic as possible. Although separate, the lab manual’s hands-on programming ex-ercises were developed for the Allen-Bradley SLC 500 and MicroLogix family of PLCs using RSLogix 500 Windows software.
This book was developed for electrical technicians, maintenance personnel, machine design engineers, and individuals selling PLCs in today’s ever-changing manufactur-ing environment. Students will quickly learn the basics of today’s modern PLCs. Because the PLC is an industrial computer, many electricians and technicians are apprehen-sive about diving into the world of computers and the associated, seemingly foreign, ter-minology. This text is developed for these individuals. These new terms are explained in plain English so those new to the world of PLCs will feel comfortable. For additional help in understanding PLC terminology, you will find a comprehensive glossary near the end of the book.
Topics covered will include exploring what a PLC is, operation, usage, instructions, applications, hardware selection and configuration, introductory programming examples and exercises, and some troubleshooting hints.
The accompanying lab manual will give the student hands-on programming and hookup exercises. Students will configure different PLCs, set up the RSLinx drivers to communicate from a personal computer to the PLC, select proper modules, and calculate power supply loading. A lab exercise will walk students through a motor starter interface to an SLC 500 PLC along with issues in converting conventional ladder start-stop into PLC logic, separation of I/O, and proper instruction selection. Programming exercises will provide hands-on experience developing simple programs that incorporate basic instructions up to and including timers, counters, and sequencers.
This textbook is organized in the following manner:
x PREFACE
Chapter Chapter Title Chapter Description 1 Welcome to the World of
Programmable Logic Controllers Provides an introduction to what programmable controllers are and whyand where they are used. 2 Micro Programmable Logic
Controllers Introduces the student to the world of the new and smaller micro andpico PLCs. 3 Programming a Programmable
Controller Describes the available options for programming a programmablecontroller. 4 Number Systems Covers the basics of numbers and number systems used with PLCs. 5 Introduction to PLC Operation Chapter five introduces the basic operating principles of the PLC. 6 Introduction to Logic Describes the basic logic functions and how they relate to programmable
controllers.
7 Input Modules Describes the basic input modules available, selecting the correct module and basic module interface.
8 Output Modules Describes the basic output modules available, selecting the correct module and basic module interface.
9 Putting Together a Modular PLC Introduces the basic considerations when putting together a modular PLC. The chapter reviews power calculations for configuring rack I/O modules and power supply selection.
10 PLC Processors Introduces the PLC processor and its capabilities, features, and basic operation.
11 Processor Data Organization Introduces program and data organization inside a PLC processor. 12 The Basic Relay Instructions Describes the basic instructions used in developing PLC ladder programs. 13 Understanding Relay Instructions and
the Programmable Controller Input Modules
Describes the use of relay instructions and considerations when interfacing to real-world input devices.
14 Documenting Your PLC System Introduces documentation features available when using PLC ladder program development software.
15 Timer and Counter Instructions Describes timer and counter instructions. Specifically introduces the Allen-Bradley SLC 500 timer and counter instructions.
16 Comparison and Data-Handling
Instructions Introduces data handling and comparison instructions. Specificallycovers the SLC 500 instructions. 17 Sequencer Instructions Introduces the sequencer instructions. Specifically covers the SLC 500
instructions.
Appendix A A quick reference to the SLC 500 instruction set. Appendix B A quick reference to the SLC 500 status file.
Appendix C Reviews how hexadecimal numbers are used in masking applications.
ACKNOWLEDGMENTS
I wish to thank my wife, Jean, for her endless hours of typing, proofreading, spell checking, figure development, and art. Thanks to my son, Joe, for his art work for Fig-ures 4-9, 4-13, 4-15, and 4-16.
Developing any major technical textbook requires a substantial amount of technical information. We are greatly thankful to the following corporations who provided litera-ture, manuals, and art along with the technical support necessary to complete this project.
AEG Schneider Automation/Square D-Modicon Allen-Bradley, a Rockwell Automation business ASAP Inc., Chagrin Falls, Ohio
GE Fanuc Automation
Mitsubishi Electric Automation, Inc. Omron Electronics, Inc.
Siemens Energy & Automation Inc.
Along with Delmar, I would like to express appreciation to the following reviewers for their encouragement and suggestions during the preparation of this manuscript:
Keith Elliott William Shepherd
Rockingham Community College Owens Community College Wentworth, NC Perrysburg, OH
Ron Meyer Daniel Lewis
Central Community College James Rumsey Technical College Doniphan, NE Bunker Hill, WV
Paul F. Owens Michael Brumbach San Juan College York Technical College Aztec, NM Rock Hill, SC