Professional Documents
Culture Documents
Logix5550 Controller
(Cat. No. 1756-L1)
Programming Manual
product icon
Preface
This section list and describes any operands you must specify when you enter the instruction. This section provides timing and memory information. This section also uses these symbols to indicate when the controller executes the instruction:
rung is true rung is false rung goes from false to true
This section lists and describes the control structure of the instruction, if any. Not all instructions use control structures. This section provides at least one programming example to demonstrate how to use the instruction.
The more complex instructions have multiple examples or more configuration information, as needed.
Logix5550 Controller Instruction Set Quick Reference 1756-6.5.11 Logix5550 Controller Quick Start Motion Control User Manual 1756-10.1 1756-x.xx
ii
Table of Contents
Bit Instructions
Chapter 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 I/O Tags in Data Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 Rung Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 Examine On (XIC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Examine Off (XIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Energize (OTE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Latch (OTL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 Unlatch (OTU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 One Shot (ONS). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12 One Shot Rising (OSR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14 One Shot Falling (OSF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16
Chapter 2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 Using Timers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 Timer Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Timer On Delay (TON) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Pausing a TON instruction . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 How controller mode can affect the TON instruction . . . . . 2-4 Timer Off Delay (TOF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 How controller mode can affect the TOF instruction. . . . . . 2-7 Retentive Timer On (RTO) . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 How controller mode can affect the RTO instruction . . . . 2-10 Using Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 Count Up (CTU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Count Down (CTD). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 Reset (RES). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19
tocii
Table of Contents
Input/Output Instructions
Chapter 3 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 Message (MSG). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Selecting the Message Type . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 Specifying CIP messages. . . . . . . . . . . . . . . . . . . . . . . . . 3-10 Specifying PLC-5 messages . . . . . . . . . . . . . . . . . . . . . . 3-10 Specifying SLC messages . . . . . . . . . . . . . . . . . . . . . . . . 3-11 Specifying block-transfer messages . . . . . . . . . . . . . . . . 3-11 Specifying PLC-3 messages . . . . . . . . . . . . . . . . . . . . . . 3-12 Specifying PLC-2 messages . . . . . . . . . . . . . . . . . . . . . . 3-12 Specifying the Communication Details. . . . . . . . . . . . . . . . . 3-13 Mapping addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13 MSG Programming Examples . . . . . . . . . . . . . . . . . . . . . . . 3-13 CIP communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13 Ethernet communications . . . . . . . . . . . . . . . . . . . . . . . . 3-13 ControlNet communications. . . . . . . . . . . . . . . . . . . . . . . 3-13 Replacing PLC-5 block-transfer instructions . . . . . . . . . . 3-14 Get Status Value (GSV) and Set Status Value (SSV) . . . . . . . 3-15 Accessing the AXIS object . . . . . . . . . . . . . . . . . . . . . . . . 3-16 Accessing the CONTROLLER object . . . . . . . . . . . . . . . . . 3-16 Accessing the CONTROLLERDEVICE object . . . . . . . . . . . 3-17 Accessing the CST object . . . . . . . . . . . . . . . . . . . . . . . . 3-18 Accessing the DF1 object . . . . . . . . . . . . . . . . . . . . . . . . 3-18 Accessing the FAULTLOG object. . . . . . . . . . . . . . . . . . . . 3-20 Accessing the MESSAGE object . . . . . . . . . . . . . . . . . . . . 3-21 Accessing the MODULE object . . . . . . . . . . . . . . . . . . . . . 3-22 Accessing the MOTIONGROUP object . . . . . . . . . . . . . . . . 3-22 Accessing the PROGRAM object. . . . . . . . . . . . . . . . . . . . 3-22 Accessing the ROUTINE object. . . . . . . . . . . . . . . . . . . . . 3-23 Accessing the SERIALPORT object . . . . . . . . . . . . . . . . . . 3-24 Accessing the TASK object . . . . . . . . . . . . . . . . . . . . . . . 3-25 Accessing the WALLCLOCKTIME object . . . . . . . . . . . . . . 3-25 GSV/SSV Programming Example . . . . . . . . . . . . . . . . . . . . . 3-26 Getting fault information . . . . . . . . . . . . . . . . . . . . . . . . . 3-26 Setting enable and disable flags . . . . . . . . . . . . . . . . . . . 3-27
Table of Contents
tociii
Compare Instructions
Chapter 4 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1 Using arithmetic status flags . . . . . . . . . . . . . . . . . . . . . . . 4-2 Compare (CMP). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Valid operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Equal to (EQU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 Greater than or Equal to (GEQ). . . . . . . . . . . . . . . . . . . . . . . . 4-6 Greater Than (GRT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 Less Than or Equal to (LEQ). . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 Less Than (LES) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9 Limit (LIM). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10 Mask Equal to (MEQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12 Entering an immediate mask value . . . . . . . . . . . . . . . . . 4-13 Not Equal to (NEQ). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
Compute/Math Instructions
Chapter 5 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1 Using arithmetic status flags . . . . . . . . . . . . . . . . . . . . . . . 5-1 Compute (CPT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Valid operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Determining the order of operation . . . . . . . . . . . . . . . . . . 5-2 Add (ADD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Subtract (SUB). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5 Multiply (MUL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 Divide (DIV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7 Square Root (SQR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8 Negate (NEG). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
Arithmetic/Logic Instructions
Chapter 6 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 Move (MOV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Masked Move (MVM). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Bit Field Distribute (BTD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5 Clear (CLR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 Bitwise AND (AND) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 Bitwise OR (OR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 Bitwise Exclusive OR (XOR) . . . . . . . . . . . . . . . . . . . . . . . . . 6-12 Bitwise NOT (NOT). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14
tociv
Table of Contents
File Concepts
Chapter 7 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1 Manipulating Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Using the Control Structure . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 Selecting Mode of Operation . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 All mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 Numerical mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Incremental mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
File/Misc. Instructions
Chapter 8 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1 Using the File/Misc. Instructions . . . . . . . . . . . . . . . . . . . . . . 8-2 Using arithmetic status flags . . . . . . . . . . . . . . . . . . . . . . . 8-2 Specifying dimensions within an array. . . . . . . . . . . . . . . . 8-3 File Arithmetic and Logic (FAL) . . . . . . . . . . . . . . . . . . . . . . . 8-4 Valid operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 File Search and Compare (FSC) . . . . . . . . . . . . . . . . . . . . . . . 8-7 File Copy (COP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10 File Fill (FLL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12 File Average (AVE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13 File Sort (SRT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-15 File Standard Deviation (STD) . . . . . . . . . . . . . . . . . . . . . . . 8-17
File/Shift Instructions
Chapter 9 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1 Using the File/Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . 9-2 Bit Shift Left (BSL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 Bit Shift Right (BSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5 FIFO Load (FFL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7 FIFO Unload (FFU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9 LIFO Load (LFL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-11 LIFO Unload (LFU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-13
Sequencer Instructions
Chapter 10 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 Using the Sequencer Instructions . . . . . . . . . . . . . . . . . . . . 10-2 Sequencer Input (SQI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3 Sequencer Output (SQO) . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5 Sequencer Load (SQL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7
Table of Contents
tocv
Chapter 11 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1 Jump to Label (JMP), Label (LBL) . . . . . . . . . . . . . . . . . . . . 11-2 Jump to Subroutine (JSR), Subroutine (SBR), Return (RET) . 11-4 Temporary End (TND) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6 Master Reset Control (MCR) . . . . . . . . . . . . . . . . . . . . . . . . 11-7 User Interrupt Disable (UID) . . . . . . . . . . . . . . . . . . . . . . . . . 11-9 User Interrupt Enable (UIE). . . . . . . . . . . . . . . . . . . . . . . . . 11-10 Always False Instruction (AFI) . . . . . . . . . . . . . . . . . . . . . . 11-11 No Operation (NOP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12
For/Next Instructions
Chapter 12 For/Break Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1 For (FOR). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2 Break (BRK). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4
Special Instructions
Chapter 13 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1 Using the Diagnostic Instructions. . . . . . . . . . . . . . . . . . . . . 13-2 File Bit Comparison (FBC) . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3 Diagnostic Detect (DDT) . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6 Data Transitional (DTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-9 Using PID Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11 Integral term implementation. . . . . . . . . . . . . . . . . . . . . 13-13 Derivative term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-14 Setting the deadband . . . . . . . . . . . . . . . . . . . . . . . . . . 13-14 Using zero-crossing. . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15 Setting output alarms . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15 Using output limiting . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15 Using manual mode (with bumpless transfer) . . . . . . . . 13-16 Feedforward or output biasing . . . . . . . . . . . . . . . . . . . . 13-16 Proportional Derivative Integral (PID) . . . . . . . . . . . . . . . . . 13-17 Configuring a PID Instruction . . . . . . . . . . . . . . . . . . . . . . . 13-20 PID Programming Examples . . . . . . . . . . . . . . . . . . . . . . . 13-22 Programming Considerations. . . . . . . . . . . . . . . . . . . . . 13-22 Placing the PID instruction in the main routine. . . . . . . . 13-23 Placing the PID instruction in an RTS routine . . . . . . . . . 13-24 Simulating a manual control station. . . . . . . . . . . . . . . . 13-24 Cascading loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-25 Controlling a ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26 Tracking the process variable . . . . . . . . . . . . . . . . . . . . 13-27
tocvi
Table of Contents
Trigonometric Instructions
Chapter 14 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1 Using arithmetic status flags . . . . . . . . . . . . . . . . . . . . . . 14-1 Sine (SIN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 Cosine (COS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-3 Tangent (TAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-4 Arc Sine (ASN). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5 Arc Cosine (ACS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6 Arc Tangent (ATN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7
Chapter 15 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1 Using arithmetic status flags . . . . . . . . . . . . . . . . . . . . . . 15-1 Natural Log (LN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2 Log Base 10 (LOG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-3 X to the Power of Y (XPY). . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4
Chapter 16 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1 Using arithmetic status flags . . . . . . . . . . . . . . . . . . . . . . 16-1 Degrees (DEG). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2 Radians (RAD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3 Convert to BCD (TOD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-4 Convert to Integer (FRD) . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-5
Motion Concepts
Chapter 17 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1 Identifying the Components of the ControlLogix Motion System17-2 The Logix5550 Controller (1756-L1) . . . . . . . . . . . . . . . . 17-2 The Analog/Encoder Servo Module (1756-MO2AE) . . . . . 17-2 RSLogix5000 Programming Software . . . . . . . . . . . . . . . 17-2 Developing a Motion Control Application Program . . . . . . . . 17-3 Adding a motion module . . . . . . . . . . . . . . . . . . . . . . . . . 17-3 Identifying and configuring each axis. . . . . . . . . . . . . . . . 17-3 Writing a motion application program . . . . . . . . . . . . . . . 17-4 Understanding Instruction Timing . . . . . . . . . . . . . . . . . . . . 17-5 Immediate type instructions . . . . . . . . . . . . . . . . . . . . . . 17-5 Delayed (message) type instructions . . . . . . . . . . . . . . . . 17-6 Process type instructions. . . . . . . . . . . . . . . . . . . . . . . . . 17-7 Using the Control Structure . . . . . . . . . . . . . . . . . . . . . . . . 17-10 Using Motion Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12
Table of Contents
tocvii
Chapter 18 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-1 Motion Servo On (MSO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3 Motion Servo Off (MSF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5 Motion Axis Shutdown (MASD) . . . . . . . . . . . . . . . . . . . . . . 18-7 Motion Axis Shutdown Reset (MASR). . . . . . . . . . . . . . . . . 18-10 Motion Direct Drive On (MDO) . . . . . . . . . . . . . . . . . . . . . . 18-12 Motion Direct Drive Off (MDF) . . . . . . . . . . . . . . . . . . . . . . 18-14 Motion Axis Fault Reset (MAFR). . . . . . . . . . . . . . . . . . . . . 18-16
Chapter 19 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-1 Motion Axis Stop (MAS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2 Motion Axis Home (MAH). . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5 Motion Axis Jog (MAJ). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8 Motion Axis Move (MAM). . . . . . . . . . . . . . . . . . . . . . . . . . 19-11 Motion Axis Gearing (MAG) . . . . . . . . . . . . . . . . . . . . . . . . 19-15 Motion Change Dynamics (MCD) . . . . . . . . . . . . . . . . . . . . 19-18 Motion Redefine Position (MRP). . . . . . . . . . . . . . . . . . . . . 19-21
Chapter 20 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-1 Motion Group Stop (MGS) . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2 Motion Group Program Stop (MGPS) . . . . . . . . . . . . . . . . . . 20-4 Motion Group Shutdown (MGSD) . . . . . . . . . . . . . . . . . . . . . 20-6 Motion Group Shutdown Reset (MGSR) . . . . . . . . . . . . . . . . 20-8 Motion Group Strobe Position (MGSP) . . . . . . . . . . . . . . . . 20-10
Chapter 21 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-1 Motion Arm Watch (MAW) . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2 Motion Disarm Watch (MDW). . . . . . . . . . . . . . . . . . . . . . . . 21-4 Motion Arm Registration (MAR) . . . . . . . . . . . . . . . . . . . . . . 21-6 Motion Disarm Registration (MDR). . . . . . . . . . . . . . . . . . . . 21-9 Chapter 22 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22-1 Motion Apply Axis Tuning (MAAT) . . . . . . . . . . . . . . . . . . . . 22-2 Motion Run Axis Tuning (MRAT). . . . . . . . . . . . . . . . . . . . . . 22-4 Motion Apply Hookup Diagnostics (MAHD). . . . . . . . . . . . . . 22-7 Motion Run Hookup Diagnostics (MRHD) . . . . . . . . . . . . . . . 22-9
tocviii
Table of Contents
Notes:
Chapter
Bit Instructions
(XIC, XIO, OTE, OTL, OTU, ONS, OSR, OSF)
Introduction
Use the bit (relay-type) instructions to monitor and control the status of bits, such as input bits or timer control-word bits.
If you want to: examine a bit for an ON condition examine a bit for an OFF condition hold a bit ON or OFF (non-retentive) latch a bit to ON (retentive) unlatch a bit to OFF (retentive) make a rung true for one program scan upon a false-to-true transition of the conditions preceding the ONS instruction on the rung trigger an event based on the change of state of the rung from true to false trigger an event based on the change of state of the rung from false to true Use this instruction: XIC XIO OTE OTL OTU ONS See page: 1-2 1-4 1-6 1-8 1-10 1-12
OSR OSF
1-14 1-16
The input tags in the controller store the status of input sensors connected to input module terminals.
If the input sensor is: closed (on) open (off) then its corresponding input image bit is: on (1) off (0)
The output tags control the status of actuators wired to output module terminals.
If the output image bits is: on (1) off (0) then its corresponding output is: energized (on) de-energized (off)
Rung Logic
As each conditioning instruction is executed, the specified bit is examined to see if it matches a certain condition (on or off). If a complete path of true conditions examined for are found, the rung is set to true. The rung must contain a continuous path of true instructions from the start of the rung (far left) to the output instruction for the output to be enabled.
1-2
Bit Instructions
Examine On (XIC)
Description: When a device closes its circuit, the module whose input terminal is wired to the device detects the closed circuit. This is the ON state. When the controller executes an XIC instruction with a tag that represents an input terminal, the controller determines whether the device is ON (closed). If the controller finds an ON state, the controller sets the XIC instruction to true. If the controller finds an OFF state, the controller sets the XIC instruction to false. If the XIC instruction is the only conditioning instruction on the rung, the controller enables the output instruction when the XIC instruction is true (input closed). The controller disables the output instruction when the XIC instruction is false. The XIC instruction is true or false depending on whether the controller finds an ON condition at the referenced bit.
If the rung is: true and the bit is: on off false on off the rung status changes to: false true false false
You can also use the XIC instruction to access the state of controller keywords. Enter the keyword in place of the tag.
Keyword: S:PRE S:POST S:FS S:N S:Z S:V S:C S:MINOR Description: The controller is pre-scanning rungs. The controller is post-scanning rungs. This is the first normal scan of the routines in this program. The result of an operation is negative. The result of an operation is zero. The result of an operation is an overflow. The result of an operation is a carry. At least one minor fault has been generated.
Bit Instructions
1-3
Operands:
Operand: Source bit Valid Types: tag BOOL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
XIC Example:
If the controller finds an ON condition at the bit that corresponds to limit_switch_1, the instruction is true.
1-4
Bit Instructions
You can also use the XIO instruction to access the state of controller keywords. Enter the keyword in place of the tag.
Keyword: S:PRE S:POST S:FS S:N S:Z S:V S:C S:MINOR Description: The controller is pre-scanning rungs. The controller is post-scanning rungs. This is the first normal scan of the routines in this program. The result of an operation is negative. The result of an operation is zero. The result of an operation is an overflow. The result of an operation is a carry. At least one minor fault has been generated.
Bit Instructions
1-5
Operands:
Operand: Source bit Valid Types: tag BOOL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 0.13 na na
executes does not execute executes
false 0.11 na
XIO Example:
If the controller finds an OFF condition at the bit that corresponds to limit_switch_2 , the instruction is true.
1-6
Bit Instructions
Energize (OTE)
Description: Use the OTE instruction to control a bit. If the bit corresponds to an output module terminal, the device wired to this terminal is energized when the instruction is enabled. The device is de-energized when the instruction is disabled. If the output conditions that precede the OTE instruction are true, the controller enables the OTE instruction. If the output conditions that preceded the OTE instruction are false, the controller disables the OTE instructions. When rung conditions become false, the corresponding device de-energizes. An OTE instruction is similar to a relay coil. The OTE instruction is controlled by preceding input instructions; the relay coil is controlled by contacts in its hard-wired rung. The OTE instruction tells the controller how to control the referenced bit based on the rung condition.
If the rung is: true false the controller turns the bit: on (1) off (0)
Operands:
Operand: Destination bit Valid Types: tag BOOL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 0.19 na na
executes does not execute executes
false 0.19 na
Bit Instructions
1-7
OTE Example:
If the rung is true (all preceding input instructions are true), the controllers turns ON the bit that corresponds to light_1. If the rung is not true (one or more of the preceding instructions is false), the controller turns OFF the bit.
1-8
Bit Instructions
Latch (OTL)
Description: The OTL instruction is a retentive output instruction that can only turn on a bit (in cannot turn off a bit). This instruction is usually used with an OTU (unlatch) instruction, with both instructions referencing the same bit. When you assign a tag to an OTL instruction that corresponds to a terminal of an output module, the input device wired to this terminal is energized when the controller sets (enables) the bit. If the input conditions that precede the OTL instruction are true, the controller enables the OTL instruction. When rung conditions become false (after being true), the bit remains set and the corresponding output device remains energized. Use the OTU instruction to turn off the bit you latched on with the OTL instruction. When enabled, the OTL instruction tells the controller to turn on the referenced bit. Thereafter, the bit remains on, regardless of the rung condition, until the bit is turned off, typically by an unlatch (OTU) instruction in another rung.
If the rung is: true false the controller turns the bit: on (1) no change
Operands:
Operand: Destination bit Valid Types: tag BOOL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 0.20 na na
executes does not execute executes
false 0.13 na
Bit Instructions
1-9
OTL Example:
If the rung is true (all preceding input instructions are true), the controllers turns ON the bit that corresponds to light_2. This bit remains ON until it is reset by an OTU instruction.
1-10
Bit Instructions
Unlatch (OTU)
Description: The OTU instruction is a retentive output instruction that can only turn off a bit (it cannot turn on a bit). This instruction is usually used with an OTL (latch) instruction, with both instructions referencing the same bit. The OTU instruction turns off the bit, which was turned on (latched) by the OTL instruction. When the controller changes from Run to Program mode or when the controller loses power (and there is battery backup), the bit remains in the state set by the last rung of the latch/unlatch pair that was true. The OTU instruction tells the controller to turn off the referenced bit based on the rung condition. Thereafter, the bit remains off, regardless of the rung condition, until it is turned on, typically by an OTL instruction in another rung.
If the rung is: true false the controller turns the bit: off (0) no change
Operands:
Operand: Destination bit Valid Types: tag BOOL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 0.20 na na
executes does not execute executes
false 0.11 na
Bit Instructions
1-11
OTU Example:
If the rung is true (all preceding input instructions are true), the controllers turns OFF the bit that corresponds to light_2.
1-12
Bit Instructions
During prescan, the bit tag is set to prevent false triggering when the program scan begins. Operands:
Operand: Source bit Valid Types: tag BOOL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true na na
does not execute does not execute executes
false na
Bit Instructions
1-13
ONS Example:
The ONS instruction makes the rung true for one scan upon a false-to-true transition of any preceding instructions.
1-14
Bit Instructions
storage bit
output bit
40048
Use the OSR instruction whenever an event must start based on the change of state of the rung from false to true, not continuously when the rung is true. You must enter a bit tag for the output bit and the storage bit. Operands:
Operand: Storage bit the tag where you want to store the storage bit status tag BOOL Output bit the tag where you want to store the output bit status Valid Types: tag BOOL
Bit Instructions
1-15
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true na na
does not execute does not execute executes
false na
OSR Example:
When the rung goes from false to true, the controller turns ON the bit that corresponds to output_bit_1 for one scan. The status of the bit that corresponds to storage_bit_1 reflects the current rung status.
1-16
Bit Instructions
storage bit
output bit
40048
Use the OSF instruction whenever an event must start based on the change of state of the rung from true to false, not on the resulting rung status. You must enter a bit tag for the output bit and the storage bit. Operands:
Operand: Storage bit the tag where you want to store the storage bit status Output bit the tag where you want to store the output bit status tag BOOL Valid Types: tag BOOL
Bit Instructions
1-17
Operation:
\
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true na na
does not execute does not execute executes
false na
OSF Example:
When the rung goes from true to false, the controller turns ON the bit that corresponds to output_bit_2 for one scan. The status of the bit that corresponds to storage_bit_2 reflects the current rung status.
1-18
Bit Instructions
Notes:
Chapter
Using Timers
The controller stores timer status bits and the preset and accumulated values in a TIMER structure. Not all timer instruction use the entire TIMER structure. See each instruction for the portion it uses.
TIMER structure
bit number
31 30 29 28 27 26 25
EN TT DN FS LS OV ER
16 15
Control bit or word: .EN bit .TT bit .DN bit .FS bit .LS bit .OV bit .ER bit .PRE word .ACC word
Description: The enable bit indicates the timer is enabled. The timing bit indicates that a timing operation is in process The done bit indicates that a timing operation is complete. not used not used not used not used The preset value specifies the value which the timer must reach before the controller sets the .DN bit. The accumulated value specifies the number of increments the instruction has counted. When enabled, the timer updates this value continually. Typically, enter zero. If you enter a value, the instruction starts counting time base intervals from that value. If the timer is reset, the .ACC value is zero.
2-2
To access timer control bits, the preset value, or the accumulated value, use the tag mnemonic. For example, timer1.pre accesses the preset value for the tag timer1.
Timer Accuracy
The time base is 1 msec for all timers. Timer accuracy depends on the controller clock tolerance, which is + 0.02%. A timer could time out early or late by 1 msec. The displayed accumulated value of a timer shows the actual time, but it is dependent on the CRT update time. The accumulated value might appear to be less than the preset when the .DN bit is set.
2-3
rung condition
Operands:
Operand: Timer Preset Accum Valid Types: tag TIMER immediate (0-2147483647) immediate (0-2147483647)
2-4
Control status:
Control bit or word: .EN bit Description: The enable bit is set when the rung goes true. It is reset when: .TT bit the rung goes false a RES instruction resets the timer
The timing bit is set when the rung goes true. It is reset when: the rung goes false the .DN bit is set (.ACC=.PRE) a RES instruction resets the timer
.DN bit
The done bit is set when the accumulated value is equal to the preset value (.ACC=.PRE). It is reset when: the rung goes false a RES instruction resets the timer
The preset value specifies the value which the timer must reach before the controller sets the .DN bit. The accumulated value specifies the number of increments the instruction has counted. When enabled, the timer updates this value continually. Typically, enter zero. If you enter a value, the instruction starts counting time base intervals from that value. If the timer is reset, the .ACC value is zero.
2-5
Then when you switch back to Run or Test mode, or power is restored, the following occurs:
Condition: If the rung is true Result: .EN bit remains set .TT bit remains set .DN bit remains reset .ACC value is reset and starts incrementing If the rung is false .EN bit is reset .TT bit is reset .DN bit is reset .ACC value is reset
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
TON Example:
When limit_switch_1 is set, the controller starts timer_1. The accumulated value increments as long as the rung remains true. The bit that corresponds to timer_1.tt is set and light_2 is energized while the timer is timing. When the timer is finished (.ACC=.PRE), timer_1.tt is reset, light_2 is de-energized, and timer_1.dn is set. When .ACC=.PRE or when the rung conditions go false, the timer is reset.
2-6
preset
16650
Operands:
Operand: Timer Preset Accum Valid Types: tag TIMER immediate (0-2147483647) immediate (0-2147483647)
2-7
Control status:
Control bit or word: .EN bit Description: The enable bit is set when the rung goes true. It is reset when: .TT bit the rung goes false a RES instruction resets the timer
The timing bit is set when the rung goes false and .ACC<.PRE. It is reset when: the rung goes true the .DN bit is set (.ACC=.PRE) a RES instruction resets the timer
.DN bit
The done bit is set when the rung goes true. It is reset when: .ACC=.PRE the rung goes false a RES instruction resets the timer
The preset value specifies the value which the timer must reach before the controller sets the .DN bit. The accumulated value specifies the number of increments the instruction has counted. When enabled, the timer updates this value continually. Typically, enter zero. If you enter a value, the instruction starts counting time base intervals from that value. If the timer is reset, the .ACC value is zero.
Then when you switch back to Run or Test mode, or power is restored, the following occurs:
Condition: If the rung is true Result: .EN bit is set .TT bit is reset .DN bit remains reset .ACC value is reset If the rung is false .EN bit is reset .TT bit is reset .DN bit is reset .ACC=.PRE
2-8
ATTENTION: Because the RES instruction resets the .ACC value, .DN bit, and .TT bit, do not use the RES instruction to reset a TOF timer.
During prescan: ATTENTION: Because the RES instruction resets the .ACC value, .DN bit, and .TT bit, do not use the RES instruction to reset a TOF timer.
!
Operation:
Characteristic: Timing (in s)
.TT bit is reset .ACC value is set equal to the .PRE value
DINT REAL
does not execute does not execute executes
TOF Example:
When limit_switch_2 is reset, the controller starts timer_2. The accumulated value increments as long as the rung remains false. The bit that corresponds to timer_2.tt is set and light_2 is energized while the timer is timing. When the timer is finished (.ACC=.PRE), timer_2.tt is reset, light_2 is de-energized, and timer_2.dn is set. When .ACC=.PRE or when the rung conditions go true, the timer is reset.
2-9
rung condition
timer enable bit (.EN) reset pulse timer timing bit (.TT)
timer done bit (.DN) output device (controlled by .DN bit) preset
When the controller resumes operation or the rung goes true, timing continues from the retained .ACC value. By retaining the .ACC value, retentive timers measure the cumulative period during which the rung is true. To reset the retentive timers .ACC value and status bits after the RTO rung goes false, use the RES instruction. Operands:
Operand: Timer Preset Accum Valid Types: tag TIMER immediate (0-2147483647) immediate (0-2147483647)
2-10
Control status:
Control bit or word: .EN bit Description: The enable bit is set when the rung goes true. It is reset when: .DN bit the rung goes false a RES instruction resets the timer
The done bit is set when .ACC=.PRE. It is reset when: the rung goes false a RES instruction resets the timer
The preset value specifies the value which the timer must reach before the controller sets the .DN bit. The accumulated value specifies the number of increments the instruction has counted. When enabled, the timer updates this value continually. Typically, enter zero. If you enter a value, the instruction starts counting time base intervals from that value. If the timer is reset, the .ACC value is zero.
Then when you switch back to Run or Test mode, or power is restored, the following occurs:
Condition: If the rung is true Result: .EN bit remains set .TT bit remains reset .ACC value continues incrementing If the rung is false .EN bit is reset .TT bit is reset .DN bit is reset .ACC value remains the same
2-11
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
RTO Example:
When limit_switch_1 is set, the controller starts incrementing the accumulated value of timer_3. The timer values remain when limit_switch_1 goes false.
2-12
Using Counters
The controller stores controller status bits and the preset and accumulated values in a COUNTER structure. Not all counter instruction use the entire COUNTER structure. See each instruction for the portion it uses.
COUNTER structure
bit number 31 30 29 28 27 CU CD DN OV UN 16 15 0
Control bit or word: .CU bit .CD bit .DN bit .OV bit
Description: The count up enable bit indicates that the instruction has increased its count. This status bit is only used by the CTU instruction. The count down enable bit indicates that the instruction has decreased its count. This status bit is only used by the CTD instruction. The done bit indicates that a counting operation is complete. The overflow bit indicates that the counter exceeded the upper limit of 2147483648 and began counting up again from -2147483648. This status bit is only used by the CTU instruction. The underflow bit indicates that the counter exceeded the lower limit of -2147483648 and began counting down again from 2147483648. This status bit is only used by the CTD instruction. The preset value specifies the value which the timer must reach before the controller sets the .DN bit. The accumulated value specifies the number of increments the instruction has counted. When enabled, the timer updates this value continually. Typically, enter zero. If you enter a value, the instruction increments or decrements from that value. If the timer is reset, the .ACC value is zero.
.UN bit
To access counter control bits, the preset value, or the accumulated value, use the tag mnemonic. For example, counter1.pre accesses the preset value for the tag counter1.
2-13
Count Up (CTU)
Description: The CTU instruction counts upward over a range of -214748368 to +214748367. Each time the rung goes from false to true, the CTU instruction increments the .ACC value by one count. When the .ACC value equals or exceeds the preset value, the CTU instruction sets the done .(DN) bit, which your program can use to initiate some action, such as controlling a storage bit or an output device. The .ACC value is retentive. The count is retained until it is reset by a RES instruction.
rung condition that controls CTU
count-up done bit (.DN) output device (controlled by .DN bit) preset
Operands:
Operand: Counter Preset Accum Valid Types: tag COUNTER immediate (-214748368 to +214748367) immediate (-214748368 to +214748367)
2-14
Control status:
Control bit or word: .CU bit Description: The count up bit is set when the rung goes true. It is reset when the rung goes false a RES instruction resets the counter
During prescan, this bit is set to prevent a false count when the program scan begins. .DN bit The done bit is set when .ACC.PRE. It is reset when: .OV bit .ACC<.PRE a RES instruction resets the counter combining CTU and CTD instructions and counting back up past the .PRE value
The overflow bit is set when the counter exceeds the upper limit of 2147483647. It is reset when: a RES instruction resets the counter counting back down to 2147483647 with a CTD instruction that uses the same tag as the CTU instruction
The preset value specifies the value which the counter must reach before the controller sets the .DN bit. The accumulated value specifies the number of increments the instruction has counted. When enabled, the counter updates this value continually. Typically, enter zero. If you enter a value, the instruction increments from that value. If the counter is reset, the .ACC value is zero.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
2-15
CTU Example:
Each time limit_switch_1 goes from false to true, the controller increments the counter_1 by 1. When the accumulated value the preset value, the controller sets counter_1.dn. The controller sets counter_1.ov if the accumulated value exceeds 2147483647.
2-16
Operands:
Operand: Counter Preset Accum Valid Types: tag COUNTER immediate (-214748368 to +214748367) immediate (-214748368 to +214748367)
2-17
Control status:
Control bit or word: .CD bit Description: The count down bit is set when the rung goes true. It is reset when the rung goes false a RES instruction resets the counter
During prescan, this bit is set to prevent a false count when the program scan begins. .DN bit The done bit is set when .ACC.PRE. It is reset when: .UN bit .ACC<.PRE a RES instruction resets the counter combining CTU and CTD instructions and counting back up past the .PRE value
The underflow bit is set when the counter exceeds the lower limit of -2147483648. It is reset when: a RES instruction resets the counter counting back up to -2147483648 with a CTU instruction that uses the same tag as the CTU instruction
The preset value specifies the value which the counter must reach before the controller sets the .DN bit. The accumulated value specifies the number of increments the instruction has counted. When enabled, the counter updates this value continually. Typically, enter zero. If you enter a value, the instruction decrements from that value. If the counter is reset, the .ACC value is zero.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
2-18
CTD Example:
Each time limit_switch_1 goes from false to true, the controller decrements the counter_2 by 1. When the accumulated value the preset value, the controller sets counter_2.dn. The controller sets counter_1.ov if the accumulated value underflows 2147483647.
2-19
Reset (RES)
Description: The RES instruction is an output instruction that resets a TIMER, COUNTER, or CONTROL structure. The RES instruction executes when its rung is true.
When using a RES instruction for a: timer
counter
file instruction
You can use a negative .PRE value in a CTU or CTD instruction. When you use the RES instruction, is resets the .ACC value to zero, which might set the .DN bit and prevent the CTU or CTD instruction from operating. You can also use the RES instruction to reset the state of these controller keywords. Enter the keyword in place of the tag.
Keyword: S:FS S:N S:Z S:V S:C S:MINOR Description: This is the first normal scan of the routines in this program. The result of an operation is negative. The result of an operation is zero. The result of an operation is an overflow. The result of an operation is a carry. At least one minor fault has been generated.
Operands:
Operand: Structure Valid Types: tag TIMER, COUNTER, or CONTROL
2-20
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
RES Example:
Example: Description: When the input conditions are true, reset timer_3.
Chapter
Input/Output Instructions
(MSG, GSV, SSV)
Introduction
The input/output instructions read or write data to or from the controller or a block of data to or from another station on the network.
If you want to: send data to or from another device get controller status information set controller status information Use this instruction: MSG GSV SSV See page: 3-2 3-15 3-15
3-2
Input/Output Instructions
Message (MSG)
Description: The MSG instruction reads or writes a block of data to another station on a network and to create unscheduled messages. The MSG instruction transfers as many as 1000 elements of data. The size of each element depends on the data types you specify and the type of message command you use. The MSG instruction transfers data in packets. If your message contains more data than what fits into one packet, the transfer requires more than one packet. The more packets of data to transfer, the longer the transfer takes.
On this network: ControlLogix ControlNet Ethernet DH+ remote I/O ? 709 words 120 words ? MSG packets are:
Operands:
Operand: Control block Valid Types: tag MESSAGE
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
Input/Output Instructions
3-3
Control status:
Each MSG instruction has a MESSAGE structure that contains status information about the instruction.
MESSAGE structure
bit number
31 30 29 28 27 26 25
EW ER DN ST EN TO EN.CC
16 15
flags (.FLAGS) error codes (.ERR) extended error codes (.EXERR) requested length (.REQ_LEN) done length (.DN_LEN)
Description: The enable waiting bit is set when the controller detects that a message request entered the queue. The controller resets the .EW bit when the .ST bit is set.
.ER bit
The error bit is set when the controller detects that a transfer failed. The .ER bit is reset the next time the associated rung goes from false to true.
.DN bit
The done bit is set when the last packet of the instruction transferred. The .DN bit is reset the next time the associated rung goes from false to true. The .DN bit is only active in non-continuous mode.
.ST bit
The start bit is set when the controller begins executing the MSG instruction. The .ST bit is reset when the .DN bit or the .ER bit is set.
.EN bit
The enable bit is set when the rung goes true. This bit shows that the instruction is enabled and is being executed. In non-continuous mode, the .EN bit remains set until the message is completed and the rung goes false. In continuous mode, once the .EN bit is set, it remains set regardless of rung condition.
.EN_CC
The enable cache bit determines how to manage the messge connection when the message is complete. If you want the controller to maintain the connection (such as when you repeat the same MSG instruction many times), set the .EN_CC bit. If you rarely execute the MSG instruction and have other needs for controller conenction, clear the .EN_CC bit. The time out bit is set if a message automatically times out. If you manually set the .TO bit, the controller stops processing the messages and sets the .ER bit.
.TO bit
3-4
Input/Output Instructions Control bit or word: .FLAGS word Description: The flags word stores the above status bits and other status information in one, 15-bit word. The error code word stores error codes for the MSG instruction.
The requested length word specifies how many words the message instruction is supposed to transfer. The done length word identifies how many words actually transferred.
.DN_LEN word
ATTENTION: The controller processes the .ST and .EW bits asynchronously to the program scan. If you examine these bits in ladder logic, copy the bit status to a storage bit whose status is synchronized with the program scan. Otherwise, timing problems might invalidate your application with possible damage to equipment to injury to personnel.
Message flags
The message flags word stores operating status in word.
This bit: 02 04 05 06 07 08 10 12 13 14 Stores: .EW .ER .DN .ST .EN .TO .EN_CC MSG_OPENING MSG_ACTIVE MSG_CLOSED Description: the message has been triggered but processing of the request hasnt begun message processing resulted in an error; check the error code to determine the cause message processing was performed to completion successfully message processing has begun program logic triggered a message instruction message processing is terminated because the message timed out controller maintains connection for MSG instruction message processing is trying to open a connection for the requested connected message message processing is performing the requested operation message processing closed the connection that was used for a connected message
Input/Output Instructions
3-5
3-6
Input/Output Instructions
Input/Output Instructions
3-7
3-8
Input/Output Instructions
Error Code: continued 0x4002 0x4003 0x4004 0x4005 0x4006 0x4007 0x5001 0x5002 0x5003 0x5004 0x5005 0x5006 0x5007 0xFD01 0xFD02
Description: motion group not inhibited motion K-constant not set motion axis not assigned to group motion update not configured maximum instances of motion axes created motion group inhibited maximum instances of motion groups created motion semaphore reject motion axes in group motion axes not inhibited duplicate axes in motion group list invalid axis in motion group motion axis not assignable to motion group bad backplane EEPROM no error code
Error Code: 0xFD03 0xFD04 0xFD05 0xFE01 0xFE02 0xFE04 0xFE05 0xFE08 0xFE09 0xFF00 0xFF01 0xFF04 0xFF08 0xFF0B 0x0FF0E
Description: missing requested connection no CST master axis or group not assigned invalid connection type invalid update rate invalidn input image pointer invalid input image size invalid output image pointer invalid output image size no connection route too long invalid state invalid route invalid configuration no connection allowed
After you enter the MSG instruction and specify the MESSAGE structure, use the configuration tab in the programming software to specify the details of the message.
Input/Output Instructions
3-9
The details you configure depend on the message type you select.
If the target device is a: ControlLogix device Select one of these message types: CIP data table read CIP data table write generic CIP PLC5 typed read PLC5 typed write PLC5 word range read PLC5 word range write SLC typed read SLC typed write See page: 3-10
PLC-5 processor
3-10
SLC controller
Block-transfer instruction from a block-transfer read previous PLC-5 program block-transfer write PLC-3 processor PLC3 typed read PLC3 typed write PLC3 word range read PLC3 word range write PLC2 unprotected read PLC2 unprotected write
PLC-2 processor
3-12
Destination Element/Tag
3-10
Input/Output Instructions
If you transfer floating point values, use a typed read or typed write to ensure accuracy.
Input/Output Instructions
3-11
The Logix5550 tag type must match the SLC data type. You can only transfer: 16-bit integer (INT), bit (BOOL), timer, counter, or control data.
In addition to specifying the source and destination tags, you must also specify how many 16-bit integers to send or receive.
3-12
Input/Output Instructions
The message transfer uses 16-bit words, so make sure the Logix5550 tag appropriately stores the transferred data. You must also specify a PLC-2 compatibility file.
Input/Output Instructions
3-13
When you configure a MSG instruction, you specify these details on the communication tab:
In this field: Path Specify: Enter the connection path to the target device. You can find the connection path through RSLinx software. Select CIP or DH+
Communication method
If you select CIP, the message is routed through the ControlLogix backplane. If you select DH+, the message is routed through a DH/RIO module. Specify: Source Link: Destination Link: Link ID of the local DH+ link Link ID of the remote DH+ link where the target device resides
Mapping addresses
For non-ControlLogix devices, you must map the target devices addressing to a local, Logix5550 tag. To map addresses, use the mapping tool in your programming software.
For: PLC-3 processors, PLC-5 processors SLC controllers Tag Name In this field: File Number Specify: Enter the file number of the address in the target device. For example, enter 7 for file 7, which is typically the N7 file. Enter the tag name the local controller uses to refer to the target devices address. For example, N7 in a PLC-5 processor could be referred to as PLC5_source in a Logix5550 controller. Enter the tag name to be the PLC-2 compatibility file.
PLC-2 processors
Tag Name
Ethernet communications
ControlNet communications
3-14
Input/Output Instructions
Input/Output Instructions
3-15
!
Operands:
Operand: Object class Object name Attribute name Destination
ATTENTION: Use the GSV/SSV instructions carefully. Making changes to objects can cause unexpected controller operation or injury to personnel.
Valid Types: immediate any tag type object specific (see list of objects below) tag DINT This operand is only used with the GSV instruction.
Source
tag DINT This operand is only used with the SSV instruction.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
3-16
Input/Output Instructions
Objects:
When you enter a GSV/SSV instruction, you specify the object and its attribute that you want to access. In some cases, there will be more than one instance of the same type of object, so you might also have to specify the object name. For example, there can be several tasks in your application. Each task has its own TASK object that you access by the task name. You can access these objects:
For information about this object: AXIS CONTROLLER CONTROLLERDEVICE CST DF1 FAULTLOG MODULE MOTIONGROUP PROGRAM ROUTINE SERIALPORT TASK WALLCLOCKTIME See page: 3-16 and chapter 17 3-16 3-17 3-18 3-18 3-20 3-22 3-22 and chapter 17 3-22 3-23 3-24 3-25 3-25
Input/Output Instructions
3-17
Vendor
GSV
3-18
Input/Output Instructions
Current value of the timer. The timer source is adjusted to match the value supplies in update services and from local communication network synchronization. The adjustment is either a ramping to the requested value or an immediate setting to the request value, as reported in the CurrentStatus attribute.
Input/Output Instructions Attribute: DiagnosticCounters DF1 counters point-to-point modem bits packets sent packets receivedt undelivered packets ENQs sent NAKs recevied ENQs received bad packets NAKed no memory response sent duplicate packets received unused DCD recoveries count lost modem count DuplicateDetection GSV Instruction: GSV Description:
3-19
Array of diagnostic counters for the DF1 communication driver. DF1 counters slave modem bits packets sent packets receivedt undelivered packets messages retried NAKs recevied polls received bad packets NAKed no memory response sent duplicate packets received unused DCD recoveries count lost modem count
DF1 counters master modem bits packets sent packets receivedt undelivered packets messages retried NAKs recevied polls received bad packets NAKed no memory response sent duplicate packets received unused DCD recoveries count lost modem count
word 0 1 2 3 4 5 6 7 8 9 10 11 12
Enables duplicate message detection. Value: 0 1 Meaning: no duplicate message detection duplicate message detection
EmbeddedResponse
GSV
Enables embedded response functionality. Value: Meaning: 0 initiated only after one is received non-zero enabled unconditionally
ENQsSent
GSV
The number of inquiries (ENQs) to send after an ACK timeout. Valid value 0-255. Recommended setting is 3.
ErrorDetection
GSV
GroupSize
GSV
MasterMessage
GSV
Current value of the master message transmission. Value: 0 1 Meaning: between station polls (default) in poll sequence
MessageWaitTime
GSV
The time (acting as a master) to wait after receiving an ACK before polling the slave for a response. Delay in counts of 20 msec periods. The default is 3 periods (60 msec).
NAKsReceived
GSV
The number of NAKs received in response to a message before stopping transmission (point-to-point communication only). Valid value 0-255. Recommended setting is 3.
3-20
Input/Output Instructions Attribute: PollMode Instruction: GSV Description: Current polling mode. Value: 0 1 2 3 Retries GSV Meaning: message-based, but dont allow slaves to initiate messages message-based, but allow slaves to initiate messages (default) standard, single-message transfer per node scan standard, multiple-message transfer per node scan
Number of times to resend a message to the master device without getting an acknowledgment. Valid value 0-255. Recommended setting is 3. The default is 3.
StationAddresss
GSV
PendingACKTimeout PendingDuplicateDetection PendingEmbeddedResponse PendingENQsSent PendingErrorDetection PendingGroupSize PendingMasterMessage PendingMessageWaitTime PendingNAKsReceived PendingPollMode PendingRetries PendingStationAddress
SSV SSV SSV SSV SSV SSV SSV SSV SSV SSV SSV SSV
Pending value for the ACKTimeout attribute. Pending value for the DuplicateDetection attribute. Pending value for the EmbeddedResponse attribute. Pending value for the ENQsSent attribute. Pending value for the ErrorDetection attribute. Pending value for the GroupSize attribute. Pending value for the MasterMessage attribute. Pending value for the MessageWaitTime attribute. Pending value for the NAKsReceived attribute. Pending value for the PollMode attribute. Pending value for the Retries attribute. Pending value for the StationAddress attribute.
(same format as FirstMinorEvent) What was the fifth-most recent minor fault. (same format as FirstMinorEvent) What was the most recent minor fault.
timestamp type of fault fault code fault-specific
FourthMinorEvent
GSV
Input/Output Instructions Attribute: Last3MajorEvents Instruction: GSV Description: What were the last three major faults.
3-21
most recent timestamp type of fault fault code fault-specific MajorEvents GSV SSV MinorEvents GSV SSV MajorFaultBits GSV SSV MinorFaultBits GSV SSV SecondMinorEvent GSV
How many major faults have occurred since the last time this counter was reset. How many minor faults have occurred since the last time this counter was reset. Individual bits indicate the reason for the current major fault.
Individual bits indicate the reason for the current minor fault.
(same format as FirstMinorEvent) What was the seventh-most recent minor fault. (same format as FirstMinorEvent) What was the sixth-most recent minor fault. (same format as FirstMinorEvent) What was the third-most recent minor fault. (same format as FirstMinorEvent)
ConnectionPath
GSV SSV
IOIString
GSV SSV
Specifies the string used for encoding the service and addressing for the message.
3-22
Input/Output Instructions Attribute: MessageType Instruction: GSV SSV Port GSV SSV Priority GSV SSV UnconnectedTimeout GSV SSV Timeout period for all unconnected messages Priority of the message. Description: Specifies the type of message. Value: 0 Meaning: not initialized
Instance
GSV
Input/Output Instructions Attribute: LastScanTime Instruction: GSV SSV MajorFaultRecord GSV SSV MaxScanTime GSV SSV MinorFaultRecord GSV SSV ProgramState GSV SSV Operating state of this program instance. Value: 0001 0002 0004 0008 0010 0020 0040 0100 0200 0400 1000 Meaning: execution of this program is disabled executing a non-edited version executing the edited version (online editing) an edit is pending for the end of execution first scan flag SFC force enable SFC restart (1=restart, 0=resume) prescan of executable in progress powerup fault recovery in progress powerup recovery in progress fault routine execution in progress Description: Time is took to execute this program the last time it was executed. Time is in microseconds. Records major faults for this program.
3-23
Maximum recorded execution time for this program. Time is in microseconds. Records minor faults for this program.
SFCRestart
GSV SSV
Selects a restart mode for the SFCs that are part of this program. Value: 0 1 Meaning: resume SFC after power loss restart SFC after power loss
3-24
Input/Output Instructions
Specifies the parity. Value: 0 1 2 Meaning: no parity odd parity (ASCII only) even parity
RTSOffDelay
GSV
Amount of time to delay turning off the RTS line after the last character has been transmitted. Delay in counts of 20 msec periods. The default is 0 msec.
RTSSendDelay
GSV
Amount of time to delay transmitting the first character of a message after turning on the RTS line. Delay in counts of 20 msec periods. The default is 0 msec.
StopBits
GSV
Specifies the number of stop bits. Value: 1 2 Meaning: 1 stop bit (default) 2 stop bits (ASCII only)
Pending value for the BaudRate attribute. Pending value for the DataBits attribute. Pending value for the Parity attribute. Pending value for the RTSOffDelay attribute. Pending value for the RTSSendDelay attribute. Pending value for the StopBits attribute.
Input/Output Instructions
3-25
3-26
Input/Output Instructions
Getting I/O fault information This example gets fault information from the I/O module disc_in_2 and places the data in a user-defined structure disc_in_2_info.
Getting program status information This example gets status information about program discrete and places the data in a user-defined structure discrete_info.
Gettings task status information This example gets status information about task IO_test and places the data in a user-defined structure io_test_info.
Input/Output Instructions
3-27
Based on the status of SW.1, place the appropriate value in the disableflag attribute of program discrete.
3-28
Input/Output Instructions
Notes:
Chapter
Compare Instructions
(CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ)
Introduction
The compare instructions let you compare values by using an expression or a specific compare instruction.
If you want to: compare values based on an expression test whether two values are equal test whether one value is greater than or equal to a second value test whether one value is greater than a second value test whether one value is less than or equal to a second value test whether one value is less than a second value test whether one value is between two other values pass two values through a mask and test whether they are equal test whether one value is not equal to a second value Use this instruction: CMP EQU GEQ GRT LEQ LES LIM MEQ NEQ See page: 4-3 4-5 4-6 4-7 4-8 4-9 4-10 4-12 4-14
You can compare values of different data types, such as floating point and integer.
If the input rung is: true and the expression is: true false false true false the output status is: true false false false
4-2
Compare Instructions
Compare Instructions
4-3
Compare (CMP)
Description: The CMP instruction is an input instruction that performs a comparison on arithmetic operations you specify in the expression. When the controller finds the expression is true, the rung goes true. Otherwise, the rung is false. The execution time of a CMP instruction is longer than the execution time of the other comparison instructions. A CMP instruction uses more words of memory than the other comparison instructions. The expression defines the operations you want to perform. Define the expression with operators, tags, and constants. Use brackets ( ) to define specific sections of more complex expressions. The expression must contain one comparison operation: =, <>, <, <=, >, or >=
Valid operations
Operator: + * / ** = <> < <= > Description: add subtract/negate multiply divide exponent (x to y) equal not equal less than less than or equal greater than Operator: >= ACS AND ASN ATN COS DEG FRD LN LOG Description: greater than or equal arc cosine logical AND arc sine arc tangent cosine degree BCD to binary natural log log base 10 Operator: MOD NOT OR RAD SIN SQR TAN TOD XOR Description: modulo divide logical complement logical OR degrees to radians sine square root tangent binary to decimal exclusive OR
Operands:
Operand: Expression Valid Types: an expression consisting of tags and/or immediate values separated by operators
4-4
Compare Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
CMP Example:
Compare Instructions
4-5
Equal to (EQU)
Description: Use the EQU instruction to test whether two values are equal. Source A and Source B can either be values or tags. REAL values are rarely absolutely equal. If you need to determine the quality of two REAL values, use the LIM instruction.
Operands:
Operand: Source A Source B Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
EQU Example:
4-6
Compare Instructions
Operands:
Operand: Source A Source B Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
GEQ Example:
Compare Instructions
4-7
Operands:
Operand: Source A Source B Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
GRT Example:
4-8
Compare Instructions
Operands:
Operand: Source A Source B Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
LEQ Example:
Compare Instructions
4-9
Operands:
Operand: Source A Source B Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
LES Example:
4-10
Compare Instructions
Limit (LIM)
Description: The LIM instruction is an input instruction that tests for values inside or outside of a specified range. The instruction is false until the controller detects that the Test value is within certain limits or outside of certain limits. Then the instruction goes true. When the instruction detects that the Test value is no longer within or outside of the limits, the instruction goes false. Low Limit <= High Limit: When the controller detects that the test value is equal to or between the limits, the instruction is true; if the test value is outside the limits, the instruction is false.
low limit test high limit
false
true
false
Low Limit >= High Limit: When the controller detects that the test value is equal to or outside the limits, the instruction is true; if the test value is inside the limits, but not equal to either limit, the instruction is false.
test low limit high limit test
true
false
true
Operands:
Operand: Low limit Test High limit Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) DINT REAL Description: true 0.87 3.60 false 0.16 0.18
4-11
LIM Example:
If test_value is greater than or equal to value_1 and less than or equal to value_2, the instruction is true.
4-12
Compare Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
Compare Instructions
4-13
MEQ Example:
The controller passes value_1 through the mask mask_1 and compares the result to value_2. A 0 in the mask restrains the instruction from comparing that bit. If value_1 and value_2 are the same, less the masked bits, the instruction is true.
Example values (using INTs): 01010101 01010101 11111111 11110000 01010101 0101xxxx
The instruction is true because the Source and Compare values are identical, minus the masked bits (which are not compared).
4-14
Compare Instructions
Operands:
Operand: Source A Source B Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
NEQ Example:
Chapter
Compute/Math Instructions
(CPT, ADD, SUB, MUL, DIV, SQR, NEG)
Introduction
The compute/math instructions evaluate arithmetic operations using an expression or a specific arithmetic instruction.
If you want to: evaluate an expression add two values subtract two values multiply two values divide two values take the square root of a value take the opposite sign of a value Use this instruction: CPT ADD SUB MUL DIV SQR NEG See page: 5-2 5-4 5-5 5-6 5-7 5-8 5-9
You can mix values of different data types, such as floating point and integer. If you use floating point as the source, use floating point as the destination. You can mix data types, but loss of accuracy and rounding error might occur. If the rung with the compute instruction goes true, the controller performs the computation.
5-2
Compute/Math Instructions
Compute (CPT)
Description: The CPT instruction is an output instruction that performs the arithmetic operations you define in the expression. The CPT instruction can also copy data from one tag to another and automatically convert the data type at the source tag to the data type you specify for the Destination. The execution time of a CPT instruction is longer than the execution time of the other compute/math instructions. A CPT instruction uses more words of memory than the other compute/math instructions.
Valid operations
Operator: + * / = ** ACS AND Description: add subtract/negate multiply divide equal exponent (x to y) arc cosine logical AND Operator: ASN ATN COS DEG FRD LN LOG MOD Description: arc sine arc tangent cosine degree BCD to binary natural log log base 10 modulo divide Operator: NOT OR RAD SIN SQR TAN TOD XOR Description: logical complement logical OR degrees to radians sine square root tangent binary to decimal exclusive OR
Compute/Math Instructions
5-3
Operands:
Operand: Destination Expression Valid Types: tag SINT, INT, DINT, or REAL an expression consisting of tags and/or immediate values separated by operators
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
CPT Example:
If the preceding instructions are true, the controller evaluates the expressions and places the result in result_1.
5-4
Compute/Math Instructions
Add (ADD)
Description: Use the ADD instruction to add one value (Source A) to another value (Source B) and place the result in the Destination. Source A and Source B can be values or tags. The ADD instruction executes once each program scan as long as the rung is true. If you want the values added only once, use an ONS instruction.
Operands:
Operand: Source A Source B Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
ADD Example:
If the preceding instructions are true, the controller adds float_value_1 to float_value_2 and places the result in compute_result.
Compute/Math Instructions
5-5
Subtract (SUB)
Description: Use the SUB instruction to subtract one value (Source B) from another value (Source A) and place the result in the Destination. Source A and Source B can be values or tags. The SUB instruction executes once each program scan as long as the rung is true. If you want the values subtracted only once, use an ONS instruction.
Operands:
Operand: Source A Source B Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
SUB Example:
If the preceding instructions are true, the controller subtracts float_value_2 from float_value_1 and places the result in compute_result.
5-6
Compute/Math Instructions
Multiply (MUL)
Description: Use the MUL instruction to multiply one value (Source A) with another value (Source B) and place the result in the Destination. Source A and Source B can be values or tags. The MUL instruction executes once each program scan as long as the rung is true. If you want the values multiplied only once, use an ONS instruction.
Operands:
Operand: Source A Source B Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
MUL Example:
If the preceding instructions are true, the controller multiples float_value_1 to float_value_2 and places the result in compute_result.
Compute/Math Instructions
5-7
Divide (DIV)
Description: Use the DIV instruction to divide one value (Source A) by another value (Source B) and place the result in the Destination. Source A and Source B can be values or tags. The DIV instruction executes once each program scan as long as the rung is true. If you want the values divided only once, use an ONS instruction.
Operands:
Operand: Source A Source B Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
DIV Example:
If the preceding instructions are true, the controller divides float_value_1 by float_value_2 and places the result in compute_result.
5-8
Compute/Math Instructions
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
SQR Example:
If the preceding instructions are true, the controller takes the square root of value_1 and places the result in compute_result.
Compute/Math Instructions
5-9
Negate (NEG)
Description: Use the NEG instruction to change the sign of a value. If you negate a negative value, the result is positive. If you negate a positive value, the result is negative. The NEG instruction executes once each program scan as long as the rung is true. If you want the values negated only once, use an ONS instruction.
Operands:
Operand: Destination Expression Valid Types: tag SINT, INT, DINT, or REAL an expression consisting of tags and/or immediate values separated by operators
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
NEG Example:
If the preceding instructions are true, the controller takes the opposite sign of value_1 and places the result in compute_result.
5-10
Compute/Math Instructions
Notes:
Chapter
Move/Logic Instructions
(MOV, MVM, BTD, CLR, AND, OR, XOR, NOT,)
Introduction
The move instructions modify and move bits.
If you want to: copy the value in one word to another word copy a specific part of a 32-bit value by masking the rest of the value move bits within a word or between words set all the bits in a word to zero Use this instruction: MOV MVM BTD CLR See page: 6-2 6-3 6-5 6-7
If you move a REAL value to a SINT, INT, or DINT tag, the controller rounds the value to fit within the tag. The controller does not properly round numbers less than -1. The logical instructions perform logical operations on bits.
If you want to: perform a bitwise AND operation perform a bitwise OR operation perform a bitwise, exclusive OR operation perform a bitwise NOT operation Use this instruction: AND OR XOR NOT See page: 6-8 6-10 6-12 6-14
6-2
Move/Logic Instructions
Move (MOV)
Description: The MOV instruction is an output instruction that copies the Source to a Destination. The Source remains unchanged. As long as the rung is true, the MOV instruction moves the data each program scan.
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
MOV Example:
If the preceding instructions are true, the controller copies the data in value_1 to value_2.
Move/Logic Instructions
6-3
Operands:
Operand: Source Mask Destination Valid Types: immediate or tag SINT, INT, or DINT immediate or tag SINT, INT, or DINT tag SINT, INT, or DINT
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 2.22 na na
executes does not execute executes
false 0.17 na
6-4
Move/Logic Instructions
MVM Example:
If the preceding instructions are true, the controller copies data in value_1 to value_2 while allowing data to be masked (a 0 masks the data in value_1).
value_3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 before MVM instruction value_1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 mask_1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 value_3 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 after MVM instruction
Move/Logic Instructions
6-5
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 3.00 na na
executes does not execute executes
false 0.16 na
6-6
Move/Logic Instructions
BTD Example:
example 1 If the preceding instructions are true, the controller moves bits within value_1.
destination bit
source bit
value_1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
example 2
If the preceding instructions are true, the controller moves bits within value_1.
source bit
value_1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
destination bit
value_2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Move/Logic Instructions
6-7
Clear (CLR)
Description: Use the CLR instruction to set all the bits of an element to zero.
Operands:
Operand: Destination Valid Types: tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) DINT REAL
executes does not execute executes
Execution
CLR Example:
If the preceding instructions are true, the controller sets all the bits of value_1 to 0.
6-8
Move/Logic Instructions
Operands:
Operand: Source A Source B Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
Move/Logic Instructions
6-9
AND Example:
If the preceding instructions are true, the controller performs an AND operation on value_1 and value_2 and places the result in value_3.
6-10
Move/Logic Instructions
Bitwise OR (OR)
Description: Use the OR instruction to perform a bitwise OR operation using the bits in two source tags. The controller evaluates the OR operation:
If Source A is: 0 1 0 1 And Source B is: 0 0 1 1 The Destination is: 0 1 1 1
Operands:
Operand: Source A Source B Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
Move/Logic Instructions
6-11
OR Example:
If the preceding instructions are true, the controller performs an OR operation on value_1 and value_2 and places the result in value_3.
6-12
Move/Logic Instructions
Operands:
Operand: Source A Source B Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
Move/Logic Instructions
6-13
XOR Example:
If the preceding instructions are true, the controller performs an XOR operation on value_1 and value_2 and places the result in value_3.
6-14
Move/Logic Instructions
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
Move/Logic Instructions
6-15
NOT Example:
If the preceding instructions are true, the controller performs a NOT operation on value_1 and places the result in value_3.
value_1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 value_3 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0
6-16
Move/Logic Instructions
Notes:
Chapter
File Concepts
Introduction
This chapter presents the concepts of manipulating arrays (files) of data using the file instructions. The controller treats files as arrays of data. You can create arrays as large as three dimensions. For example, an application has an array of integers (SINT, INT, or DINT): first dimension elements 0-6 second dimension elements 0-4 third dimension elements 0-21
In this example, the array (file) has a total of 770 integers (22 x 5 x 7). If the data structure name is array1, any instruction referencing array1, has 770 integers. To access a specific element within the array, specify the coordinates as array_name[first_dim,second_dim, third_dim]. For example, enter array1[4,3,20]. The File/Misc instructions in the programming software manipulate arrays of data. These instructions are: average (AVE) copy (COP) file arithmetic and logic (FAL) file fill (FLL) file search (FSC) sort (SRT) standard deviation (STD)
7-2
File Concepts
Manipulating Arrays
Typical array operations include: copying data from a: source word to a destination array source array to a destination array source array to a destination element operating on data from multiple sources, such as: source element source arrays storing the result in a: destination element destination array Use CONTROL.POS as the destination or expressions. It identifies the first element of the array for the operation.
FAL File Arith/logical Control control1 Length 4 Position 0 Mode ALL Destination array1[a, control1.pos, c] Expression integer_a
Element-to-Array Operation
FAL File Arith/logical Control control1 Length 4 Position 0 Mode ALL Destination integer_a Expression array1[a, control1.pos, c]
Array-to-Element Operation
FAL File Arith/logical Control control1 Length 4 Position 0 Mode ALL Destination array1[a, control1.pos, c] Expression array2[control1.pos, b, c]
Array-to-Array Operation
File Concepts
7-3
element to array
array to array
array to word
16617
7-4
File Concepts
The control structure controls the operation of the file instruction. The control structure stores status bit, length (.LEN), and position (.POS) values.
CONTROL structure
bit number 31 30 29 28 27 26 25 24 EN EU DN EM ER UL IN FD 16 15 0
Description: The enable bit indicates that the instruction is enabled. The enable unload bit indicates unload instruction is enabled. Only used with the FFU and LFU instructions.
The done bit indicates that the file operation is complete. The empty bit indicates that the stack is empty Only used with the FFL and LFL instructions.
The error bit indicates when the file operation generates an overflow. The unload bit is the instructions output. The .UL bit stores the status of the bit removed from the array each time the instruction is enabled. Only used with the BSR and BSL instructions.
.IN bit
The inhibit bit indicates that the controller detected a true comparison using an FSC instruction. You must reset this bit to continue the search operation. This bit is only used by the FSC instruction. The found bit indicates that the controller detected a true comparison using an FSC instruction. This bit is only used by the FSC instruction. The length word specifies the number of elements in the array on which the file instruction operates. The position word identifies the current element that the controller is accessing. You generally enter a zero to start at the beginning of the current dimension of the array.
You can use the RES instruction to reset the status bits and clear the .POS word.
The mode tells the controller how to distribute the block operation over one or more program scans. Select from:
If you want to: operate on the entire file before continuing on to the next rung distribute file operation over a number of program scans enter the number of words or operate on per scan (1-2147483647) manipulate one word of the file each time the rung goes from false to true Incremental Select this mode: All Numerical
File Concepts
7-5
All mode
In All mode, the entire file is operated on before continuing on to the next rung of logic. The operation begins when the rung goes from false to true. The position (.POS) value in the control structure points to the word in the array that the instruction is currently using. Operation stops when the function completes or the controller detects an error.
Data file one scan
16639
The following timing diagram shows the relationship between status bits and instruction operation. When the instruction execution is complete, the .DN bit is set. The .DN bit and the .EN bit are reset and the .POS value is zeroed when the rung conditions are no longer true. Only then can another operation be triggered by a false-to-true transition of the rung.
one program scan condition of the rung that controls the instruction
.EN bit
.DN bit controller resets status bits and sets .POS value to zero scan of the instruction
operation complete
40010
7-6
File Concepts
Numerical mode
Numerical mode distributes the array operation over a number of program scans. You enter the number of words per scan to operate on each program scan. Execution is triggered when the rung condition goes from false to true. Once triggered, the instruction is executed each time the rung is scanned for the number of program scans necessary to complete operation on the entire array. Once triggered, rung logic can change repeatedly without interrupting execution of the instruction.
one scan
second scan
next scan
16641
Important: Avoid using the results of a file instruction operating in numerical mode until the .DN bit is set because the data is incomplete.
File Concepts
7-7
The following timing diagram shows the relationship between status bits and instruction operation. When the instruction execution is complete, the .DN it is set.
rung is true at completion multiple program scans condition of the rung that controls the instruction .EN bit .DN bit scan of the instruction operation complete controller resets status bits and sets .POS value to zero operation complete controller resets status bits and sets .POS value to zero
40013
If the rung is true at completion, the .EN and .DN bit are not reset until the rung is no longer true. When the rung goes false, these bits are reset and the .POS value is zeroed. If the rung is false at completion, the .EN bit is reset immediately. One scan after the .EN bit is reset, the .DN bit is reset and the .POS value is zeroed.
Incremental mode
Incremental mode manipulates one word of the array each time the rung goes from false to true.
16643
7-8
File Concepts
The following timing diagram shows the relationship between status bits and instruction operation. Execution occurs only in a program scan in which the rung goes from false to true. Each time this occurs, only one word of the array is manipulated. If the rung remains true for more than one program scan, the instruction is not executed in subsequent scans after the rung transition.
one or more program scan condition of the rung that controls the instruction .EN bit
controller resets .EN bit operation complete controller resets status bits and sets .POS value to zero
40014
The .EN bit is set when rung logic is true. The .DN bit is set when the last word in the array has been manipulated. When the last word has been manipulated and the rung goes from false to true, the .EN and .DN bits are reset and the .POS value is zeroed. Incremental mode compared to numerical mode with 1word per scan The difference between incremental mode and numerical mode at a rate of one word per scan is: Numerical mode with any number of words per scan requires only one false-to-true rung transition to start execution. The instruction continues to execute the specified number of words each program scan until completion regardless of rung transition. Incremental mode required a false-to-true rung transition for each word in the array.
Chapter
File/Misc. Instructions
(FAL, FSC, COP, FLL, AVE, SRT, STD)
Introduction
The file/miscellaneous instructions operate on arrays of data.
If you want to: perform arithmetic, logic, shift, and function operations on array data search for and compare array data copy the contents of one array into another array fill an array with specific data calculate the average of a set of values sort one dimension of array data into ascending order calculate the standard deviation of a set of values Use this instruction: FAL FSC COP FLL AVE SRT STD See page: 8-4 8-7 8-10 8-12 8-13 8-15 8-17
If you move a REAL value to a SINT, INT, or DINT tag, the controller rounds the value to fit within the tag. The controller does not properly round numbers less than -1.
8-2
File/Misc. Instructions
The control structure controls the operation of the file instruction. The control structure stores status bit, length (.LEN), and position (.POS) values.
CONTROL structure
bit number
31 30 29 28 27 26 25 24 EN EU DN EM ER UL IN FD
16 15
Control bit or word: .EN bit .EU bit .DN bit .EM bit .ER bit .UL bit .IN bit .FD bit .LEN word .POS word
Description: The enable bit indicates that the instruction is enabled. not used The done bit indicates that the file operation is complete. not used The error bit indicates when the file operation generates an overflow. not used not used not used The length word specifies the number of elements in the array on which the file instruction operates. The position word identifies the current element that the controller is accessing. You generally enter a zero to start at the beginning of the current dimension of the array.
You can use the RES instruction to reset the status bits and clear the .POS word.
File/Misc. Instructions
8-3
array_2[0, control_2.pos]
array_3[0,1,control_3.pos]
The .POS value provides a sequential progression through the array. You could also use another tag or an immediate value to specify the position within the array. In this case, you would have to increment the position value. Some file instructions operate on the right-most dimension only. Be careful when using these instructions with multiple-dimensional arrays to make sure the instruction operates on the data you intend. See the following chapters of file instructions to make sure you understand how the instructions operate.
8-4
File/Misc. Instructions
Valid operations
Operator: + * / = ** ACS AND Description: add subtract/negate multiply divide equal exponent (x to y) arc cosine logical AND Operator: ASN ATN COS DEG FRD LN LOG MOD Description: arc sine arc tangent cosine degree BCD to binary natural log log base 10 modulo divide Operator: NOT OR RAD SIN SQR TAN TOD XOR Description: logical complement logical OR degrees to radians sine square root tangent binary to decimal exclusive OR
Operands:
Operand: Control Length number of elements in the array Position current element in the array Mode Destination INC, ALL, or 1-33554432 tag SINT, INT, DINT, or REAL immediate (1-33554432) Valid Types: tag CONTROL immediate (1-33554432)
8-5
arithmetic expression consisting of tags and/or immediate values separated by operators CONTROL.POS identifies the dimension to vary (array1[A, CONTROL.POS, C]
Control status:
Control bit or word: .EN bit Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. In Incremental mode, the .EN bit follows the rung status. In Numerical and All mode, the .EN bit remains set until the instruction completes its operation, regardless of the rung status. The .EN bit is reset when the rung goes false, but only after the controller sets the .DN bit. .DN bit The done bit is set when the instruction has operated on the last element. In Numerical mode, if the Expression is false at completion, the controller resets the .DN bit one program scan after the operation is complete. If the Expression is true at complete, the controller reset the .DN bit when the rung goes false. .ER bit The error bit is set when the operation generates an overflow. The instruction stops executing until the program resets the .ER bit. When the controller detects an error, the .POS value stores the position of element that faulted. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
8-6
File/Misc. Instructions
FAL Example:
array-to-array copy
If the preceding instructions are true, the controller copies each element of array_1 into the same positions within array_2.
word-to-array copy
If the preceding instructions are true, the controller copies the value of element value_1 into the first 10 positions of array_2.
If the preceding instructions are true, the controller divides the value in the current position of array_1 with the value in the current position of array_2.
File/Misc. Instructions
8-7
The expression must contain at least one of these operations: =, <>, <, <=, >, or >=
8-8
File/Misc. Instructions
Operands:
Operand: Control Length number of elements in the array Position current element in the array Mode Expression INC, ALL, or 1-33554432 arithmetic expression consisting of tags and/or immediate values separated by operators CONTROL.POS identifies the dimension to vary (array1[A, CONTROL.POS, C] immediate (1-33554432) Valid Types: tag CONTROL immediate (1-33554432)
Control status:
Control bit or word: .EN bit Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. In Incremental mode, the .EN bit follows the rung status. In Numerical and All mode, the .EN bit remains set until the instruction completes its operation, regardless of the rung status. The .EN bit is reset when the rung goes false, but only after the controller sets the .DN bit. .DN bit The done bit is set when the instruction has operated on the last element. In Numerical mode, if the Expression is false at completion, the controller resets the .DN bit one program scan after the operation is complete. If the Expression is true at complete, the controller reset the .DN bit when the rung goes false. .ER bit The error bit is set when the operation generates an overflow. The instruction stops executing until the program resets the .ER bit. When the controller detects an error, the .POS value stores the position of element that faulted. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
File/Misc. Instructions
8-9
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
FSC Example:
If the preceding instructions are true, the controller determines whether the first 10 elements in array_1 are not equal to the first 10 elements in array_2.
8-10
File/Misc. Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
COP Example:
File/Misc. Instructions
8-11
If the preceding instructions are true, the controller copies the first 10 elements of the second dimension of array_4 into the first 10 elements of the second dimension of array_5.
8-12
File/Misc. Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
FLL Example:
If the preceding instructions are true, the controller copies the value of value_1 into the first 10 elements of the second dimension of array_4.
File/Misc. Instructions
8-13
If an overflow occurs, the controller stops the calculation, sets the .ER bit, and the Destination remains unchanged. The .POS value identifies the element that caused the overflow. When you clear the .ER bit, the controller resets the .POS value to zero and the average is recalculated. Operands:
Operand: Array Dimension to vary Destination Control Length number of elements in the array Position current element in the array immediate (1-33554432) Valid Types: tag array SINT, INT, DINT, or REAL 0, 1, 2 tag SINT, INT, DINT, or REAL (must match array type) tag CONTROL immediate (1-33554432)
8-14
File/Misc. Instructions
Control status:
Control bit or word: .EN bit .DN bit .ER bit .LEN word .POS word Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The instruction follows the rung status. The done bit is set after the instruction finishes operations. After the rung goes false, the controller resets the .DN bit on the next false-to-true rung transition. The error bit is set when the operation generates an overflow. The instructions stops the calculation until the logic resets the .ER bit. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
AVE Example:
If the preceding instructions are true, the controller averages the first 10 elements of array_2 and stores the result in float_value_1.
File/Misc. Instructions
8-15
Operands:
Operand: Array Dimension to vary Control Length number of elements in the array Position current element in the array immediate (1-33554432) Valid Types: tag array SINT, INT, DINT, or REAL 0, 1, 2 tag CONTROL immediate (1-33554432)
Control status:
Control bit or word: .EN bit .DN bit .LEN word .POS word Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The instruction follows the rung status. The done bit is set after the instruction finishes operations. After the rung goes false, the controller resets the .DN bit on the next false-to-true rung transition. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
8-16
File/Misc. Instructions
SRT Example:
If the preceding instructions are true, the controller sorts the first 10 elements of array_2 into ascending order.
File/Misc. Instructions
8-17
Where: SUM( ) = summation of the enclosed variables AVE( ) = average of the enclosed variables xi = variable elements in the array N = number of elements in the array
Make sure the Length you specify does not cause the tag to exceed array boundaries.
If an overflow occurs, the controller stops the calculation, sets the .ER bit, and the Destination remains unchanged. The .POS value identifies the element that caused the overflow. When you clear the .ER bit, the controller resets the .POS value to zero and the average is recalculated. Operands:
Operand: Array Dimension to vary Destination Valid Types: tag array SINT, INT, DINT, or REAL 0, 1, 2 tag SINT, INT, DINT, or REAL (must match array type) Control Length number of elements in the array Position current element in the array immediate (1-33554432) tag CONTROL immediate (1-33554432)
8-18
File/Misc. Instructions
Control status:
Control bit or word: .EN bit .DN bit .ER bit .LEN word .POS word Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The instruction follows the rung status. The done bit is set after the instruction finishes operations. After the rung goes false, the controller resets the .DN bit on the next false-to-true rung transition. The error bit is set when the operation generates an overflow. The instructions stops the calculation until the logic resets the .ER bit. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
STD Example:
If the preceding instructions are true, the controller finds the standard deviation of the first 10 elements of the second dimension of array_4 and stores the result in float_value_1.
Chapter
File/Shift Instructions
(BSL, BSR, FFL, FFU, LFL, LFU)
Introduction
Use the file/shift instructions to track the flow of parts and information.
If you want to: Load bits into, shift bits through, and unload bits from a bit array one bit at a time, such as for tracking bottles through a line where each bit represents a bottle. Load and unload values in the same order, such as for tracking parts through an assembly line where parts are represented by values that have a part numbers and assembly code. Load and unload values in reverse order, such as tracking stacked inventory in a warehouse where goods are represented by a serial numbers and inventory codes. Use this instruction: BSL BSR See page: 9-3 9-5
FFL FFU
9-7 9-9
LFL LFU
9-11 9-13
9-2
File/Shift Instructions
bit number
31 30 29 28 27 26 25 24
EN EU DN EM ER UL IN FD
16 15
Description: The enable bit indicates that the instruction is enabled. The enable unload bit indicates unload instruction is enabled. Only used with the FFU and LFU instructions.
The done bit indicates that the file operation is complete. The empty bit indicates that the stack is empty Only used with the FFL and LFL instructions.
The error bit indicates when the file operation generates an overflow. The unload bit is the instructions output. The .UL bit stores the status of the bit removed from the array each time the instruction is enabled. Only used with the BSR and BSL instructions.
.IN bit
The inhibit bit indicates that the controller detected a true comparison using an FSC instruction. You must reset this bit to continue the search operation. This bit is only used by the FSC instruction. The found bit indicates that the controller detected a true comparison using an FSC instruction. This bit is only used by the FSC instruction. The length word specifies the number of elements in the array on which the file instruction operates. The position word identifies the current element that the controller is accessing. You generally enter a zero to start at the beginning of the current dimension of the array.
File/Shift Instructions
9-3
Operands:
Operand: Array Control Source bit Length number of bits in the array Valid Types: tag array DINT tag CONTROL tag BOOL immediate (1-2147483647)
Control status:
Control bit or word: .EN bit .DN bit .LEN word .POS word Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The done bit is set to indicate that the array shifted one position. The length value specifies the number of bits in the array. The position value identifies the bit that the controller is currently manipulating.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
9-4
File/Shift Instructions
BSL Example:
15 14 13 12 11 10 9 unload bit
5 4
input_1
If the preceding instructions are true, the controller starts the bit-shift-left operation on array_dint.
16658
File/Shift Instructions
9-5
Operands:
Operand: Array Control Source bit Length number of bits in the array Valid Types: tag array DINT tag CONTROL tag BOOL immediate (1-2147483647)
Control status:
Control bit or word: .EN bit .DN bit .LEN word .POS word Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The done bit is set to indicate that the array shifted one position. The length value specifies the number of bits in the array. The position value identifies the bit that the controller is currently manipulating.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
9-6
File/Shift Instructions
BSR Example:
If the preceding instructions are true, the controller starts the bit-shift-right operation on array_dint.
16659
File/Shift Instructions
9-7
Control status:
Control bit or word: .EN bit Description: The enable load bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The instruction follows the rung status. During prescan, this bit is set to prevent a false load when the program scan begins. .DN bit .EM bit .LEN word .POS word The done bit is set to indicate that the stack is full. The .DN bit inhibits loading the stack until there is room. The empty bit is set to indicate that the array is empty. Do not enable the FFU instruction if the .EM bit is set. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
9-8
File/Shift Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
FFL/FFU Example:
16660
If the preceding instructions are true, the controller starts the FIFO operation on array_dint.
File/Shift Instructions
9-9
Control status:
Control bit or word: .EU bit .DN bit .LEN word .POS word Description: The enable unload bit is set when the rung is true. This instruction indicates that the instruction is enabled. The done bit is set to indicate that the stack is full. The .DN bit inhibits loading the stack until there is room. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
9-10
File/Shift Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
FFL/FFU Example:
16660
If the preceding instructions are true, the controller starts the FIFO operation on array_dint.
File/Shift Instructions
9-11
Control status:
Control bit or word: .EN bit Description: The enable load bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The instruction follows the rung status. During prescan, this bit is set to prevent a false load when the program scan begins. .DN bit .EM bit .LEN word .POS word The done bit is set to indicate that the stack is full. The .DN bit inhibits loading the stack until there is room. The empty bit is set to indicate that the array is empty. Do not enable the FFU instruction if the .EM bit is set. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
9-12
File/Shift Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
LFL/LFU Example:
array_dint
destination (value_2)
16621
If the preceding instructions are true, the controller starts the LIFO operation on array_dint.
File/Shift Instructions
9-13
Control status:
Control bit or word: .EU bit .DN bit .LEN word .POS word Description: The enable unload bit is set when the rung is true. This instruction indicates that the instruction is enabled. The done bit is set to indicate that the stack is full. The .DN bit inhibits loading the stack until there is room. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
9-14
File/Shift Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
LFL/LFU Example:
array_dint
destination (value_2)
16621
If the preceding instructions are true, the controller starts the LIFO operation on array_dint.
Chapter
10
Sequencer Instructions
(SQI, SQO, SQL)
Introduction
Sequencer instructions are typically used to control automatic assembly machines that have a consistent and repeatable operation. Use the SQI instruction to detect when a step is complete. Use the SQO instruction to set output conditions for the next step. Use the SQL instruction to load reference conditions into the sequencer input and output arrays.
If you want to: Monitor machine operating conditions for diagnostic purposes by comparing 32-bit data through a mask with reference data. Control sequential machine operations by transferring 32-bit data through a mask to output tags. Capture reference conditions by manually stepping the machine through its operating sequences and loading data into a destination array. Use this instruction: SQI See page: 10-3
SQO
10-5
SQL
10-7
10-2
Sequencer Instructions
bit number
31 30 29 28 27 26 25 24 EN EU DN EM ER UL IN FD
16 15
Control bit or word: .EN bit .EU bit .DN bit .EM bit .ER bit .UL bit .IN bit .FD bit .LEN word .POS word
Description: The enable bit indicates that the instruction is enabled. not used The done bit indicates that the file operation is complete. not used not used not used not used not used The length word specifies the number of elements in the array on which the file instruction operates. The position word identifies the current element that the controller is accessing. You generally enter a zero to start at the beginning of the current dimension of the array.
Sequencer Instructions
10-3
Operands:
Operand: Array Mask Source Control Length number of steps Position current step immediate (0-33554432) usually enter 0 Valid Types: tag array SINT, INT, or DINT immediate or tag SINT, INT, or DINT tag SINT, INT, or DINT tag CONTROL immediate (1-33554432)
Control status:
Control bit or word: .LEN word .POS word Description: The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
10-4
Sequencer Instructions
SQI Example:
If the preceding instructions are true, the controller starts the sequencer operation on array_dint.
Example values (using INTs): 11110101 01001010 00001111 00001111 xxxx0101 xxxx1010
Sequencer Instructions
10-5
Operands:
Operand: Array Mask Destination Control Length number of steps Position current step immediate (0-33554432) usually enter 0 Valid Types: tag array SINT, INT, or DINT immediate or tag SINT, INT, or DINT tag SINT, INT, or DINT tag CONTROL immediate (1-33554432)
Control status:
Control bit or word: .EN bit Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The instruction follows the rung status. During prescan, this bit is set to prevent a false increment when the program scan begins. .DN bit The done bit is set after the instruction finishes operating on the last element in the array. After the rung goes false, the controller resets the .DN bit on the next false-to-true transition. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
10-6
Sequencer Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
SQO Example:
If the preceding instructions are true, the controller starts the sequencer operation on array_dint.
Example values (using INTs): 11110101 01001010 00001111 00001111 xxxx0101 xxxx1010
Sequencer Instructions
10-7
Control status:
Control bit or word: .EN bit Description: The enable bit is set when the rung goes from false to true. It indicates that the instruction is enabled. The instruction follows the rung status. During prescan, this bit is set to prevent a false increment when the program scan begins. .DN bit The done bit is set after the instruction finishes operating on the last element in the array. After the rung goes false, the controller resets the .DN bit on the next false-to-true transition. The length value specifies the number of elements in the array. The position value identifies the element that the controller is currently manipulating.
10-8
Sequencer Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
SQL Example:
If the preceding instructions are true, the controller loads the value at value_2 into the current step of array_dint.
Chapter
11
11-2
Jumping forward to a label saves program scan time by omitting a logic segment until its needed. Jumping backward lets the controller repeat iterations of logic until its complete. Be careful not to jump backward an excessive number of times. The watchdog timer could time out because the controller never reaches the end of the logic, which would fault the controller. ATTENTION: Jumped logic is not scanned. Program critical logic outside the jumped zone.
The LBL instruction is the target of the JMP instruction that has the same label name. Make sure the LBL instruction is the first instruction on its rung. Operands:
Operand: Label number Valid Types: label name
11-3
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
JMP/LBL Example:
If the preceding instructions are true, the controller jumps over successive rungs of logic until it reaches the rung that contains the LBL instruction with the same label as the JMP instruction.
11-4
main routine
action_1 JSR
SBR
SBR
SBR
action_2 JSR
action_3 JSR
RET
RET
RET
15294
The JSR, SBR, and RET instructions pass parameters into and out of a subroutine by value. This means that the controller uses additional execution time and memory to handle the values. You can reduce execution time by directly accessing program-scoped and controller-scoped data from within the subroutine, rather than passing values.
11-5
Operands:
Operand: Routine name Input parameter Return parameter Valid Types: tag ROUTINE immediate or tag any type tag any type
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
JSR/SBR/RET Example:
If the preceding instructions are true, the controller jumps to routine_1 within the same program.
11-6
none
TND Example:
If the preceding instructions are true, the controller stops scanning this routine.
11-7
MCR zones let you enable or inhibit segments of logic, such as for recipe applications. When you program an MCR zone, note that: You must end the zone with an unconditional MCR instruction. You cannot nest one MCR zone within another. Do not jump into an MCR zone. If the zone is false, jumping into the zone activates the zone. If an MCR zone continues to the end of the routine, you do not have to program an MCR instruction to end the zone.
Important: The MCR instruction is not a substitute for a hard-wired master control relay that provides emergency-stop capability. You should still install a hard-wired master control relay to provide emergency I/O power shutdown. ATTENTION: Do not overlap or nest MCR zones. Each MCR zone must be separate and complete. If they overlap or nest, unpredictable machine operation could occur with possible damage to equipment or injury to personnel. If you start instructions such as timers or counters in an MCR zone, instruction execution stops when the zone is disabled. Program critical operations outside the zone.
Operands:
none
11-8
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 0.06 na na
executes does not execute executes
false 0.05 na
MCR Example:
When the first MCR instruction is true, the controller executes the rungs in the MCR zone (between the two MCR instructions). When the first MCR instruction is false, the controller resets all non-retentive outputs in the MCR zone (the rungs between the MCR instructions).
11-9
none
UID Example:
If the preceding instructions are true, the controller disables switching between user tasks.
11-10
none
UIE Example:
If the preceding instructions are true, the controller re-enables switching between user tasks.
11-11
Operands: Operation:
none
DINT REAL
executes does not execute executes
AFI Example:
If the preceding instructions are true, the controller makes the current rung false.
11-12
No Operation (NOP)
Description: The NOP instruction functions only as a placeholder; it performs no operation. You can use this instruction as a placeholder for future logic. When debugging your application, you can use this instruction when optimizing timing. none
Operands: Operation:
DINT REAL
executes does not execute executes
NOP Example:
Chapter
12
For/Break Instructions
(FOR, BRK)
Introduction
Use the FOR instruction to repeatedly call a subroutine. Use the BRK instruction to interrupt the execution of the subroutine.
If you want to: Repeatedly execute a routine. Terminate the repeated execution of a routine. Use this instruction: FOR BRK See page:
12-2
For/Break Instructions
For (FOR)
Description: Use the FOR instruction to repeatedly execute a routine until the Index tag exceeds the Terminal value. This instruction does not pass parameters to the routine (see the JSR instruction). When the rung is true, the FOR instruction executes the rungs between the FOR and BRK instructions repeatedly in one program scan until the Index value exceeds the Terminal value or a BRK instruction ends the repetitions. The FOR instruction repeats this operation every program scan the FOR rung is true. When the rung is false, the controller skips to the rung that follows the rung with the BRK instruction. Be careful not to loop too many times in a single program scan. An excessive number of repetitions can cause the watchdog to timeout because the controller never reaches the end of the logic, which faults the controller. ATTENTION: For and BRK instructions might not execute properly in branches of ladder logic. Do not use FOR and BRK instructions in branches. Using FOR and BRK instructions within an output branch can cause unpredictable machine operation.
Operands:
Operand: Routine name Index Initial value Terminal value Step size Valid Types: ROUTINE name tag DINT immediate or tag SINT, INT, or DINT immediate or tag SINT, INT, or DINT immediate or tag SINT, INT, or DINT
For/Break Instructions
12-3
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
FOR Example:
If the preceding instructions are true, the controller executes the routine until completion or until the controller reaches a BRK instructions.
12-4
For/Break Instructions
Break (BRK)
Description: The BRK instruction interrupts the execution of a subroutine and its associated FOR instruction. When the rung goes true, the BRK instruction returns the controller to the next highest loop (if you have nested loops) or to the instruction that follows the BRK instruction.
Operands: Operation:
none
DINT REAL
executes does not execute executes
BRK Example:
If the preceding instructions are true, the controller stops executing the current routine and returns to the instruction following the FOR instruction.
Chapter
13
Special Instructions
(FBC, DDT, DTR, PID)
Introduction
The special instructions perform application-specific operations.
If you want to: Compare I/O data against a known, good reference and record any mismatches. Compare I/O data against a known, good reference, record any mismatches, and update the reference to match the source. Pass the source data through a mask and compare the result to reference data. Then write the source into the reference for the next comparison. Control a PID loop with inputs from an analog input module and an output to an analog output module. Use this instruction: FBC See page: 13-3
DDT
13-6
DTR
13-9
PID
13-17
13-2
Special Instructions
The FBC and DDT diagnostic instructions let you detect problems with data in your programs. The controller stores status bits and the length and position values in a 96-bit storage structure (three 32-bit words) in a CONTROL structures. There is one CONTROL structure to store status for the compare operation and one CONTROL structure to store status for the result.
CONTROL structure
bit number
31 30 29 28 27 26 25 24
EN EU DN EM ER UL IN FD
16 15
Control bit or word: .EN bit .EU bit .DN bit .EM bit .ER bit .UL bit .IN bit
Description: The enable bit indicates that the instruction is enabled. not used The done bit indicates that the file operation is complete. not used The error bit indicates when the file operation generates an overflow. not used The inhibit bit indicates that the controller detected a true comparison using an FSC instruction. You must reset this bit to continue the search operation. This bit is only used by the FSC instruction. The found bit indicates that the controller detected a true comparison using an FSC instruction. This bit is only used by the FSC instruction. The length word specifies the number of elementsin the array on which the file instruction operates. The position word identifies the current element that the controller is accessing. You generally enter a zero to start at the beginning of the current dimension of the array.
Special Instructions
13-3
Operands:
Operand: Source Reference Result Compare control Length number of bits to compare Position current bit in Source array Result control Length number of elements in Result array Position current position in Result array immediate (0-33554432) usually enter 0 immediate (0-2147483647) usually enter 0 tag CONTROL immediate (1-33554432) Valid Types: tag array DINT tag array DINT tag array DINT tag CONTROL immediate (1-2147483647)
13-4
Special Instructions
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
Special Instructions
13-5
FBC Example:
result source 15 14 13 12 11 10 9 1 8 7 1 6 0 5 4 0 0 3 2 1 1 0 1 3 9
array_dint_3
array_dint_1
1 1
0 1
reference
15 14 13 12 11 10 9 1
7 1
6 0
5 4 0 0
3 1
2 1
1 1
0 1
array_dint_2
0 1
If the preceding instructions are true, the controller compares the source array_dint_1 to the reference array_dint_2 and stores the locations of any mismatches in the result array_dint_3.
16657
13-6
Special Instructions
Operands:
Operand: Source Reference Result Compare control Length number of bits to compare Position current bit in Source array Result control Length number of elements in Result array Position current position in Result array immediate (0-33554432) usually enter 0 immediate (0-2147483647) usually enter 0 tag CONTROL immediate (1-33554432) Valid Types: tag array DINT tag array DINT tag array DINT tag CONTROL immediate (1-2147483647)
Special Instructions
13-7
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
does not execute does not execute executes
13-8
Special Instructions
DDT Example:
result source 15 14 13 12 11 10 9 1 8 7 1 6 0 5 4 0 0 3 2 1 1 0 1 3 9
array_dint_3
array_dint_1
1 1
0 1
reference
15 14 13 12 11 10 9 1
7 1
6 0
5 4 0 0
3 1
2 1
1 1
0 1
array_dint_2
0 1
If the preceding instructions are true, the controller compares the source array_dint_1 to the reference array_dint_2 and stores the locations of any mismatches in the result array_dint_3. The controller also changes the mismatched bits in the reference array_dint_2 to match the source array_dint_1.
16657
Special Instructions
13-9
Operands:
Operand: Source Mask Reference Valid Types: immediate or tag DINT immediate or tag DINT immediate or tag DINT
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
13-10
Special Instructions
DTR Example:
If the preceding instructions are true, the controller passes the source value_1 through the mask_1 and compares the result to the reference value_2.
source 1 8 3
value_1
mask = 0FFF
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
value_2
1 1
8 8
7 3
The rung remains false as long as the input value does not change.
The rung remains true for one scan when a change is detected.
13385
Special Instructions
13-11
PID closed-loop control holds a process variable at a desired set point. The following figure shows a flow-rate/fluid level example:
feedforward or bias setpoint error PID equation flow rate process variable control output
level detector
13385
In the above example, the PID equation controls the process by sending an output signal to the control valve. The greater the error between the setpoint and process variable input, the greater the output signal, and vice versa. An additional value (feedforward or bias) can be added to control output as an offset. The goal of PID calculations is to maintain the process variable you are controlling at the setpoint. The base PID equation is the standard parallel position PID algorithm, with the option of entering gains as independent or dependent.
Gains Option: Dependent gains (ISA standard) Derivative of: error
t
Equation:
E = SP - PV
t
E = PV - SP
t
CV = K C
13-12
Equation:
E = SP - PV
t
E = PV - SP
t
Where:
Variable: KP Description: proportional gain (unitless) Kp = Kc unitless Ki integral gain (seconds -1)
KC K i = ---------60T i
Kd
KC 1 ---Ti Td SP PV E BIAS CV dt
rate gain (minutes) setpoint process variable error (SP-PV) or (PV-SP) feedforward or external control variable loop update time
Special Instructions
13-13
S k = K i ( E k )dt + S k 1
dependent gains
1 S k = ---- ( E k )dt + S k 1 Ti
If the integral (Ki) or reset (1/Ti) gain is zero, the accumulated sum continually sets to zero in auto mode. Avoid integral wind-up by preventing the running sum from accumulating whenever the CV output reaches its maximum or minimum values. These values are either 0% and 100% or the user-specified limits in output limiting. The accumulated sum remains frozen until the output drops below its maximum value or rises about its minimum value; then normal accumulation resumes. When executing the PID instruction in manual mode, you can achieve a bumpless transfer back to auto mode by using the accumulated sum to track the manual output:
13-14
Special Instructions
dQ Q k Q k 1 ------ ------------------------dt dt
Where Q represents wither Error or PV, depending on your settings. The calculation is further enhanced by using a derivative smoothing filter. This first order, low pass, digital filter eliminates large derivative term spikes caused by noise in the PV.
Qk Qk 1 D k = ( 1 a ) K d ------------------------- + aDk 1 dt
Where:
Variable: Kd Dk Dk-1 Qk a 1 --------------------dt 16 ----- + 1 Kd dt loop update time Description: derivative gain (seconds) current derivative term previous derivative term error or PV, depending on your settings
Special Instructions
13-15
the output.
high alarm + deadband setpoint - deadband low alarm time error within deadband range
Using zero-crossing Zero-crossing is deadband control that lets the instruction use the error for computational purposes as the process variable crosses into the deadband until the process variable crosses the setpoint. Once the process variable crosses the setpoint (error crosses zero and changes sign) and as long as the process variable remains in the deadband, the instruction considers the error value zero. Enter your deadband value in the control block. The deadband extends above and below the setpoint by the value you specify. Enter zero to inhibit the deadband. If scaled, the deadband has the same scaled units as the setpoint.
13-16
Special Instructions
15297
Special Instructions
13-17
The PID instruction has only a .EN bit to indicate execution status. The .EN bit indicates that its qualifying rung conditions are true, in which case the .EN bit is set (a false-to-true transition is not needed). The .EN bit is reset when the same qualifying rung conditions become false. The PID instruction does not use a .DN bit.
.EN bit
13-18
Special Instructions
Operands:
Operand: PID Process variable Tieback Control variable PID master loop Inhold bit Inhold value Setpoint Process variable Output % Valid Types: tag PID tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL tag PID (optional) tag BOOL (optional) tag DINT (optional)
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
Special Instructions
13-19
Control status:
Word: CTL Contains: .EN .CT .CL .PVT .DOE .SWM .CA .MO .PE .NDF .NOBC .NOZC .INI .SPOR .OLL .OLH .EWD .DVNA .DVPA .PVLA .PVHA .MSTR setpoint ISA KI independent ISA KD independent ISA BIAS MAXS MINS DB SO MAXO MINO UPD PV ERR OUT PVH PVL DVP DVN PVDB DVDB MAXI
not applicable enabled cascade type (0=master; 1=slave) cascade loop (0=no; 1=yes) process variable tracking (0=no; 1=yes derivative of (0=PV; 1=error) software mode (0=no-auto); 1=yes- sw manual) control action (0=direct (SP-PV); 1=reverse (PV-SP)) station mode (0=automatic; 1=manual) PID equation (0=independent; 1=dependent) derivative smoothing (0=no; 1=yes) bias calculation (0=no; 1=yes) zero crossing (0=no; 1=for deadband) PID initialized (0=no; 1=yes) setpoint out of range (0=no; 1=yes) CV is below minimum output value (0=no; 1=yes) CV is above maximum output value (0=no; 1=yes) error is withinin deadband (0=no; 1=yes) error is alarmed low (0=no; 1=yes) error is alarmed high (0=no; 1=yes) PV is alarmed low (0=no; 1=yes) PV is alarmed high (0=no; 1=yes) slave with valid master address (0=no; 1=yes) -3.4 E+38 to 3.4 E+38 proportional gain (unitless) controller gain (unitless) integral gain (1/sec) reset term (minutes per repeat) derivative gain (seconds) rate term (minutes) 0 to 3.4 E+38 0 to 3.4 E+38 0 to 3.4 E+38 0 to 3.4 E+38 0 to 3.4 E+38 0 to 3.4 E+38 -100 to 100% -3.4 E+38 to 3.4 E+38 -3.4 E+38 to 3.4 E+38 0 to 3.4 E+38 0-100% 0-100% 0-100% >= 0.01 seconds -3.4 E+38 to 3.4 E+38 -3.4 E+38 to 3.4 E+38 0-100% -3.4 E+38 to 3.4 E+38 -3.4 E+38 to 3.4 E+38 -3.4 E+38 to 3.4 E+38 -3.4 E+38 to 3.4 E+38 0 to 3.4 E+38 0 to 3.4 E+38 -3.4 E+38 to 3.4 E+38
SP KP
independent
feedforward or bias maximum scaling minimum scaling deadband set output % maximum output limit (% of output) minimum output limit (% of output) loop update time (seconds) scaled PV value scaled error value output (% of 4095) process variable high alarm value process variable low alarm value positive deviation alarm negative deviation alarm process variable alarm deadband error alarm deadband maximum PV value
13-20
Special Instructions Word: MINI TIE MAXCV MINCV MINTIE MAXTIE Contains: minimum PV value tieback value for manual control (0-4095) maximum CV value minimum CV value minimum tieback value maximum tieback value Valid Range: -3.4 E+38 to 3.4 E+38 0-100% -3.4 E+38 to 3.4 E+38 -3.4 E+38 to 3.4 E+38 -3.4 E+38 to 3.4 E+38 -3.4 E+38 to 3.4 E+38
After you enter the PID instruction and specify the PID structure, you use the configuration tabs to specify the details of the message.
Specifying tuning
In this field: Setpoint (SP) Set output % Output bias Proportional gain (Kp) Specify: Enter a setpoint value (.SP) The valid range is:-3.4 E+38 to 3.4 E+38 Enter a set output percentage (.SO). The valid range is: 0-100% Enter an output bias percentage (.OUT). The valid range is: 0-100% Enter a proportional gain (.KP). For independent gains, its the proportional gain (unitless). The valid range is: 0 to 3.4 E+38 For dependent gains, its the controller gain (unitless). The valid range is: 0 Integral gain (Ki) to 3.4 E+38 Enter an integral gain (.KI). For independent gains, its the integral gain (1/sec). The valid range is: 0 to 3.4 E+38 For dependent gains, its the reset term (minutes per repeat). The valid range is: 0 to 3.4 E+38 Enter the derivative time (.KD). For independent gains, its the derivative gain (seconds). The valid range is: 0 to 3.4 E+38 For dependent gains, its the rate term minutes). The valid range is: Manual mode 0 to 3.4 E+38 Select either manual or software manual
Special Instructions
13-21
Specifying configuration
In this field: PID equation Specify: Select independent gains or dependent gains. Use independent when you want the three gains constants (P, I, and D) to operate independently. Select dependent when you want to use standard loop tuning methods. Select either E=PV-SP (direct acting) or E=SP-PV (reverse) Select PV or error. Use the PV derivative for more stable control when you do not change the setpoint often. Use the error derivative for fast responses to setpoint changes when the algorithm can tolerate overshoots. Enter an update time (greater than or equal 0.01 seconds) at 1/4 or 1.10 the natural period of the load time constant. The load time constant should be greater than: 3ms(algorithm) + block-transfer time(ms) ATTENTION: If you omit an update time or enter a negative update time, a major fault occurs the first time the controller runs the PID instruction. Enter a maximum control variable value (.MAXCV). The valid range is: -3.4 E+38 to 3.4 E+38 Enter a minimum control variable value (.MINCV). The valid range is: -3.4 E+38 to 3.4 E+38 Deadband value Derivative smoothing Bias calculation Zero crossing in deadband PV tracking Cascade loop Cascade type Enter a deadband value (.DB). The valid range is: 0 to 3.4 E+38 Enable or disable this selection. Enable or disable this selection. Enable or disable this selection. Enable or disable this selection. Enable or disable this selection. If cascade loop is enabled, select either slave or master.
Specifying alarms
In this field: PV high PV low PV deadband positive deviation negative deviation deviation deadband Specify: Enter a PV high alarm value (.PVH). The valid range is: -3.4 E+38 to 3.4 E+38 Enter a PV low alarm value (.PVL). The valid range is: -3.4 E+38 to 3.4 E+38 Enter a PV deadband value (.PVDB). The valid range is: 0 to 3.4 E+38 Enter a positive deviation value (.DVP). The valid range is: -3.4 E+38 to 3.4 E+38 Enter a negative deviation value (.DVN). The valid range is: -3.4 E+38 to 3.4 E+38 Enter a deviation deadband value (.DVDB). The valid range is: 0 to 3.4 E+3
13-22
Special Instructions
Specifying scaling
In this field: PV unscaled maximum PV unscaled minimum Specify: Enter a maximum PV value (.MAXI). The valid range is: -3.4 E+38 to 3.4 E+38 Enter a maximum PV value (.MINI). The valid range is:
-3.4 E+38 to 3.4 E+38 PV engineering units maximum Enter the maximum engineering units. PV engineering units minimum Enter the minimum engineering units. CV maximum Enter a maximum CV value (.MAXCV). The valid range is: CV minimum Tieback maximum Tieback minimum -3.4 E+38 to 3.4 E+38 Enter a minimum CV value (.MINCV). The valid range is: -3.4 E+38 to 3.4 E+38 Enter a maximum tieback value (.MAXTIE). The valid range is: -3.4 E+38 to 3.4 E+38 Enter a minimum tieback value (.MINTIE). The valid range is: -3.4 E+38 to 3.4 E+38
Programming Considerations
Description: If the controller encounters one of these conditions, the controller generates an run time error when it tries to execute the instruction: loop update time is zero or negative setpoint is out of range (SP < Smin or SP > Smax)
If you change SP, Smin, or Smax and this out-of-range condition occurs, the controller first tries to use the previously-valid SP, continues PID control, and sets the setpoint out-of-range error bit. If the controller cannot find a previously-valid SP, the controller generates the run time error. If you enter negative values for Kp, KI, KD, TI, or TD, the controller substitutes a zero for the negative number without generating a run time error. number of PID loops The number of PID loops that the controller can support depends on the update time required by the loops. The longer the update time and the less-sophisticated the loop control, the more loops the controller can support. The time required to receive analog inputs plus the time required for one scan should be less than the update time required by all the loops. loop update time The loop update time should be equal to the rate at which the PID rung changes between false and true. Deviation in toggle rate from the update time reduces the accuracy of the PID calculations.
Special Instructions
13-23
13-24
Special Instructions
Special Instructions
13-25
Cascading loops
You can cascade two loops by assigning the control output of the outer loop to the setpoint of the inner loop. Do not scale the setpoint of the inner loop. Set the scaling bit to 1 to inhibit scaling.
13-26
Special Instructions
Controlling a ratio
You can maintain two values in a ratio by using a MUL instruction with these parameters: uncontrolled value controlled value ratio between these two values
Special Instructions
13-27
13-28
Special Instructions
Chapter
14
Trigonometric Instructions
(SIN, COS, TAN, ASN, ACS, ATN)
Introduction
The trigonometric instructions evaluate arithmetic operations using trigonometric operations.
If you want to: Take the sine of a value. Take the cosine of a value. Take the tangent of a value. Take the arc sine of a value. Take the arc cosine of a value. Take the arc tangent of a value. Use this instruction: SIN COS TAN ASN ACS ATN See page: 14-2 14-3 14-4 14-5 14-6 14-7
You can mix values of different data types, such as floating point and integer. If you use floating point as the source, use floating point as the destination. You can mix data types, but loss of accuracy and rounding error might occur. If the rung with the compute instruction goes true, the controller performs the computation.
14-2
Trigonometric Instructions
Sine (SIN)
Description: Use the SIN instruction to take the sine of a value (Source in radians) and store the result in the Destination. The Source must be greater than or equal to -205887.4 and less than or equal to 205887.4. The resulting value in the Destination is always greater than or equal to -1 and less than or equal to 1.
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
SIN Example:
If the preceding instructions are true, the controller performs the sine operation.
Trigonometric Instructions
14-3
Cosine (COS)
Description: Use the COS instruction to take the cosine of a value (Source in radians) and store the result in the Destination. The Source must be greater than or equal to -205887.4 and less than or equal to 205887.4. The resulting value in the Destination is always greater than or equal to -1 and less than or equal to 1.
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
COS Example:
If the preceding instructions are true, the controller performs the cosine operation.
14-4
Trigonometric Instructions
Tangent (TAN)
Description: Use the TAN instruction to take the tangent of a value (Source in radians) and store the result in the Destination. The Source must be greater than or equal to -102943.7 and less than or equal to 102943.7. The resulting value in the Destination is always a real number.
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
TAN Example:
If the preceding instructions are true, the controller performs the tangent operation.
Trigonometric Instructions
14-5
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
ASN Example:
If the preceding instructions are true, the controller performs the arc sine operation.
14-6
Trigonometric Instructions
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
ACS Example:
If the preceding instructions are true, the controller performs the arc cosine operation.
Trigonometric Instructions
14-7
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
ATN Example:
If the preceding instructions are true, the controller performs the arc tangent operation.
14-8
Trigonometric Instructions
Notes:
Chapter
15
You can mix values of different data types, such as floating point and integer. If you use floating point as the source, use floating point as the destination. You can mix data types, but loss of accuracy and rounding error might occur. If the rung with the compute instruction goes true, the controller performs the computation.
15-2
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
LN Example:
If the preceding instructions are true, the controller performs the natural log operation.
15-3
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
LOG Example:
If the preceding instructions are true, the controller performs the log operation.
15-4
Operands:
Operand: Source A Source B Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
15-5
XPY Example:
If the preceding instructions are true, the controller performs the exponential operation.
15-6
Notes:
Chapter
16
If the rung with the compute instruction goes true, the controller performs the computation.
16-2
Degrees (DEG)
Description: Use the DEG instruction to convert the Source (in radians) to degrees and store the result in the Destination.
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
DEG Example:
If the preceding instructions are true, the controller converts value_1 from radians to degrees.
16-3
Radians (RAD)
Description: Use the RAD instruction to convert the Source (in degrees) to radians and store the result in the Destination. The RAD instruction uses this algorithm: Source*/180
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, DINT, or REAL tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL
executes does not execute executes
RAD Example:
If the preceding instructions are true, the controller converts value_1 from degrees to radians.
16-4
99,999,999)
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, or DINT 0<=Source<=99,999,999 tag SINT, INT, or DINT
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 15.96 na na
executes does not execute executes
false 0.18 na
TOD Example:
If the preceding instructions are true, the controller converts value_1 from an integer value to a BCD value.
16-5
Operands:
Operand: Source Destination Valid Types: immediate or tag SINT, INT, or DINT tag SINT, INT, or DINT
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 9.20 na na
executes does not execute executes
false 0.16 na
FRD Example:
If the preceding instructions are true, the controller converts value_1 from a BCD value to an integer value.
16-6
Notes:
Chapter
17
Motion Concepts
Introduction
The ControlLogix system takes a new approach to motion control. In the ControlLogix system, the motion application program execution and motion planner functions reside in the Logix5550 controller, creating highly-integrated motion and sequential control. A smart axis motion module receives coarse position commands from the ControlLogix controller and closes a high-speed (100s) fine planner, position loop, and velocity loop. The ControlLogix chassis allows high-speed synchronization of one or more ControlLogix processors and up to 16 motion control modules, which means one chassis can support up to 32 axes. RSLogix5000 programming software provides complete motion configuration and application programming, which eliminates the need to purchase and maintain multiple programming tools. An axis wizard guides you through assigning and configuring an axis. The axis wizard also initiates a powerful auto-tune utility which you can use to determine all axis gains and dynamics. The Logix5550 controller uses 27 high-level motion instructions, including instructions for homing, jogging, point-to-point positioning, complex gearing, and high-speed registration. You can insert these instructions directly into the ladder diagram application program.
17-2
Motion Concepts
Motion Concepts
17-3
To develop a motion control application program, you must complete several steps including: Adding a motion module to the I/O Configuration list Identifying and configuring each axis Writing an application program using the motion control instruction set
1 Select I/O Configuration 2 Click the right mouse button and select New Module 3 Select the 1756-MO2AE module
Description
3. Click Configure... 4. Follow the axis wizard to configure the axis. For more information, see the Motion Control User Manual, publication 1756-x.xx.
17-4
Motion Concepts
These instructions operate on one or more axes. You must identify and configure axes before you can use them. For more information about identifying and configuring axes, refer to the Motion Control User Manual, publication 1756-x.xx.
Motion Concepts
17-5
Motion instructions use three types of timing sequences: Immediate timing, where the instruction completes in one scan. Delayed (message) timing, where the instruction completes over several scans because the instruction sends messages to the servo module. Process timing, where the instruction could take an indefinite amount of time to complete.
Immediate instructions work as follows: 1. When the rung that contains the motion instruction becomes true, the processor: Sets the enable (EN) bit. Clears the done (DN) bit. Clears the error (ER) bit.
4. The next time the rung becomes false, the processor clears the .EN bit.
17-6
Motion Concepts
5. The processor can execute the instruction again when the rung becomes true.
EN
DN
ER Scan Scan Scan Scan rung true rung truerung false rung true
Delayed type instructions work as follows: 1. When the rung that contains the motion instruction becomes true, the processor: Sets the enable (EN) bit. Clears the done (DN) bit. Clears the error (ER) bit.
2. The processor begins to execute the instruction by setting up a message request to the servo module. Note: The remainder of the instruction executes in parallel to the program scan.
3. The processor checks if the servo module is ready to receive a new message. 4. The processor places the results of the check in the message status word of the control structure. 5. When the module is ready, the processor constructs and transmits the message to the module. Important: This process may repeat several times if the instruction requires multiple messages.
Motion Concepts
17-7
6.
If the processor: Does not detect an error when the instruction executes Detects an error when the instruction executes Then: The processor sets the .DN bit. The processor sets the .ER bit and stores an error code in the control structure.
7. The next time the rung becomes false, the processor clears the .EN bit. 8. When the rung becomes true, the processor can execute the instruction again.
EN
DN
ER Scan Scan Execution Scan Scan rung truerung false completerung falserung true
17-8
Motion Concepts
Process type instructions work as follows: 1. When the rung that contains the motion instruction becomes true, the processor: Sets the enable (.EN) bit. Clears the done (.DN) bit. Clears the error (.ER) bit. Clears the process complete (.PC) bit.
4. When the motion process reaches the point where the instruction can be executed again, the controller sets the .DN bit. For some process type instructions, like MAM, this will occur on the first scan. For others, like MAH, the .DN bit will not be set until the entire homing process is complete. 5. Once the initiation of the motion process completes, the program scan can continue. Important: If one of the following events occurs during the motion process, the controller sets the .DN bit and the .PC bit and clears the .IP bit: The motion process completes. Another instance of the instruction executes. Another instruction stops the motion process. A motion fault stops the motion process.
Important: The remainder of the instruction and the control process continue in parallel with the program scan. 6. The next time the rung becomes false after the .DN bit sets, the controller clears the .EN bit.
Motion Concepts
17-9
7. When the rung becomes true, the instruction can execute again.
EN
DN
ER
IP
17-10
Motion Concepts
The controller uses the Motion_Instruction structure to store status information during the execution of motion instructions. Every motion instruction has a motion_control parameter which requires a motion_instruction tag for this purpose. For each motion instruction you use, define a separate motion_instruction tag. The motion control structure is shown below:
MOTION_INSTRUCTION structure
bit number 31 30 29 28 27 26 EN DN ER IP PC error code (.ERROR) (16 bits) message status (.STATUS) (8 bits) execution state (.STATE) (8 bits) 16 15 0
Control bit or word: .EN bit .DN bit .ER bit .IP bit .PC bit
Description: The enable bit indicates that the instruction is enabled. The done bit indicates that the operation is complete. The error bit indicates when the operation generates an overflow. The in process bit indicates that a process is being executed. The process complete bit indicates that the operation is complete. The .DN bit sets after an instruction has completed execution. The .PC bit sets when the initiated process has completed.
The error value contains the error code associated with a motion function. The message status value indicates the status condition of any message associated with the motion function. The execution status value keeps track of the execution state of a function. Many motion functions have several steps and this value tracks these steps.
Motion Concepts
17-11
4 5 6 7 8 9 10 11 12 13
17-12
Motion Concepts
The Logix5550 controller stores motion status information in the AXIS and MOTION_GROUP objects. You can use the GSV and SSV instruction to set and read data within these objects. This section defines the motion class and motion instance variables which you can access using the GSV and SSV instructions. See chapter 3 for more information about the GSV and SSV instructions.
The actual position of your axis. The actual velocity of your axis. The average velocity of your axis. The timebase of the average velocity of your axis. The state of the axis configuration. The instance of the axis. The type of axis that you are using. Value: 0 1 2 Meaning: unused axis position only axis servo axis
The unity gain bandwidth that the controller uses to calculate the gains for a Motion Apply Axis Tuning (MAAT) instruction. The command position of your axis. The command velocity of your axis. The conversion factor used to convert from your units to feedback counts. The value used in calculating the maximum position servo bandwidth during the execution of the Motion Run Axis Tuning (MRAT) instruction. The operation performed when a drive fault occurs. Value: 0 1 2 3 Meaning: shutdown the axis disable the drive stop the commanded motion change the status bit only
EffectiveInertia EncoderLossFaultAction
The inertia value for the axis as calculated from the measurements the controller made during the last Motion Run Axis Tuning (MRAT) instruction. The operation performed when an encoder loss fault occurs. Value: 0 1 2 3 Meaning: shutdown the axis disable the drive stop the commanded motion change the status bit only
Motion Concepts Variable: EncoderNoiseFaultAction Description: The operation performed when an encoder noise fault occurs. Value: 0 1 2 3 FrictionCompensation GroupInstance HomeMode Meaning: shutdown the axis disable the drive stop the commanded motion change the status bit only
17-13
The fixed output level used to compensate for static friction. The instance number of the motion group that contains your axis. The homing mode for your axis. Value: 0 1 2 Meaning: passive homing active homing (default) absolute homing
The homing position of your axis. The homing return speed of your axis. The homing sequence type for your axis. Value: 0 1 2 3 Meaning: immediate homing switch homing marker homing switch-marker homing (default)
The homing speed of your axis. The I/O map instance of the servo module. The maximum acceleration of your axis. The maximum deceleration of your axis. The maximum negative travel limit. The maximum positive travel limit. The maximum speed of your axis. The channel of your servo module. The motion configuration bits for your axis. Bit: 0 1 2 Meaning: home direction home switch normally-closed home marker edge negative Meaning: servo parameters are out of sync with the controller Bit Name: ACCEL_STS DECEL_STS MOV_STS JOG_STS GEAR_STS HOM_STS CLUTCH_STS Meaning: acceleration deceleration move jog gear homing clutch
MotionFaultBits
MotionStatusBits
MotorEncoderTestIncrement OutputLimit
The amount of motion that is necessary to initiate the Motion Run Hookup Diagnostic (MRHD) test. The value of the maximum servo output voltage of your axis.
17-14
Motion Concepts Variable: OutputOffset OutputScaling PositionAccelerationFFGain PositionError PositionErrorFaultAction Description: The value used to offset the effects of the cumulative offsets of the servo module DAC output and the servo drive input. The value used to convert the output of the servo loop into the equivalent voltage to the drive. The torque command output necessary to generate the commanded acceleration. The difference between the actual and command position of an axis. The operation performed when a position error fault occurs. Value: 0 1 2 3 PositionErrorTolerance PositionIError PositionIntegralGain PositionLockTolerance PositionProportionalGain PositionUnwind PositionVelocityFFGain RegistrationPosition ServoConfigurationBits Meaning: shutdown the axis disable the drive stop the commanded motion change the status bit only
The amount of position error that the servo tolerates before issuing a position error fault. The sum of the position error for an axis. The value used to achieve accurate axis positioning despite disturbances such as static friction and gravity. The amount of position error that the servo module tolerates when giving a true position locked status indication. The value the controller multiples with the position error to correct for the position error. The value used to perform the automatic unwind of the rotary axis. The velocity command output necessary to generate the commanded velocity. The registration position for your axis. The servo configuration bits for your servo loop. Bit: 0 1 2 3 4 5 6 7 8 9 Meaning: rotary axis external velocity servo drive encoder polarity negative servo polarity negative soft overtravel checking position error checking encoder loss fault checking encoder noise fault checking drive fault checking drive fault normally-closed Bit Name: WATCH_EV_ARM_STS WATCH_EX_STS REG_EV_ARM_STS REG_EX_STS HOM_EV_ARM_STS HOM_EV_STS Meaning: watch event armed watch event registration event armed registration event home event armed home event
ServoEventBits
Motion Concepts Variable: ServoFaultBits Description: The servo fault bits for your servo loop. Bit: 0 1 2 3 4 5 6 7 8 9 ServoOutputLevel ServoStatusBits Bit Name: P_OTRVL_FLT N_OTRVL_FLT POS_ERR_FLT ENC_CHA_LS_FLT ENC_CHB_LS_FLT1 ENC_CHZ_LS_FLT ENC_NS_FLT DRV_FLT SYNC_CONN_FLT HARD_FLT Meaning: positive overtravel fault negative overtravel fault position error fault encoder channel A loss fault encoder channel B loss fault encoder channel Z loss fault encoder noise fault drive fault synchronous connection fault servo hardware fault
17-15
The output voltage level for your axis servo loop. The status bits for your servo loop. Bit: 0 1 2 3 4 13 14 15 Bit Name: SRV_ACT_STS DRV_EN_STS OUT_LMT_STS POS)LCK_STS POS)SYNC_STS TUNE_STS TEST_STS SHUTDOWN_STS Meaning: position error update position ierror update velocity error update velocity ierror update velocity command update velocity command update velocity feedback update servo output level update Meaning: shutdown the axis disable the drive stop the commanded motion change the status bit only Meaning: servo action drive enable output limit position lock position sync tuning process test diagnostic axis shutdown
ServoStatusUpdateBits
SoftOvertravelFaultAction
The actual position of your axis when new commanded motion starts for the axis. The command position of your axis when new commanded motion starts for the axis. The actual position of an axis when the Motion Group Strobe Position (MGSP) instruction executes. The command position of an axis when the Motion Group Strobe Position (MGSP) instruction executes. The direction of axis travel during the Motion Run Hookup Diagnostic (MRHD) instruction as seen by the servo module. Value: 0 1 Meaning: negative (reverse) direction positive (forward) direction
17-16
Motion Concepts Variable: TestStatus Description: The status of the last Motion Run Hookup Diagnostic (MRHD) instruction. Value: 0 1 2 3 TuneAccel TuneAccelTime TuneDecel TuneDecelTime TuneRiseTime TuneStatus Meaning: test process successful test in progress test exceeded 2-second time-out test process stopped by the user
The acceleration value measured during the last Motion Run Axis Tuning (MRAT) instruction. The acceleration time in seconds measured during the last Motion Run Axis Tuning (MRAT) instruction. The deceleration value measured during the last Motion Run Axis Tuning (MRAT) instruction. The deceleration time in seconds measured during the last Motion Run Axis Tuning (MRAT) instruction. The axis rise time in seconds measured during the last Motion Run Axis Tuning (MRAT) instruction. The status of the last Motion Run Axis Tuning (MRAT) instruction. Value: 0 1 2 3 4 Meaning: test process successful tuning in progress axis reached tuning travel limit axis polarity set incorrectly tune process aborted by user
The bandwidth of the drive as calculated from the measurements made during the last Motion Run Axis Tuning (MRAT) instruction. The axis drive scaling factor measured during the last Motion Run Axis Tuning (MRAT) instruction.
TuningTravelLimit TuningVelocity VelocityCommand VelocityError VelocityFeedback VelocityFilterBandwidth VelocityIError VelocityIntegralGain VelocityProportionalGain WatchPosition
The travel limit used by the Motion Run Axis Tuning (MRAT) instruction to limit the action of the action during tuning. The maximum speed initiated by the Motion Run Axis Tuning (MRAT) instruction. The current velocity reference to the velocity servo loop for an axis. The difference between the commanded and actual velocity of a servo axis. The actual velocity of your axis as estimated by the servo module. The bandwidth of the servo low-pass digital output filter. The sum of the velocity error for a specified axis. The value that the controller multiplies with the Velocity IError value to correct the velocity error. The value that the controller multiplies with the Velocity Error to correct the velocity error. The watch position of your axis.
Chapter
18
MASR
18-10
MDO MDF
18-12 18-14
MAFR
18-16
18-2
This operating state allows the servo module DAC to directly control an external drive. In this state: the servo module drive enable output is active. servo action is disabled. no servo faults are present.
Servo control
This operating state allows the servo module to perform closed loop motion. In this state: the servo module drive enable output is active. servo action is enabled. no servo faults are present. the axis is forced to maintain the commanded servo position.
Axis faulted
In this operating state, a servo fault is present, and the status of the drive enable output, the action of the servo, and the condition of the OK contact depend on the faults and fault actions that are present. This operating state allows the OK relay contacts to open a set of contacts in the E-stop string of the drive power supply. In this state: the servo module drive enable output is inactive. servo action is disabled. the OK contact is open.
Shutdown
To determine the operating state of the axis, you can look at the DRIVE and FDBK LEDs on the servo module.
If the DRIVE LED is: Flashing green Solid green Solid green Solid red Flashing red And the FDBK LED is: Flashing green Flashing green Solid green Flashing or solid red Flashing green Then the operating state of the axis is: Axis ready Direct drive control Servo control Axis faulted Shutdown
18-3
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction enables axis servo action. The error bit sets when the instruction detect an error, such as if the axis is not configured.
18-4
7 8 11 12
The drive enable output is active. The axis is not accelerating. The axis is not decelerating. The axis is not clutching. The axis is not jogging. The axis is not moving. The axis is not gearing. The axis is not homing.
MSO Example:
When the input instructions are true, the controller enables the servo drive and activates the axis servo loop configured by axis_1.
18-5
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction enables axis servo action. The error bit sets when the instruction detect an error, such as if the axis is not configured.
18-6
8 11 12
The drive enable output is inactive. The axis is not accelerating. The axis is not decelerating. The axis is not clutching. The axis is not jogging. The axis is not moving. The axis is not gearing. The axis is not homing.
MSF Example:
When the input instructions are true, the controller disables the servo drive and the axis servo loop configured by axis_1.
18-7
Important: You can use the OK contacts to open the contacts that open the E-stop string (if wired) that controls the power to the drive system. The axis will remain in the shutdown state until either a Motion Axis Shutdown Reset (MASR) instruction or a Motion Group Shutdown Reset (MGSR) instruction executes. The MASD instruction uses delayed timing. To use the MASD instruction, configure the axis as either a servo axis or a position only axis. Operands:
Operand: Axis Motion control Valid Types: tag AXIS tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
18-8
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction sets the axis to the shutdown state. The error bit sets when the instruction detect an error, such as if the axis is not configured.
11 12
18-9
The drive enable output is inactive. The axis is in the shutdown state. The axis is not accelerating. The axis is not decelerating. The axis is not clutching. The axis is not jogging. The axis is not moving. The axis is not gearing. The axis is not homing.
MASD Example:
When the input instructions are true, the controller forces axis_1 into the shutdown operating state.
18-10
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction clears the axis from the shutdown state. The error bit sets when the instruction detect an error, such as if the axis is not configured.
18-11
11 12
The drive enable output is inactive. The axis is not in the shutdown state.
MASR Example:
When the input instructions are true, the controller resets axis_1 from a previous shutdown operating state into an axis ready operating state.
18-12
The MDO instruction uses delayed timing. To use the MDO instruction: Operands:
Operand: Axis Drive Output1 Drive Units Valid Types: tag AXIS immediate or tag SINT, INT, DINT, or REAL immediate 0=volts 1=% of maximum output limit Motion control tag MOTION_INSTRUCTION
Configure the axis as either a servo axis or a position-only axis. Ensure that the axis operating state is axis ready. Ensure that servo action is off.
1. The 16-bit digital-to-analog convertor on the servo module limits the effective resolution of the MDO instruction to 305 V or 0.003%.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Execution
Important: The servo output voltage is not limited by the output limit configuration parameter and is not affected by the servo output polarity configuration bit.
18-13
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction updates the axis servo output. The error bit sets when the instruction detect an error, such as if the drive output value was too large.
4 7 11 12 13
MDO Example:
When the input instructions are true, the controller activates the servo drive for axis_1 and sets the servo output voltage of axis_1.
18-14
The MDF instruction uses delayed timing. To use the MDF instruction, configure the axis as either a servo axis or a position-only axis. Operands:
Operand: Axis Motion control Valid Types: tag AXIS tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
18-15
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction disables the axis drive signals. The error bit sets when the instruction detect an error, such as if the axis is not configured.
4 8 11 12
MDF Example:
When the input instructions are true, the controller deactivates the servo drive for axis_1 and sets the servo output voltage of axis_1 to the output offset value.
18-16
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
18-17
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction clears all the fault status bits. The error bit sets when the instruction detect an error, such as if the axis is not configured.
11 12
The drive enable output is inactive. The axis is not accelerating. The axis is not decelerating. The axis is not clutching. The axis is not jogging. The axis is not moving. The axis is not gearing. The axis is not homing.
18-18
MAFR Example:
When the input instructions are true, the controller clears all motion faults for axis_1.
Chapter
19
MRP
19-21
19-2
Change decel
select whether or not to change the 0=no 1=yes deceleration Decel deceleration rate of the axis Decel units immediate 0=% of maximum deceleration 1=units/second2 Motion control tag MOTION_INSTRUCTION immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
19-3
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction initiates an axis stop. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets when one of the following events occurs: The MAS instruction completes A servo fault terminates the MAS instruction .PC bit The process complete bit sets after the stop operation completes.
19-4
MAS Example:
When the input instructions are true, the controller stop motion on axis_1 and clears all associated, motion status flags.
19-5
The MAH instruction uses delayed and process type timing. To use the MAH instruction:
If you want to use: Active homing Then: Passive homing Configure the axis as a servo axis. Ensure that the axis operating state is servo on.
Operands:
Operand: Axis Motion control Valid Types: tag AXIS tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
19-6
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction initiates an axis home operation. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets when one of the following events occurs: The MAH instruction completes. A Motion Axis Stop (MAS) instruction terminates the MAH instruction. A servo fault occurs. .PC The process complete bit sets when the instruction completes an axis home operation.
7 8 11 12
19-7
MAH Example:
When the input instructions are true, the controller homes axis_1.
19-8
Operands:
Operand: Axis Direction direction of the jog Speed speed to move the axis Speed units immediate 0=% of maximum speed 1=units/second Accel acceleration rate of the axis Accel units immediate 0=% of maximum acceleration 1=units/second2 Decel deceleration rate of the axis Decel units immediate 0=% of maximum deceleration 1=units/second2 Profile velocity profile to run the jog immediate 0=trapezoidal 1=S-curve immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL Valid Types: tag AXIS immediate or tag SINT, INT, or DINT 0=forward jog 1=reverse jog immediate or tag SINT, INT, DINT, or REAL
19-9
select whether or not to turn all axis 0=disable 1=enable movement into pure jog Merge speed immediate
if you selected the merge check box, 0=programmed value in the speed field 1=current axis speed this field determines the speed of the jog profile. Motion control tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction initiates an axis jog. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets when one of the following events occurs: Another MAJ instance supersedes the current instruction. A Motion Axis Stop (MAS) instruction, a merge operation, or a servo fault terminates the MAJ instruction. .PC bit The process complete bit sets when the instruction completes an axis jog.
19-10
7 8 11 13
MAJ Example:
When the input instructions are true, the controller initiates a jog motion for axis_1.
19-11
Operands:
Operand: Axis Move type type of move operation Valid Types: tag AXIS immediate or tag SINT, INT, or DINT 0=absolute move 1=incremental move 2=rotary shortest path move 3=rotary positive move 4=rotary negative move immediate or tag SINT, INT, DINT, or REAL
Position/Distance value of the absolute command position to move to, or for incremental movement, the value of the distance to move from the current command position Speed speed to move the axis Speed units
19-12
Motion Move Instructions Operand: Decel deceleration rate of the axis Decel units immediate 0=% of maximum deceleration 1=units/second2 Profile velocity profile to run the jog Merge immediate 0=trapezoidal 1=S-curve immediate Valid Types: immediate or tag SINT, INT, DINT, or REAL
select whether or not to turn all axis 0=disable 1=enable movement into pure jog Merge speed immediate
if you selected the merge check box, 0=programmed value in the speed field 1=current axis speed this field determines the speed of the move profile. Motion control tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
19-13
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction initiates an axis move. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets when one of the following events occurs: The MAM instruction completes. A Motion Stop Axis (MAS) instruction, a merge operation, or a servo fault terminates the MAM instruction. .PC bit The process complete bit sets when the instruction completes an axis move.
19-14
MAM Example:
When the input instructions are true, the controller initiates a move for axis_1.
19-15
Operands:
Operand: Slave axis axis to perform the operation on Master axis axis that the slave axis follows Direction immediate or tag SINT, INT, or DINT tag AXIS Valid Types: tag AXIS
direction of the slave axis relative to 0=slave axis moves in the same direction as the master axis the master axis 1=slave axis moves in the opposite direction of 2=slave axis moves in the reverse of its current direction 3=slave axis to continues its current direction Master reference master position source Ratio format format of the ratio between the slave and the master axis Ratio signed, real value of the gear ratio of slave units per master units Slave counts Master counts immediate or tag SINT, INT, or DINT immediate or tag SINT, INT, or DINT immediate 0=actual source 1=command source immediate 0=real gear ratio 1=integer fraction of slave encoder counts to master encoder counts immediate or tag SINT, INT, or DINT
19-16
Motion Move Instructions Operand: Clutch select whether or not to ramp the slave axis to gearing speed using the acceleration value Accel acceleration of the slave axis Accel units immediate 0=% of maximum acceleration 1=units/second2 Motion control tag MOTION_INSTRUCTION Valid Types: immediate 0=disable 1=enable immediate or tag SINT, INT, DINT, or REAL
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction initiates an axis gear. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets if a Motion Stop Axis (MAS) instruction, a merge operation, or a servo fault terminates the MAG instruction. .PC bit The process complete bit sets after the slave axis ramps to match the slave speed.
19-17
MAG Example:
When the input instructions are true, the controller provides electronic gearing between axis_slave and axis_1.
19-18
Note:
Operands:
Operand: Axis Motion type motion profile to change Change speed Valid Types: tag AXIS immediate 0=jog 1=move immediate
select whether or not to change the 0=no 1=yes speed Speed speed to move the axis Speed units immediate 0=% of maximum speed 1=units/second Change accel select this check box to change the acceleration Accel acceleration rate of the axis Accel units immediate 0=% of maximum acceleration 1=units/second2 Change decel select this check box to change the deceleration Decel deceleration rate of the axis immediate 0=no 1=yes immediate or tag SINT, INT, DINT, or REAL immediate 0=no 1=yes immediate or tag SINT, INT, DINT, or REAL immediate or tag SINT, INT, DINT, or REAL
Motion Move Instructions Operand: Decel units Valid Types: immediate 0=% of maximum deceleration 1=units/second2 Motion control tag MOTION_INSTRUCTION
19-19
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction changes axis dynamics. The error bit sets when the instruction detect an error, such as if the axis is not configured.
19-20
MCD Example:
When the input instructions are true, the controller changes the speed, acceleration, or deceleration rate of a move profile of jog profile in progress for axis_1.
19-21
The controller can calculate new axis positions in two ways: Absolute, where the controller assigns the position value as the current actual or command position. Relative, where the controller adds the position value to the current actual or command position.
The MRP instruction uses delayed type timing. To use the MRP instruction, configure the axis as either a servo axis or a position-only axis. Operands:
Operand: Axis Type type of redefinition operation Position select Valid Types: tag AXIS immediate 0=absolute 1=relative immediate
0=actual select whether to perform the redefinition operation on the current: 1=command actual position command position immediate or tag SINT, IN, DINT, or REAL
tag MOTION_INSTRUCTION
19-22
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction redefines the axis position commands. The error bit sets when the instruction detect an error, such as if the axis is not configured.
11 12
MRP Example:
When the input instructions are true, the controller changes the command or position of axis_1.
Chapter
20
MGSD MGSR
20-6 20-8
MGSP
20-10
20-2
Operands:
Operand: Axis Inhibit select whether or not the group of axes are inhibited after they stop Motion control Valid Types: tag AXIS immediate 0=disable 1=enable tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
20-3
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction initiates a group stop for all the axes in a group. The error bit sets when the instruction detect an error, such as if the group is not configured. The in process bit sets when the rung goes true. It resets when the MGS instruction completes. .PC bit The process complete bit sets after the instruction stops all the axes. If the Inhibit option is selected, the .PC bit sets after the instruction sets all the axes to the axis ready state.
MGS Example:
When the input instructions are true, the controller stops motion on all axes in group_1 .
20-4
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction sets the group of axes to the shutdown operating state. The error bit sets when the instruction detect an error, such as if the group is not configured. The in process bit sets on a positive transition. It resets after the Motion Group Programmed Stop (MGPS) instruction completes. .PC bit The process complete bit sets after the instruction stops all the axes.
20-5
The drive enable output is inactive. The axis is not in the shutdown state.
MGPS Example:
When the input instructions are true, the controller stops motion on all axes in group_1, using a method that you set for each axis.
20-6
The MGSD instruction uses delayed type timing. To use the MGSD instruction, the group must be configured. Operands:
Operand: Axis Motion control Valid Types: tag AXIS tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction sets the group of axes to the shutdown operating state. The error bit sets when the instruction detect an error, such as if the group is not configured.
20-7
The drive enable output is inactive. The axis is in the shutdown state. The axis is not accelerating. The axis is not decelerating. The axis is not clutching. The axis is not jogging. The axis is not moving. The axis is not gearing. The axis is not homing.
MGSD Example:
When the input instructions are true, the controller forces all axes in group_1 into a shutdown operating state.
20-8
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction resets the group of axes from the shutdown operating state. The error bit sets when the instruction detect an error, such as if the group is not configured.
20-9
The drive enable output is inactive. The axis is not in the shutdown state.
MGSR Example:
When the input instructions are true, the controller transitions all axes in group_1 from the shutdown operating state to the axis ready operating state.
20-10
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction sets a group of axes to the shutdown operating state. The error bit sets when the instruction detect an error, such as if the group is not configured.
20-11
MGSP Example:
When the input instructions are true, the controller latches the current command and the actual position of all axes in group_1 .
20-12
Notes:
Chapter
21
21-2
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
21-3
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction arms watch-event checking. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets when one of the following events occurs: A watch event occurs. Another MAW instruction supersedes the current instruction. A Motion Disarm Watch (MDW) instruction terminates the MAW instruction. .PC bit The process complete bit is when a watch event occurs.
11 12
MAW Example:
When the input instructions are true, the controller arms watch-position event-checking for axis_1.
21-4
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction disarms watch-event checking. The error bit sets when the instruction detect an error, such as if the axis is not configured.
Important: When you use this instruction, the controller clears the watch-event status bit and the watch-armed status bits. This instruction also clears the .IP bit in the control structure.
21-5
11 12
MDW Example:
When the input instructions are true, the controller disarms watch-position event-checking for axis_1.
21-6
Operands:
Operand: Axis Trigger condition input condition that defines the registration event Windowed registration select whether or not the registration position within the position window Min. position minimum position for windowed registration event checking. The registration position must be greater than this value before the controller accepts the registration event. Max. position maximum position for windowed registration event checking The registration position must be less than this value before the controller accepts the registration event. Motion control tag MOTION_INSTRUCTION immediate or tag SINT, INT, DINT, or REAL Valid Types: tag AXIS immediate 0=trigger on positive transitions 1=trigger on negative transitions immediate 0=disable 1=enable immediate or tag SINT, INT, DINT, or REAL
21-7
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit .IP bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction arms registration event checking. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets when one of the following events occurs: A registration event occurs Another MAR instruction supersedes the current instruction A Motion Disarm Registration (MDR) instruction terminates the MAR instruction. .PC bit The process complete bit sets when a registration event occurs.
11 12
21-8
MAR Example:
When the input instructions are true, the controller arms servo-module registration-event checking for axis_1.
21-9
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction disarms axis-registration event checking. The error bit sets when the instruction detect an error, such as if the axis is not configured.
Important: When you use this instruction, the controller resets the registration event status bit and the registration armed status bit.
21-10
11 12
MDR Example:
When the input instructions are true, the controller disarms servo-module registration-event checking for axis_1 .
Chapter
22
22-2
Operands:
Operand: Axis Motion control Valid Types: tag AXIS tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction completes an apply axis-tuning process. The error bit sets when the instruction detect an error, such as if the axis is not configured.
22-3
7 8 11 12
MAAT Example:
When the input instructions are true, the controller computes a complete set of servo gains and dynamic limits for axis_1.
22-4
The MRAT instruction uses delayed and process type timing. To use the MRAT instruction: Operands:
Operand: Axis Motion control Valid Types: tag AXIS tag MOTION_INSTRUCTION
Configure the axis as a servo axis. Ensure the axis operating state is axis ready.
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
22-5
Control status:
Control bit or word: .EN bit .DN bit .ER bit In process (IP) Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction initiates a tuning process. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets when one of the following events occurs: Process complete (PC) The MRAT instruction completes. A Motion Axis Stop (MAS) instruction or a servo fault terminates the MRAT instruction.
The process complete bit sets when the instruction completes a tuning process.
4 6 7 8 11 12
22-6
MRAT Example:
When the input instructions are true, the controller commands the servo module to run a tuning motion profile for axis_1.
22-7
Operands:
Operand: Axis Diagnostic test specify the test to apply Valid Types: tag AXIS immediate 0=motor/encoder hookup test 1=encoder hookup test 2=encoder marker test immediate 0=forward 1=reverse tag MOTION_INSTRUCTION
Observed direction direction of motion during the diagnostic tests Motion control
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
22-8
Control status:
Control bit or word: .EN bit .DN bit .ER bit Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction applies the results of a test process. The error bit sets when the instruction detect an error, such as if the axis is not configured.
4 6 7 8 11 12
MAHD Example:
When the input instructions are true, the controller applies the results of a previously executed Motion Run Hookup Diagnostics (MRHD) instruction to axis_1.
22-9
Configure the axis as either a servo axis or a position only axis. Configure the axis as either a servo axis or a position only axis.
Operands:
Operand: Axis Diagnostic test Valid Types: tag AXIS immediate
specify which diagnostic test to run 0=motor/encoder hookup test 1=encoder hookup test 2=encoder marker hookup test Motion control tag MOTION_INSTRUCTION
Operation:
Characteristic: Timing (in s) DINT REAL Memory (words) Execution DINT REAL Description: true 100.00 100.00 12 false 100.00 100.00
22-10
Control status:
Control bit or word: .EN bit .DN bit .ER bit In process (IP) Description: The enable bit sets when the rung goes from false to true. It remains set until servo messaging completes and the rung becomes false. The done bit sets when the instruction initiates a test process. The error bit sets when the instruction detect an error, such as if the axis is not configured. The in process bit sets when the rung goes true. It resets when one of the following events occurs: Process complete (PC) The MRHD instruction completes. A Motion Axis Stop (MAS) instruction or a servo fault terminates the MRHD instruction.
The process complete bit sets when the instruction completes the diagnostic test process.
4 6 7 8 11 12
TEST_STS
True
22-11
Example:
When the input instructions are true, the controller runs the encoder diagnostic test on axis
22-12
Notes: