PROGRAMMABLE LOGIC CONTROLLERS, FIFTH EDITIONPublished by McGraw-Hill Education, 2 Penn Plaza, New York, NY 10121.. vi ContentsWiring Diagrams and Ladder Logic Programs 98 6.1 Electroma
Trang 2Programmable Logic Controllers
Trang 3This page intentionally left blank
Trang 4Programmable Logic Controllers
Frank D Petruzella
Fifth Edition
Trang 5PROGRAMMABLE LOGIC CONTROLLERS, FIFTH EDITION
Published by McGraw-Hill Education, 2 Penn Plaza, New York, NY 10121 Copyright © 2017 by McGraw-Hill
Education All rights reserved Printed in the United States of America Previous editions © 2011, 2005,
1998 No part of this publication may be reproduced or distributed in any form or by any means, or stored in a
database or retrieval system, without the prior written consent of McGraw-Hill Education, including, but not
limited to, in any network or other electronic storage or transmission, or broadcast for distance learning.
Some ancillaries, including electronic and print components, may not be available to customers outside the
United States.
This book is printed on acid-free paper
1 2 3 4 5 6 7 8 9 0 RMN/RMN 1 0 9 8 7 6
ISBN 978-0-07-337384-3
MHID 0-07-337384-2
Senior Vice President, Products & Markets: Kurt L Strand
Vice President, General Manager, Products & Markets: Marty Lange
Vice President, Content Design & Delivery: Kimberly Meriwether David
Managing Director: Thomas Timp
Global Brand Manager: Raghu Srinivasan
Director, Product Development: Rose Koos
Product Developer: Vincent Bradshaw
Marketing Manager: Nick McFadden
Digital Product Developer: Amy Bumbaco, Ph.D.
Director, Content Design & Delivery: Linda Avenarius
Executive Program Manager: Faye M Herrig
Content Project Managers: Jessica Portz, Tammy Juran, Sandra Schnee
Buyer: Laura M Fuller
Content Licensing Specialist: Lorraine Buczek
Compositor: MPS Limited
Printer: R R Donnelley
All credits appearing on page or at the end of the book are considered to be an extension of the copyright page.
Library of Congress Cataloging-in-Publication Data
Petruzella, Frank D., author.
Programmable logic controllers / Frank D Petruzella.—Fifth edition.
pages cm
Includes index.
ISBN 978-0-07-337384-3 (alk paper)—ISBN 0-07-337384-2 (alk paper) 1 Programmable
controllers I Title.
TJ223.P76P48 2017
629.8’95—dc23
2015035302
The Internet addresses listed in the text were accurate at the time of publication The inclusion of a website
does not indicate an endorsement by the authors or McGraw-Hill Education, and McGraw-Hill Education does
not guarantee the accuracy of the information presented at these sites.
mheducation.com/highered
Trang 63.8 ASCII Code 54
3.9 Parity Bit 54
3.10 Binary Arithmetic 55
3.11 Floating Point Arithmetic 57
Review Questions 59
Problems 60
Chapter 4 Fundamentals of Logic 61 4.1 The Binary Concept 62
4.2 AND, OR, and NOT Functions 62
The AND Function 62
The OR Function 63
The NOT Function 64
The Exclusive-OR (XOR) Function 65
4.3 Boolean Algebra 65
4.4 Developing Logic Gate Circuits from Boolean Expressions 66
4.5 Producing the Boolean Equation for a Given Logic Gate Circuit 66
4.6 Hardwired Logic versus Programmed Logic 67 4.7 Programming Word Level Logic Instructions 70 Review Questions 72
Problems 72
Chapter 5 Basics of PLC Programming 74 5.1 Processor Memory Organization 75
Program Files 75
Data Files 75
5.2 Program Scan 78
5.3 PLC Programming Languages 81
5.4 Bit-Level Logic Instructions 83
5.5 Instruction Addressing 86
5.6 Branch Instructions 87
5.7 Internal Relay Instructions 89
5.8 Programming Examine If Closed and Examine If Open Instructions 90
5.9 Entering the Ladder Diagram 91
5.10 Modes of Operation 93
5.11 Connecting with Analog Devices 93
Review Questions 95
Problems 96
Preface viii
Acknowledgments xi
About the Author xii
Chapter 1 Programmable Logic Controllers (PLCs): An Overview 1 1.1 Programmable Logic Controllers 2
1.2 Parts of a PLC 4
1.3 Principles of Operation 8
1.4 Modifying the Operation 11
1.5 PLCs versus Computers 11
1.6 PLC Size and Application 12
Review Questions 15
Problems 16
Chapter 2 PLC Hardware Components 17 2.1 The I/O Section 18
2.2 Discrete I/O Modules 22
2.3 Analog I/O Modules 27
2.4 Special I/O Modules 31
2.5 I/O Specifications 33
Typical Discrete I/O Module Specifications 33
Typical Analog I/O Module Specifications 34
2.6 The Central Processing Unit (CPU) 35
2.7 Memory Design 36
2.8 Memory Types 37
2.9 Programming Terminal Devices 39
2.10 Recording and Retrieving Data 39
2.11 Human Machine Interfaces (HMIs) 39
Review Questions 43
Problems 45
Chapter 3 Number Systems and Codes 46 3.1 Decimal System 47
3.2 Binary System 47
3.3 Negative Numbers 49
3.4 Octal System 49
3.5 Hexadecimal System 50
3.6 Binary Coded Decimal (BCD) System 51
3.7 Gray Code 53
v
Trang 7vi Contents
Wiring Diagrams and Ladder Logic Programs 98
6.1 Electromagnetic Control Relays 99
6.2 Contactors 100
6.3 Motor Starters 101
6.4 Manually Operated Switches 102
6.5 Mechanically Operated Switches 103
6.6 Sensors 104
Proximity Sensor 104
Magnetic Reed Switch 107
Light Sensors 107
Ultrasonic Sensors 109
Strain/Weight Sensors 110
Temperature Sensors 110
Flow Measurement 111
Velocity and Position Sensors 111
6.7 Output Control Devices 112
6.8 Seal-In Circuits 114
6.9 Electrical Interlocking Circuits 115
6.10 Latching Relays 116
6.11 Converting Relay Schematics into PLC Ladder Programs 121
6.12 Writing a Ladder Logic Program Directly from a Narrative Description 124
6.13 Instrumentation 127
Review Questions 128
Problems 129
Chapter 7 Programming Timers 131 7.1 Mechanical Timing Relays 132
7.2 Timer Instructions 134
7.3 On-Delay Timer Instruction 135
7.4 Off-Delay Timer Instruction 140
7.5 Retentive Timer 144
7.6 Cascading Timers 147
Review Questions 151
Problems 151
Chapter 8 Programming Counters 156 8.1 Counter Instructions 157
8.2 Up-Counter 159
One-Shot Instruction 162
8.3 Down-Counter 166
8.4 Cascading Counters 170
8.5 Incremental Encoder-Counter Applications 173 8.6 Combining Counter and Timer Functions 174
8.7 High-Speed Counters 177
Review Questions 179
Problems 179
Chapter 9 Program Control Instructions 184 9.1 Program Control 185
9.2 Master Control Reset Instruction 185
9.3 Jump Instruction 188
9.4 Subroutine Functions 190
9.5 Immediate Input and Immediate Output Instructions 193
9.6 Forcing External I/O Addresses 195
9.7 Safety Circuitry 197
9.8 Selectable Timed Interrupt 200
9.9 Fault Routine 201
9.10 Temporary End Instruction 201
9.11 Suspend Instruction 202
Review Questions 203
Problems 203
Chapter 10 Data Manipulation Instructions 207 10.1 Data Manipulation 208
10.2 Data Transfer Operations 208
10.3 Data Compare Instructions 216
10.4 Data Manipulation Programs 221
10.5 Numerical Data I/O Interfaces 224
10.6 Closed-Loop Control 226
Review Questions 230
Problems 231
Chapter 11 Math Instructions 234 11.1 Math Instructions 235
11.2 Addition Instruction 236
11.3 Subtraction Instruction 238
11.4 Multiplication Instruction 239
11.5 Division Instruction 240
11.6 Other Word-Level Math Instructions 242
11.7 File Arithmetic Operations 245
Review Questions 247
Problems 248
Chapter 12 Sequencer and Shift Register Instructions 252 12.1 Mechanical Sequencers 253
12.2 Sequencer Instructions 255
12.3 Sequencer Programs 259
12.4 Bit Shift Registers 264
12.5 Word Shift Operations 272
Review Questions 277
Problems 277
Trang 8Chapter 13 PLC Installation Practices,
Editing, and Troubleshooting 281
13.1 PLC Enclosures 282
13.2 Electrical Noise 284
13.3 Leaky Inputs and Outputs 285
13.4 Grounding 285
13.5 Voltage Variations and Surges 287
13.6 Program Editing and Commissioning 288
13.7 Programming and Monitoring 289
13.8 Preventive Maintenance 291
13.9 Troubleshooting 292
Processor Module 292
Input Malfunctions 292
Output Malfunctions 294
Ladder Logic Program 294
13.10 PLC Programming Software 299
Review Questions 302
Problems 302
Chapter 14 Process Control, Network Systems, and SCADA 305 14.1 Types of Processes 306
14.2 Structure of Control Systems 308
14.3 On/Off Control 310
14.4 PID Control 311
14.5 Motion Control 315
14.6 Data Communications 316
Data Highway 322
Serial Communication 322
DeviceNet 322
ControlNet 325
EtherNet/IP 325
Modbus 326
Fieldbus 326
PROFIBUS-DP 326
14.7 Supervisory Control and Data Acquisition (SCADA) 328
Review Questions 331
Problems 332
Chapter 15 ControlLogix Controllers 333 Part 1 Memory and Project Organization 334
Memory Layout 334
Configuration 334
Project 335
Tasks 336
Programs 336
Routines 337
Tags 337
Structures 340
Creating Tags 341
Monitoring and Editing Tags 342
Array 342
Review Questions 344
Part 2 Bit-Level Programming 345
Program Scan 345
Creating Ladder Logic 346
Tag-Based Addressing 347
Adding Ladder Logic to the Main Routine 348
Internal Relay Instructions 350
Latch and Unlatch Instructions 352
One-Shot Instruction 353
Review Questions 356
Problems 356
Part 3 Programming Timers 358
Timer Predefined Structure 358
On-Delay Timer (TON) 359
Off-Delay Timer (TOF) 362
Retentive Timer On (RTO) 364
Cascading of Timers 365
Review Questions 367
Problems 367
Part 4 Programming Counters 368
Counters 368
Count-Up (CTU) Counter 369
Count-Down (CTD) Counter 371
Combining Counter and Timer Functions 372
Review Questions 373
Problems 373
Part 5 Math, Comparison, and Move Instructions 374
Math Instructions 374
Comparison Instructions 376
Move Instructions 379
Combining Math, Comparison, and Move Instructions 380
Review Questions 383
Problems 383
Part 6 Function Block Programming 384
Function Block Diagram (FBD) 384
FBD Programming 388
Review Questions 394
Problems 394
Glossary 395
Index 407
Trang 9Preface
Programmable logic controllers (PLCs) continue to evolve
as new technologies are added to their capabilities As
PLC technology has advanced, so have programming
lan-guages and communications capabilities Today’s PLCs
offer faster scan times, space efficient high-density input/
output systems, and special interfaces to allow
non-traditional devices to be attached directly to the PLC
Now in its Fifth Edition, changes made to the content
of the text have been made solely based on reviews from
current instructors and include:
• material that should be added or deleted from
chapters
• topics requiring more in-depth coverage
• increased integration of the ControlLogix platform
of controllers
• chapter modifications require to meet current
cur-riculum needs
The primary source of information for a particular PLC
is always the accompanying user manuals provided by
the manufacturer This textbook is not intended to replace
the vendor’s reference material, but rather to
comple-ment, clarify, and expand on this information The text
covers the basics of programmable logic controllers in a
manner that complements instruction with a SLC-500 or
ControlLogix platform The underlying PLC principles
and concepts covered in the text are common to most
manufacturers They serve to maximize the knowledge
gained through on-the-job training and programs offered
by different vendors
The text is written in an easy-to-read style that is
de-signed for students with no prior PLC experience For
example, when the operation of a program is called for,
a bulleted list is used to summarize its execution The
bulled list replaces a lengthy paragraph and is especially helpful when covering the different steps related to the execution of a program
Each chapter begins with a brief introduction outlin-ing chapter coverage and learnoutlin-ing objectives When ap-plicable, the relay equivalent of the virtual programmed instruction is explained first, followed by the appropriate PLC instruction Chapters conclude with a set of review questions and problems The review questions are closely related to the chapter objectives and require students to recall and apply information covered in the chapter The problems range from easy to difficult, thus challenging students at various levels of competence
Features new to the Fifth Edition include:
• Key concepts and terms are highlighted in bold the
first time they appear
• New/updated photos and line art for every chapter
• New topics for every chapter as requested by
reviewers
• Addition review questions for new topics.
• Updated instructor PowerPoint lessons
• More than 175 SLC-500 and ControlLogix program simulation videos tied directly to the programs
studied in the text
In addition, students who are using McGraw-Hill’s Connect can watch simulated, step-by-step execution of numerous ladder logic programming
examples They’re guided by an audio
commen-tary that explains what to look for as the program
is executed The videos are part of the Student Resources section of Connect
Trang 10Preface ix
Chapter changes in this edition include:
Chapter 1
• Testing of field devices
• Extended coverage of scan cycle sequence
• Additional test bank questions
• Program video simulations
• New and modified line diagrams and photos
Chapter 2
• ControlLogix Base and Alias addressing
• Extended coverage of DC module Sinking and
Sourcing
• Analog module input sensor 2-, 3-, and 4-wire
connections
• Scaling of PLC analog inputs and outputs
• Extended coverage of Human Machine Interfaces
(HMIs)
• Additional chapter review questions
• Additional test bank questions
• Program video simulations
• New and modified line diagrams and photos
Chapter 3
• 16 bit 2’s complement
• Floating point arithmetic
• Additional chapter problems
• Additional test bank questions
• Program video simulations
• New and modified line diagrams and photos
Chapter 4
• Modification to hardwired programming examples
• Additional test bank questions
• Additional chapter review questions
• Program video simulations
• New and modified line diagrams and photos
Chapter 5
• Electrical versus logical continuity
• Evaluating XIO and XIC bit instructions
• Rack-based versus tag-based addressing
• Connecting with analog devices
• Additional test bank questions
• Additional chapter review questions
• Program video simulations
• New and modified line diagrams and photos
Chapter 6
• Magnetic reed float switch
• Resistance temperature detectors (RTDs)
• Electrical interlocking circuits
• Process instrumentation
• Additional test bank questions
• Additional chapter review questions
• Program video simulations
• New and modified line diagrams and photos
Chapter 7
• Extended coverage of timer instructions
• ControlLogix timer instruction
• Reciprocating timers
• TON timer bit table
• TOF timer bit table
• Additional test bank questions
• Program video simulations
• New and modified line diagrams and photos
Chapter 8
• ControlLogix counter instruction
• Extended coverage of CTD instruction
• Additional information on incremental encoders
• New section on High-Speed Counter instruction
• Additional test bank questions
• Program video simulations
• New and modified line diagrams and photos
Chapter 9
• Extended coverage of MCR instruction
• Extended coverage of Jump instruction
• Extended coverage of Immediate Input and Output instructions
• ControlLogix Immediate Output instruction
• Additional test bank questions
• Program video simulations
• New and modified line diagrams and photos