Changes throughout this revision are marked by change bars, as shown to the right of this paragraph.ALMD instruction operand descriptions and graphics for Relay Ladder Logic and Function
Trang 1Logix5000 Controllers General Instructions Reference Manual
Catalog Numbers 1756 ControlLogix, 1768 CompactLogix, 1769 CompactLogix, 1789 SoftLogix, 1794 FlexLogix, PowerFlex 700S with DriveLogix
Trang 2Solid-state equipment has operational characteristics differing from those of electromechanical equipment Safety
Guidelines for the Application, Installation and Maintenance of Solid State Controls (publication SGI-1.1 available from your local Rockwell Automation® sales office or online at http://www.rockwellautomation.com/literature/ ) describes some important differences between solid-state equipment and hard-wired electromechanical devices Because of this difference, and also because of the wide variety of uses for solid-state equipment, all persons responsible for applying this equipment must satisfy themselves that each intended application of this equipment is acceptable.
In no event will Rockwell Automation, Inc be responsible or liable for indirect or consequential damages resulting from the use or application of this equipment.
The examples and diagrams in this manual are included solely for illustrative purposes Because of the many variables and requirements associated with any particular installation, Rockwell Automation, Inc cannot assume responsibility or liability for actual use based on the examples and diagrams.
No patent liability is assumed by Rockwell Automation, Inc with respect to use of information, circuits, equipment, or software described in this manual.
Reproduction of the contents of this manual, in whole or in part, without written permission of Rockwell Automation, Inc., is prohibited.
Throughout this manual, when necessary, we use notes to make you aware of safety considerations.
Allen-Bradley, Rockwell Software, Rockwell Automation, RSLogix, ControlLogix, CompactLogix, SoftLogix, FlexLogix, DriveLogix, PowerFlex, Logix5000, SLC, MicroLogix, PLC-2, PLC-3, PLC-5, PhaseManager, RSLinx, RSView, and TechConnect are trademarks of Rockwell Automation, Inc.
Trademarks not belonging to Rockwell Automation are property of their respective companies.
WARNING: Identifies information about practices or circumstances that can cause an explosion in a hazardous environment,
which may lead to personal injury or death, property damage, or economic loss.
ATTENTION: Identifies information about practices or circumstances that can lead to personal injury or death, property
damage, or economic loss Attentions help you identify a hazard, avoid a hazard, and recognize the consequence.
SHOCK HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that dangerous
voltage may be present.
BURN HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that surfaces may
reach dangerous temperatures.
IMPORTANT Identifies information that is critical for successful application and understanding of the product.
Trang 3This manual contains new and updated information Changes throughout this revision are marked by change bars, as shown to the right of this paragraph.
ALMD instruction operand descriptions and graphics for Relay Ladder Logic and Function Block Diagram languages 44
Added ProgUnshelve, OperShelve and OperSuppress elements to the Alarm Structure Elements in the Programmatically Access Alarm Information
Corrected text for when an alarm is Disabled per version 21.00.00 changes, added Shelve, Suppress and Disable alarms information with state model
Trang 4Notes:
Trang 5Where to Find an Instruction 29
Preface Introduction 37
Who Should Use This Manual 37
Purpose of This Manual 37
Common Information for All Instructions 38
Conventions and Related Terms 38
Relay Ladder Rung Condition 39
Function Block States 40
Studio 5000 Environment 41
Additional Resources 41
Chapter 1 FactoryTalk Alarms and Events Logix-based Instructions (ALMD, ALMA) Digital Alarm (ALMD) 44
Relay Ladder 44
Structured Text 44
Function Block 44
ALARM_DIGITAL Structure 45
State Diagrams When Acknowledgement Required 49
State Diagrams When Acknowledgment Not Required 49
ALMD Alarm Acknowledge Required and Latched 51
ALMD Alarm Acknowledge Required and Not Latched 52
ALMD Alarm Acknowledge Not Required and Latched 52
ALMD Alarm Acknowledge Not Required and Not Latched 53
Relay Ladder 54
Structured Text 54
Function Block 54
Analog Alarm (ALMA) 55
Relay Ladder 55
Structured Text 55
Function Block 55
ALARM_ANALOG Structure 56
State Diagrams When Acknowledgement Required 64
State Diagrams When Acknowledgement Not Required 65
ALMA Level Condition Acknowledge Required 67
ALMA Level Condition Acknowledge Not Required 68
ALMA Rate of Change Acknowledge Required 69
ALMA Rate of Change Acknowledge Not Required 70
Trang 6Monitor Alarm Status 77
Alarms Log 77
Programmatically Access Alarm Information 78
Shelve, Suppress, or Disable Alarms 79
Controller-based Alarm Execution 83
Controller Memory Use 83
Scan Time 85
Chapter 2 Bit Instructions (XIC, XIO, OTE, OTL, OTU, ONS, OSR, OSF, OSRI, OSFI) Bit Addressing 88
Examine If Closed (XIC) 90
Relay Ladder 90
Structured Text 90
Relay Ladder 91
Structured Text 91
Relay Ladder 92
Structured Text 92
Examine If Open (XIO) 93
Relay Ladder 93
Structured Text 93
Relay Ladder 95
Structured Text 95
Relay Ladder 95
Structured Text 95
Output Energize (OTE) 96
Relay Ladder 96
Structured Text 96
Relay Ladder 97
Structured Text 97
Output Latch (OTL) 98
Relay Ladder 98
Structured Text 98
Relay Ladder 99
Structured Text 99
Output Unlatch (OTU) 100
Relay Ladder 100
Structured Text 100
Relay Ladder 101
Structured Text 101
One Shot (ONS) 102
Relay Ladder 102
Structured Text 102
Relay Ladder 104
Structured Text 104
One Shot Rising (OSR) 105
Relay Ladder 105
One Shot Falling (OSF) 107
Trang 7Relay Ladder Operands 107
One Shot Rising with Input (OSRI) 109
Structured Text 109
Function Block 109
FBD_ONESHOT Structure 109
Structured Text 111
Function Block 111
One Shot Falling with Input (OSFI) 112
Structured Text 112
Function Block 112
FBD_ONESHOT Structure 112
Structured Text 114
Function Block 114
Chapter 3 Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES) Timer On Delay (TON) 116
Relay Ladder 116
TIMER Structure 116
Timer Off Delay (TOF) 120
Relay Ladder 120
TIMER Structure 120
Retentive Timer On (RTO) 124
Relay Ladder 124
TIMER Structure 124
Timer On Delay with Reset (TONR) 128
Structured Text 128
Function Block 128
FBD_TIMER Structure 128
Structured Text 131
Function Block Example 131
Timer Off Delay with Reset (TOFR) 132
Structured Text 132
Function Block Operands 132
FBD_TIMER Structure 132
Structured Text 135
Function Block 135
Retentive Timer On with Reset (RTOR) 136
Structured Text 136
Function Block Operands 136
Trang 8COUNTER Structure 144
Count Up/Down (CTUD) 148
Structured Text 148
Function Block 148
FBD_COUNTER Structure 148
Structured Text 151
Function Block 151
Reset (RES) 152
Relay Ladder 152
Chapter 4 Input/Output Instructions (MSG, GSV, SSV, IOT) Message (MSG) 154 Relay Ladder 154
Structured Text 154
MESSAGE Structure 154
MSG Error Codes 161
Error Codes 161
Extended Error Codes 162
PLC and SLC Error Codes (.ERR) 164
Block-transfer Error Codes 166
Specify the Configuration Details 167
Specify This Data for a Logix5000 Controller as a Target Device 168 Specify CIP Data Table Read and Write Messages 168
Reconfigure an I/O Module 169
Relay Ladder 170
Structured Text 170
Specify CIP Generic Messages 171
Specify PLC-5 Messages 174
Specify SLC Messages 176
Specify Block-transfer Messages 176
Specify PLC-3 Messages 177
Specify PLC-2 Messages 178
MSG Configuration Examples 178
Specify the Communication Details 179
Specify a Path 179
Broadcast Button 181
System Protocol Tab Configuration 183
For Block Transfers 185
Specify a Communication Method or Module Address 185
Choose a Cache Option 186
Guidelines 187
Get System Value (GSV) and Set System Value (SSV) 188
Relay Ladder 188
Structured Text 189
GSV/SSV Objects 191
AddOnInstructionDefinition Attributes 192
Controller Attributes 192
Trang 9ControllerDevice Attributes 194
CST Attributes 194
DF1 Attributes 196
FaultLog Attributes 198
Message Attributes 198
Module Attributes 199
Program Attributes 200
Routine Attributes 201
Safety Attributes 202
SerialPort Attributes 202
Task Attributes 203
WallClockTime Attributes 205
GSV/SSV Programming Example 206
Get Fault Information 206
Relay Ladder 206
Structured Text 206
Relay Ladder 206
Structured Text 207
Relay Ladder 207
Structured Text 207
Set Enable And Disable Flags 207
Relay Ladder 208
Structured Text 208
Immediate Output (IOT) 209
Relay Ladder 209
Structured Text 209
Relay Ladder 211
Structured Text 211
Relay Ladder 211
Structured Text 211
Chapter 5 Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ) Compare (CMP) 215
Relay Ladder 215
Structured Text 215
CMP Expressions 217
Valid Operators 217
Format Expressions 217
Determine the Order of Operation 218
Trang 10Relay Ladder 223
Structured Text 223
Function Block 223
Greater Than or Equal To (GEQ) 224
Relay Ladder 224
Structured Text 224
Function Block 225
FBD_COMPARE Structure 225
Relay Ladder 226
Function Block 226
Relay Ladder 227
Structured Text 227
Function Block 227
Greater Than (GRT) 228
Relay Ladder 228
Structured Text 228
Function Block 228
FBD_COMPARE Structure 229
Relay Ladder 230
Function Block 230
Relay Ladder 231
Structured Text 231
Function Block 231
Less Than or Equal To (LEQ) 232
Relay Ladder 232
Structured Text 232
Function Block 232
FBD_COMPARE Structure 233
Relay Ladder 234
Function Block 234
Relay Ladder 235
Structured Text 235
Function Block 235
Less Than (LES) 236
Relay Ladder 236
Structured Text 236
Function Block 236
FBD_COMPARE Structure 237
Relay Ladder 238
Function Block 238
Relay Ladder 239
Structured Text 239
Function Block 239
Limit (LIM) 240
Relay Ladder 240
Structured Text 240
Function Block 240
Trang 11FBD_LIMIT Structure 241
Relay Ladder 243
Function Block 243
Relay Ladder 244
Structured Text 244
Function Block 244
Relay Ladder 245
Structured Text 245
Function Block 245
Mask Equal To (MEQ) 246
Relay Ladder 246
Structured Text 246
Function Block 247
FBD_MASK_EQUAL Structure 247
Entering an Immediate Mask Value 247
Relay Ladder 248
Function Block 248
Relay Ladder 249
Structured Text 249
Function Block 249
Relay Ladder 250
Structured Text 250
Function Block 250
Not Equal To (NEQ) 251
Relay Ladder 251
Structured Text 251
Function Block 251
FBD_COMPARE Structure 252
Relay Ladder 253
Function Block 253
Relay Ladder 254
Structured Text 254
Function Block 254
Chapter 6 Compute/Math Instructions (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS) Compute (CPT) 257
Relay Ladder 257
Structured Text 257
Valid Operators 259
Trang 12Function Block 263
Relay Ladder 264
Structured Text 264
Function Block 264
Subtract (SUB) 265
Relay Ladder 265
Structured Text 265
Function Block 266
FBD_MATH Structure 266
Relay Ladder 266
Function Block 267
Relay Ladder 267
Structured Text 267
Function Block 267
Multiply (MUL) 268
Relay Ladder 268
Structured Text 268
Function Block 269
FBD_MATH Structure 269
Relay Ladder 269
Function Block 270
Relay Ladder 270
Structured Text 270
Function Block 270
Divide (DIV) 271
Relay Ladder 271
Structured Text 271
Function Block 272
FBD_MATH Structure 272
Relay Ladder 273
Function Block 273
Relay Ladder 274
Structured Text 274
Function Block 274
Relay Ladder 275
Modulo (MOD) 276
Relay Ladder 276
Structured Text 276
Function Block 277
FBD_MATH Structure 277
Relay Ladder 278
Function Block 278
Relay Ladder 279
Structured Text 279
Function Block 279
Square Root (SQR) 280
Relay Ladder 280
Trang 13Structured Text 280
Function Block 280
FBD_MATH_ADVANCED Structure 280
Relay Ladder 281
Function Block 281
Relay Ladder 282
Structured Text 282
Function Block 282
Negate (NEG) 283
Relay Ladder 283
Structured Text 283
Function Block 283
FBD_MATH Structure 283
Relay Ladder 284
Function Block 284
Relay Ladder 285
Structured Text 285
Function Block 285
Absolute Value (ABS) 286
Relay Ladder 286
Structured Text 286
Function Block 286
FBD_MATH_ADVANCED Structure 286
Relay Ladder 287
Function Block 287
Relay Ladder 288
Structured Text 288
Function Block 288
Chapter 7 Move/Logical Instructions (MOV, MVM, BTD, MVMT, BTDT, CLR, SWPB, AND, OR, XOR, NOT, BAND, BOR, BXOR, BNOT) Move (MOV) 291
Relay Ladder 291
Structured Text 291
Relay Ladder 292
Structured Text 292
Masked Move (MVM) 293
Relay Ladder 293
Structured Text 293
Enter an Immediate Mask Value 294
Trang 14Bit Field Distribute (BTD) 299
Relay Ladder 299
Bit Field Distribute with Target (BTDT) 302
Structured Text 302
Function Block 302
FBD_BIT_FIELD_DISTRIBUTE Structure 303
Structured Text 305
Function Block 305
Clear (CLR) 306
Relay Ladder 306
Structured Text 306
Relay Ladder 307
Structured Text 307
Swap Byte (SWPB) 308
Relay Ladder 308
Structured Text 308
Relay Ladder 309
Structured Text 310
Relay Ladder 311
Structured Text 311
Bitwise AND (AND) 312
Relay Ladder 312
Structured Text 312
Function Block 312
FBD_LOGICAL Structure 313
Relay Ladder 313
Function Block 314
Relay Ladder 315
Structured Text 315
Function Block 315
Bitwise OR (OR) 316
Relay Ladder 316
Structured Text 316
Function Block 316
FBD_LOGICAL Structure 317
Relay Ladder 317
Function Block 318
Relay Ladder 319
Structured Text 319
Function Block 319
Bitwise Exclusive OR (XOR) 320
Relay Ladder 320
Structured Text 320
Function Block 320
FBD_LOGICAL Structure 321
Relay Ladder 321
Function Block 322
Trang 15Relay Ladder 323
Structured Text 323
Function Block 323
Bitwise NOT (NOT) 324
Relay Ladder 324
Structured Text 324
Function Block 324
FBD_LOGICAL Structure 325
Relay Ladder 325
Function Block 326
Relay Ladder 326
Structured Text 326
Function Block 326
Boolean AND (BAND) 327
Structured Text 327
Function Block 327
FBD_BOOLEAN_AND Structure 327
Structured Text 328
Function Block 329
Structured Text 329
Boolean OR (BOR) 330
Structured Text 330
Function Block 330
FBD_BOOLEAN_OR Structure 330
Structured Text 331
Function Block 331
Structured Text 332
Boolean Exclusive OR (BXOR) 333
Structured Text 333
Function Block 333
FBD_BOOLEAN_XOR Structure 333
Structured Text 334
Function Block 334
Structured Text 335
Boolean NOT (BNOT) 336
Structured Text 336
Function Block 336
FBD_BOOLEAN_NOT Structure 336
Structured Text 337
Function Block 337
Trang 16File Arithmetic and Logic (FAL) 345
Relay Ladder 345
Structured Text 345
CONTROL Structure 346
FAL Expressions 355
Valid Operators 355
Format Expressions 355
Determine the Order of Operation 356
File Search and Compare (FSC) 357
Relay Ladder 357
CONTROL Structure 357
FSC Expressions 362
Valid Operators 362
Format Expressions 362
Determine the Order of Operation 363
Use Strings in an Expression 364
Copy File (COP) Synchronous Copy File (CPS) 365
Relay Ladder 365
Structured Text 365
Relay Ladder 368
Structured Text 368
Relay Ladder 368
Structured Text 368
Relay Ladder 369
Structured Text 369
Relay Ladder 369
Structured Text 369
Relay Ladder 370
Structured Text 370
File Fill (FLL) 371
Relay Ladder 371
Structured Text 371
Relay Ladder 374
Structured Text 374
File Average (AVE) 375
Relay Ladder 375
Structured Text 375
CONTROL Structure 376
Relay Ladder 378
Structured Text 378
Relay Ladder 379
Structured Text 379
File Sort (SRT) 380
Relay Ladder 380
Structured Text 380
CONTROL Structure 380
Relay Ladder 383
Trang 17Structured Text 383
Relay Ladder 384
Structured Text 384
File Standard Deviation (STD) 385
Relay Ladder 385
CONTROL Structure 385
Structured Text 386
Relay Ladder 389
Structured Text 389
Relay Ladder 390
Structured Text 391
Size In Elements (SIZE) 392
Relay Ladder 392
Structured Text 392
Relay Ladder 393
Structured Text 393
Relay Ladder 394
Structured Text 394
Relay Ladder 395
Structured Text 395
Chapter 9 Array (file)/Shift Instructions (BSL, BSR, FFL, FFU, LFL, LFU) Bit Shift Left (BSL) 398 Relay Ladder 398
CONTROL Structure 398
Bit Shift Right (BSR) 402
Relay Ladder 402
CONTROL Structure 402
FIFO Load (FFL) 406
Relay Ladder 406
CONTROL Structure 407
FIFO Unload (FFU) 412
Relay Ladder 412
CONTROL Structure 413
LIFO Load (LFL) 418
Relay Ladder 418
CONTROL Structure 419
LIFO Unload (LFU) 424
Relay Ladder 424
Trang 18Use SQI without SQO 435
Sequencer Output (SQO) 436
Relay Ladder 436
Enter an Immediate Mask Value 437
Using SQI with SQO 439
Resetting the Position of SQO 439
Sequencer Load (SQL) 440
Relay Ladder 440
CONTROL Structure 440
Chapter 11 Program Control Instructions (JMP, LBL, JSR, RET, SBR, JXR, TND, MCR, UID, UIE, AFI, NOP, EOT, SFP, SFR, EVENT) Jump to Label (JMP) Label (LBL) 447
Relay Ladder 447
Jump to Subroutine (JSR) Subroutine (SBR) Return (RET) 449
Relay Ladder 449
Structured Text 450
Function Block 450
Relay Ladder 451
Structured Text 451
Function Block 451
Relay Ladder 451
Structured Text 451
Function Block 452
Relay Ladder and Structured Text 454
Function Block 455
Relay Ladder 456
Structured Text 456
Relay Ladder 457
Function Block 458
Jump to External Routine (JXR) 459
Relay Ladder 459
EXT_ROUTINE_CONTROL Structure 460
Temporary End (TND) 462
Relay Ladder Operands 462
Structured Text 462
Relay Ladder 463
Structured Text 463
Master Control Reset (MCR) 464
Relay Ladder 464
User Interrupt Disable (UID) User Interrupt Enable (UIE) 466
Relay Ladder 466
Structured Text 466
Relay Ladder 467
Structured Text 467
Always False Instruction (AFI) 468
Trang 19Relay Ladder 468
No Operation (NOP) 469
Relay Ladder 469
End of Transition (EOT) 470
Relay Ladder 470
Structured Text 470
Relay Ladder 471
Structured Text 471
SFC Pause (SFP) 472
Relay Ladder 472
Structured Text 472
Relay Ladder 473
Structured Text 474
SFC Reset (SFR) 474
Relay Ladder Operands 474
Structured Text 474
Relay Ladder 475
Structured Text 475
Trigger Event Task (EVENT) 476
Relay Ladder 476
Structured Text 476
Programmatically Determine if an EVENT Instruction Triggered a Task 476
Relay Ladder 477
Structured Text 478
Chapter 12 For/Break Instructions (FOR, FOR DO, BRK, EXIT, RET) For (FOR) 482 Relay Ladder 482
Structured Text 482
Break (BRK) 485
Relay Ladder 485
Structured Text 485
Return (RET) 486
Relay Ladder 486
Chapter 13 Special Instructions (FBC, DDT, DTR, PID) File Bit Comparison (FBC) 490 Relay Ladder 490
Trang 20Select the Search Mode 498
Data Transitional (DTR) 504
Relay Ladder 504
Enter an Immediate Mask Value 504
Proportional Integral Derivative (PID) 507
Relay Ladder 507
Structured Text 508
PID Structure 508
Configure a PID Instruction 512
Specify Tuning 512
Specify Configuration 513
Specify Alarms 513
Specify Scaling 514
Use PID Instructions 514
Anti-reset Windup and Bumpless Transfer from Manual to Auto 516 PID Instruction Timing 517
Relay Ladder 518
Structured Text 518
Relay Ladder 519
Structured Text 519
Relay Ladder 520
Structured Text 521
Bumpless Restart 521
Derivative Smoothing 522
Set the Deadband 522
Use Output Limiting 523
Feedforward or Output Biasing 523
Cascade Loops 523
Relay Ladder 524
Structured Text 524
Control a Ratio 524
Relay Ladder 524
Structured Text 525
PID Theory 526
PID Process 526
PID Process with Master/Slave Loops 526
Chapter 14 Trigonometric Instructions (SIN, COS, TAN, ASN, ASIN, ACS, ACOS, ATN, ATAN) Sine (SIN) 528
Relay Ladder 528
Structured Text 528
Function Block 528
FBD_MATH_ADVANCED Structure 528
Relay Ladder 529
Function Block 529
Relay Ladder 530
Structured Text 530
Trang 21Function Block 530
Cosine (COS) 531
Relay Ladder 531
Structured Text 531
Function Block 531
FBD_MATH_ADVANCED Structure 531
Relay Ladder 532
Function Block 532
Relay Ladder 533
Structured Text 533
Function Block 533
Tangent (TAN) 534
Relay Ladder 534
Structured Text 534
Function Block 534
FBD_MATH_ADVANCED Structure 534
Relay Ladder 535
Function Block 535
Relay Ladder 535
Structured Text 536
Function Block 536
Arc Sine (ASN) 537
Relay Ladder 537
Structured Text 537
Function Block 537
FBD_MATH_ADVANCED Structure 537
Relay Ladder 538
Function Block 538
Relay Ladder 538
Structured Text 539
Function Block 539
Arc Cosine (ACS) 540
Relay Ladder 540
Structured Text 540
Function Block 540
FBD_MATH_ADVANCED Structure 540
Relay Ladder 541
Function Block 541
Relay Ladder 541
Structured Text 542
Trang 22Function Block 544 Relay Ladder 545 Structured Text 545 Function Block 545
Chapter 15 Advanced Math Instructions
(LN, LOG, XPY) Natural Log (LN) 548 Relay Ladder 548
Structured Text 548 Function Block 548 FBD_MATH_ADVANCED Structure 548 Relay Ladder 549 Function Block 549 Relay Ladder Example 549 Structured Text 550 Function Block 550 Log Base 10 (LOG) 551 Relay Ladder 551 Structured Text 551 Function Block 551 FBD_MATH_ADVANCED Structure 551 Relay Ladder 552 Function Block 552 Relay Ladder 552 Structured Text 553 Function Block 553
X to the Power of Y (XPY) 554 Relay Ladder 554 Structured Text 554 Function Block 554 FBD_MATH Structure 555 Relay Ladder 556 Function Block 556 Relay Ladder 556 Structured Text 557 Function Block 557
Chapter 16 Math Conversion Instructions
(DEG, RAD, TOD, FRD, TRN, TRUNC) Degrees (DEG) 560 Relay Ladder 560
Structured Text 560 Function Block 560 FBD_MATH_ADVANCED Structure 561 Relay Ladder 561 Function Block 561 Relay Ladder 562
Trang 23Structured Text 562 Function Block 562 Radians (RAD) 563 Relay Ladder 563 Structured Text 563 Function Block 563 FBD_MATH_ADVANCED Structure 564 Relay Ladder 564 Function Block 564 Relay Ladder 565 Structured Text 565 Function Block 565 Convert to BCD (TOD) 566 Relay Ladder 566 Function Block 566 FBD_CONVERT Structure 566 Relay Ladder 567 Function Block 568 Relay Ladder 568 Function Block 568 Convert to Integer (FRD) 569 Relay Ladder 569 Function Block 569 FBD_CONVERT Structure 569 Relay Ladder 570 Function Block 570 Relay Ladder 570 Function Block 570 Truncate (TRN) 571 Relay Ladder 571 Structured Text 571 Function Block 571 FBD_TRUNCATE Structure 571 Relay Ladder 572 Function Block 572 Relay Ladder 573 Structured Text 573 Function Block 573
Chapter 17
Trang 24Relay Ladder 580 Structured Text 581 ASCII Chars in Buffer (ACB) 582 Relay Ladder 582 Structured Text 582 SERIAL_PORT_CONTROL Structure 582 Relay Ladder 583 Structured Text 583 ASCII Clear Buffer (ACL) 584 Relay Ladder 584 Structured Text 584 Relay Ladder 585 Structured Text 585 ASCII Handshake Lines (AHL) 586 Relay Ladder 586 Structured Text 586 SERIAL_PORT_CONTROL Structure 587 Relay Ladder 588 Structured Text 589 ASCII Read (ARD) 590 Relay Ladder 590 Structured Text 590 SERIAL_PORT_CONTROL Structure 591 Relay Ladder 592 Structured Text 593 ASCII Read Line (ARL) 594 Relay Ladder 594 Structured Text 595 SERIAL_PORT_CONTROL Structure 595 Relay Ladder 596 Structured Text 597 ASCII Write Append (AWA) 598 Relay Ladder 598 Structured Text 598 SERIAL_PORT_CONTROL Structure 599 Relay Ladder 600 Structured Text 600 Relay Ladder 601 Structured Text 601 ASCII Write (AWT) 602 Relay Ladder 602 Structured Text 602 SERIAL_PORT_CONTROL Structure 603 Relay Ladder 604 Structured Text 604 Relay Ladder 605 Structured Text 605
Trang 25Chapter 18 ASCII String Instructions
(CONCAT, DELETE, FIND, INSERT, MID) String Concatenate (CONCAT) 610 String Data Types 609
Relay Ladder 610 Structured Text 610 Relay Ladder 611 Structured Text 611 String Delete (DELETE) 612 Relay Ladder 612 Structured Text 612 Relay Ladder 613 Structured Text 613 Find String (FIND) 614 Relay Ladder 614 Structured Text 614 Relay Ladder 615 Structured Text 615 Insert String (INSERT) 616 Relay Ladder 616 Structured Text 616 Relay Ladder 617 Structured Text 617 Middle String (MID) 618 Relay Ladder 618 Structured Text 618 Relay Ladder 619 Structured Text 619
Chapter 19 ASCII Conversion Instructions
(STOD, STOR, DTOS, RTOS, UPPER,
LOWER)
String Data Types 622 String To DINT (STOD) 623 Relay Ladder 623 Structured Text 623 Relay Ladder 624 Structured Text 624 String To REAL (STOR) 625 Relay Ladder Operands 625 Structured Text 625 Relay Ladder 626
Trang 26Relay Ladder 629 Structured Text 629 Relay Ladder 630 Structured Text 630 Upper Case (UPPER) 631 Relay Ladder 631 Structured Text 631 Relay Ladder 632 Structured Text 632 Lower Case (LOWER) 633 Relay Ladder 633 Structured Text 633 Relay Ladder 634 Structured Text 634
Chapter 20 Debug Instructions
(BPT, TPT) Breakpoints (BPT) 635 Relay Ladder 635
String Format 636 Tracepoints (TPT) 639 Relay Ladder 639 String Format 639
Appendix A Common Attributes Introduction 643
Status Flags 643 Expressions in Array Subscripts 645 Immediate Values 645 Floating Point Values 646 Guidelines for Floating-point Math Operations 646 Totalizer Examples 647 Data Conversions 648 Data Types 649 LINT Data Type Considerations 649 SINT or INT to DINT 649 Integer to REAL 651 DINT to SINT or INT 651 REAL to an Integer 652
Appendix B Function Block Attributes Introduction 653
Function Block Elements 653 Latching Data 654 Order of Execution 656 Resolve a Loop 656 Resolve Data Flow between Two Blocks 658
Trang 27Create a One Scan Delay 658 Summary 659 Function Block Responses to Overflow Conditions 659 Timing Modes 659 Common Instruction Parameters for Timing Modes 660 Overview of Timing Modes 663 Program/Operator Control 664
Appendix C Structured Text Programming Introduction 669
Structured Text Syntax 669 Assignments 670 Specify a Non-retentive Assignment 671 Assign an ASCII Character to a String 672 Expressions 673 Use Arithmetic Operators and Functions 674 Use Relational Operators 675 Use Logical Operators 677 Use Bitwise Operators 678 Determine the Order of Execution 678 Instructions 679 Constructs 680 Some Key Words are Reserved 680 IF THEN 681 Structured Text 681 CASE OF 684 Structured Text 684 FOR…DO 687 Structured Text 687 WHILE…DO 690 Structured Text 690 REPEAT…UNTIL 693 Structured Text 693 Comments 696
Index
Trang 28Notes:
Trang 29Where to Find an Instruction
Use this locator to find the reference details about Logix instructions (the grayed-out instructions are available in other manuals) This locator also lists which programming languages are available for the instructions.
If the locator lists The instruction is documented in
Motion Logix5000 Controllers Motion Instructions Reference Manual, publication MOTION-RM002
Process control Logix5000 Controllers Process Control and Drives Instructions Reference Manual, publication 1756-RM006
ABL
ASCII Test For Buffer Line
Structured textABS
Absolute Value
Structured textFunction blockACB
ASCII Chars in Buffer 582 Relay ladderStructured text
Add
Structured textFunction blockAFI
Trang 30ASCII Read
Structured textARL
ASCII Read Line
Structured textASN
Arc Sine
Structured textFunction blockATN
Function blockAVE
ASCII Write
Structured textBAND
Boolean AND
Function blockBNOT
Boolean NOT
Function blockBOR
Boolean OR
Function blockBPT
Message
Structured textBTW
Message
Structured textBXOR
Boolean Exclusive OR
Function blockCC
Coordinated Control
Process control Structured text
Function blockCLR
CONCATString Concatenate
Structured textCOP
Copy File
Structured textCOS
Cosine
Structured textFunction blockCPS
Synchronous Copy File 365 Relay LadderStructured textCPT
Discrete 3-State Device Process control Structured textFunction blockDDT
DEDTDeadtime Process control Structured textFunction blockDEG
Function blockDELETE
String Delete
Structured textDERV
Derivative
Process control Structured text
Function blockDFF
D Flip-Flop
Process control Structured text
Function blockDIV
Divide
Structured textFunction blockDTOS
DTR
EOT
Trang 31Equal to
Structured textFunction blockESEL
Enhanced Select Process control Structured textFunction block
Greater Than
Structured textFunction blockGSV
HLL
High/Low Limit Process control Structured textFunction block
INTGIntegrator
Process control Structured text
Function blockIOT
Immediate Output
Structured textIREF
Jump to Label
JSRJump to Subroutine
Structured textFunction blockJXR
LBL
LDL2Second-Order Lead Lag Process control Structured textFunction blockLDLG
Lead-Lag Process control Structured textFunction blockLEQ
Less Than or Equal to 232 Relay ladderStructured text
Function blockLES
Less Than
Structured textFunction blockLFL
Trang 32Motion Axis Fault Reset
Structured textMAG
Motion Axis Gear
Structured textMAHD
Motion Apply Hookup Diagnostics
Structured textMAH
Motion Axis Home
Structured textMAJ
Motion Axis Jog
Structured textMAM
Motion Axis Move
Structured textMAOC
Motion Arm Output Cam
Structured textMAPC
Motion Axis Position Cam
Structured textMAR
Motion Arm Registration
Structured textMASD
Motion Axis Shutdown
Structured textMAS
Motion Axis Stop
Structured textMASR
Motion Axis Shutdown Reset
Structured textMATC
Motion Axis Time Cam
Structured textMAVE
Moving Average
Process control Structured text
Function blockMAW
Motion Arm Watch
Structured textMAXC
Maximum Capture
Process control Structured text
Function BlockMCCD
Motion Coordinated Change
MCSDMotion Coordinated Shutdown
Structured textMCS
Motion Coordinated Stop
Structured TextMCSR
Motion Coordinated Shutdown Reset
Structured text
MCTMotion Coordinated Transform Coordinate Relay ladderStructured textMCTP
Motion Calculate Transform Position
Structured text
MDACMotion Master Driven Axis Control
Structured textMDCC
Motion Master Driven Coordinated Control
Structured text
MDFMotion Direct Drive Off Motion Relay ladderStructured textMDOC
Motion Disarm Output Cam Motion Relay ladderStructured textMDO
Motion Direct Drive On Motion Relay ladderStructured textMDR
Motion Disarm Registration Motion Relay ladderStructured textMDW
Motion Disarm Watch Motion Relay ladderStructured textMEQ
Function BlockMGSD
Motion Group Shutdown
Structured textMGS
Motion Group Stop
Structured textMGSP
Motion Group Strobe Position
Structured textMGSR
Motion Group Shutdown Reset
Structured textMID
Middle String
Structured textMINC
Minimum Capture
Process control Structured text
Function blockMMC
Modular Multivariable Control
Process control Structured text
Function block
Trang 33Modulo
Structured textFunction blockMOV
Negate
Structured textFunction blockNEQ
Function blockNOP
Structured textFunction blockOREF
OSFIOne Shot Falling with Input 112 Structured textFunction blockOSF
OSRIOne Shot Rising with Input 109 Structured textFunction blockOSR
Equipment Phase Clear Failure PhaseManager Relay ladderStructured textPCMD
Equipment Phase Command PhaseManager Relay ladderStructured textPDET
Detach from Equipment Phase PhaseManager Relay ladderStructured textPFL
Equipment Phase Failure PhaseManager Relay ladderStructured textPIDE
Enhanced PID Process control Structured textFunction blockPID
Proportional Integral Derivative 507 Relay ladderStructured textPI
Proportional + Integral Process control Structured textFunction blockPMUL
Pulse Multiplier Process control Structured textFunction block
Trang 34Equipment Phase New Parameters
Structured textPSC
Phase State Complete
Structured textPXRQ
Equipment Phase External Request
Structured textRAD
Radians
Structured textFunction blockRESD
Reset Dominant Process control Structured textFunction block
Rate Limiter
Process control Structured text
Function blockRMPS
Ramp/Soak
Process control Structured text
Function blockRTO
REAL to String
Structured textSBR
Subroutine
Structured textFunction blockSCL
Structured textSNEG
Selected Negate
Process control Structured text
Function blockSOC
Second-Order Controller
Process control Structured text
Function blockSQI
Sequencer Input
SQLSequencer Load
SQOSequencer Output
SQRSquare Root
Function blockSQRT
Square Root
SRTFile Sort
Structured textSRTP
Split Range Time Proportional
Process control Structured text
Function blockSSUM
Selected Summer
Process control Structured text
Function blockSSV
Set System Value
Structured textSTD
File Standard Deviation
STODString To DINT
Structured textSTOR
String To REAL
Structured textSUB
Subtract
Structured textFunction blockSWPB
TAN
Function blockTND
Temporary End
TODConvert to BCD
Function blockTOFR
Timer Off Delay with Reset
Function block
Trang 35User Interrupt Enable
Structured textUPDN
Up/Down Accumulator
Process control Structured text
Function blockUPPER
Upper Case
Structured textXIC
Function block
Trang 36Notes:
Trang 37Introduction This manual provides a programmer with details about each available instruction
for a Logix-based controller.
Who Should Use This Manual You should be familiar with how the Logix-based controller stores and processes
data.
Novice programmers should read all of the details about an instruction before using the instruction Experienced programmers can refer to the instruction information to verify details.
Purpose of This Manual This manual is one of a set of related manuals that shows common procedures for
programming and operating Logix5000™ controllers For a complete list of common procedures manuals, see the Logix5000 Controllers Common Procedures Programming Manual, publication 1756-PM001
The term Logix5000 controller refers to any controller that is based on the Logix5000 operating system, such as:
Instruction name Identifies the instruction
Defines whether the instruction is an input or an output instruction
If available in relay ladder, describes the operands
If available in function block, describes the operands
The pins shown on a default function block are only the default pins The operands table lists all the possible pins for a function block
If available in structured text, describes the operands
Trang 38The following icons help identify language-specific information.
Common Information for
Example Provides at least one programming example in each available programming language
Includes a description explaining each example
Table 1 - Description of Instruction Format
• Arithmetic status flags
• Data types
• Keywords
Function block attributes Function Block Attributes defines:
• Program and operator control
• Timing modes
A value is set to any non-zero number
All the bits in a value are cleared to 0
Trang 39If an operand or parameter supports more than one data type, the bold data types
indicate optimal data types An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL.
Relay Ladder Rung Condition
The controller evaluates ladder instructions based on the rung condition preceding the instruction (rung-condition-in) Based on the rung-condition-in and the instruction, the controller sets the rung condition following the
instruction (rung-condition-out), which in turn, affects any subsequent
instruction.
If the rung-condition-in to an input instruction is true, the controller evaluates the instruction and sets the rung-condition-out based on the results of the instruction If the instruction evaluates to true, the rung-condition-out is true; if the instruction evaluates to false, the rung-condition-out is false.
The controller also prescans instructions Prescan is a special scan of all routines
in the controller The controller scans all main routines and subroutines during prescan, but ignores jumps that could skip the execution of instructions The controller executes all FOR loops and subroutine calls If a subroutine is called more than once, it is executed each time it is called The controller uses prescan of relay ladder instructions to reset non-retentive I/O and internal values.
During prescan, input values are not current and outputs are not written The following conditions generate prescan:
• Toggle from Program to Run mode.
• Automatically enter Run mode from a power-up condition.
Trang 40Rung-Function Block States
The controller evaluates function block instructions based on the state of different conditions.
Every function block instruction also includes EnableIn and EnableOut parameters:
• Function block instructions execute normally when EnableIn is set.
• When EnableIn is cleared, the function block instruction either executes
prescan logic, postscan logic, or just skips normal algorithm execution.
• EnableOut mirrors EnableIn, however, if function block execution detects
an overflow condition EnableOut is also cleared.
• Function block execution resumes where it left off when EnableIn toggles
from cleared to set However, there are some function block instructions that specify special functionality, such as re-initialization, when EnableIn toggles from cleared to set For function block instructions with time base parameters, whenever the timing mode is Oversample, the instruction always resumes were it left off when EnableIn toggles from cleared to set.
If the EnableIn parameter is not wired, the instruction always executes as normal and EnableIn remains set If you clear EnableIn, it changes to set the next time the instruction executes.
IMPORTANT When programming in function block, restrict the range of
engineering units to +/-10+/-15 because internal floating point calculations are done by using single precision floating point Engineering units outside of this range may result in a loss of accuracy
if results approach the limitations of single precision floating point (+/-10+/-38).
Possible Condition Description
Prescan Prescan for function block routines is the same as for relay ladder routines The only difference is that the Enablein parameter for each function
block instruction is cleared during prescan
Instruction first scan Instruction first scan refers to the first time an instruction is executed after prescan The controller uses instruction first scan to read current
inputs and determine the appropriate state to be in
Instruction first run Instruction first run refers to the first time the instruction executes with a new instance of a data structure The controller uses instruction first
run to generate coefficients and other data stores that do not change for a function block after initial download