Micrologix 1400 Programmable Controllers: Instruction Set Reference Manual
Micrologix 1400 Programmable Controllers: Instruction Set Reference Manual
In no event will Rockwell Automation, Inc. be responsible or liable for indirect or consequential damages resulting from
the use or application of this equipment.
The examples and diagrams in this manual are included solely for illustrative purposes. Because of the many variables and
requirements associated with any particular installation, Rockwell Automation, Inc. cannot assume responsibility or
liability for actual use based on the examples and diagrams.
No patent liability is assumed by Rockwell Automation, Inc. with respect to use of information, circuits, equipment, or
software described in this manual.
Reproduction of the contents of this manual, in whole or in part, without written permission of Rockwell Automation,
Inc., is prohibited.
Throughout this manual, when necessary, we use notes to make you aware of safety considerations.
WARNING: Identifies information about practices or circumstances that can cause an explosion in a hazardous
environment, which may lead to personal injury or death, property damage, or economic loss.
ATTENTION: Identifies information about practices or circumstances that can lead to personal injury or death,
property damage, or economic loss. Attentions help you identify a hazard, avoid a hazard, and recognize the
consequence
SHOCK HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that
dangerous voltage may be present.
BURN HAZARD: Labels may be on or inside the equipment, for example, a drive or motor, to alert people that
surfaces may reach dangerous temperatures.
IMPORTANT Identifies information that is critical for successful application and understanding of the product.
Allen-Bradley, Rockwell Automation, MicroLogix, RSLinx, RSLogix 500 and TechConnect are trademarks of Rockwell Automation, Inc.
Trademarks not belonging to Rockwell Automation are property of their respective companies.
Summary of Changes
To help you locate new and updated information in this release of the manual, we
have included change bars as shown to the right of this paragraph.
The table below lists the sections that document new features and additional or
updated information about existing features.
Summary of Change
Topic Page
Support for Clear Controller Memory feature from FRN 15 onwards 33
Firmware Revision History Features are added to the controllers through firmware upgrades. See the latest
release notes, 1766-RN001, to be sure that your controller’s firmware is at the
level you need. Firmware upgrades are not required, except to allow you access to
the new features. See “Firmware Upgrades” below.
Firmware Upgrades Enhanced features are added to the controllers through a firmware upgrade. This
firmware upgrade is not required, except to allow you access to the latest features
and corrected anomalies. You can only upgrade firmware within the same series of
controller. To use the newest features, be sure your controller’s firmware is at the
following level:
To upgrade the firmware for a MicroLogix controller visit the MicroLogix web
site at http://www.ab.com/programmablecontrol/plc/micrologix/
downloads.html.
In order to use all of the latest features available with OS Series A controllers,
RSLogix™ 500/RSLogix Micro programming software must be version 8.10.00 or
higher. For Series B controllers, this should be version 8.30.00 or higher.
Notes:
Summary of Changes
Firmware Revision History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Firmware Upgrades . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Preface
Who Should Use this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Purpose of this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Common Techniques Used in this Manual . . . . . . . . . . . . . . . . . . . . . . . . . 37
Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Rockwell Automation Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Chapter 1
I/O Configuration Embedded I/O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
MicroLogix 1400 Expansion I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Expansion I/O Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Addressing Expansion I/O Slots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
MicroLogix 1400 Expansion I/O Memory Mapping . . . . . . . . . . . . . . . . . . 3
Discrete I/O Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Analog I/O Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Specialty I/O Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
I/O Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Addressing Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
I/O Forcing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Input Forcing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Output Forcing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Input Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Analog Inputs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Analog Input Filter and Update times . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Input Channel Filtering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Converting Analog Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Converting Analog Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Analog Outputs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Latching Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Rising Edge Behavior - Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Rising Edge Behavior - Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Falling Edge Behavior – Example 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Falling Edge Behavior – Example 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Configure Expansion
I/O Using RSLogix 500/RSLogix Micro. . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Chapter 2
Controller Memory and File Controller Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Types File Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
User Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Chapter 3
Function Files Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Real-Time Clock
Function File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Writing Data to the Real-Time Clock . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Real-Time Clock Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
RTC Battery Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
RTA - Real Time Clock Adjust Instruction. . . . . . . . . . . . . . . . . . . . . . . . . 38
Memory Module Information Function File . . . . . . . . . . . . . . . . . . . . . . . . 40
Base Hardware Information Function File. . . . . . . . . . . . . . . . . . . . . . . . . . 42
Communications Status File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Ethernet Communications Status File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Input/Output Status File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Chapter 4
Programming Instructions Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Overview Using the Instruction Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Addressing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Example – Using Indirect Addressing to Duplicate Indexed
Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Chapter 5
Using the High-Speed Counter High-Speed Counter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
and Programmable Limit Switch Programmable Limit Switch Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
High-Speed Counter (HSC) Function File . . . . . . . . . . . . . . . . . . . . . . . . . 76
High-Speed Counter Function File Sub-Elements Summary . . . . . . . . . 78
HSC Function File Sub-Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Program File Number (PFN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Error Code (ER). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Function Enabled (FE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Auto Start (AS). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Chapter 6
Using High-Speed Outputs PTO - Pulse Train Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Pulse Train Output Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Momentary Logic Enable Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Standard Logic Enable Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Chapter 7
Relay-Type (Bit) Instructions XIC - Examine if Closed
XIO - Examine if Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
OTE - Output Energize. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
OTL - Output Latch
OTU - Output Unlatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
ONS - One Shot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
OSR - One Shot Rising
OSF - One Shot Falling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Chapter 8
Timer and Counter Instructions Timer Instructions Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Timer Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Repeating Timer Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
TON - Timer, On-Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
TOF - Timer, Off-Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
RTO - Retentive Timer, On-Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
How Counters Work. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Using the CTU and CTD Instructions. . . . . . . . . . . . . . . . . . . . . . . . 149
Using Counter File Control and Status Bits . . . . . . . . . . . . . . . . . . . 150
CTU - Count Up
CTD - Count Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
RES - Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Chapter 9
Compare Instructions Using the Compare Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
EQU - Equal
NEQ - Not Equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
GRT - Greater Than
LES - Less Than . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
GEQ - Greater Than or Equal To
LEQ - Less Than or Equal To . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
MEQ - Mask Compare for Equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
LIM - Limit Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Chapter 10
Math Instructions General Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Using the Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Updates to Math Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Overflow Trap Bit, S:5/0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Using the Floating Point (F) Data File . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
File Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Chapter 11
Application Specific RHC - Read High Speed Clock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Instructions Instruction Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
RPC - Read Program Checksum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Instruction Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Chapter 12
Conversion Instructions Using Decode and Encode Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
DCD - Decode 4 to 1-of-16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
ENC - Encode
1-of-16 to 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Updates to Math Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
FRD - Convert from Binary Coded Decimal (BCD) . . . . . . . . . . . . . . . 208
FRD Instruction Source Operand. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Updates to Math Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
TOD - Convert to Binary Coded Decimal (BCD) . . . . . . . . . . . . . . . . . 211
TOD Instruction Destination Operand . . . . . . . . . . . . . . . . . . . . . . . 211
Updates to Math Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Changes to the Math Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
GCD - Gray Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Updates to Math Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Chapter 13
Logical Instructions Using Logical Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Updates to Math Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
AND - Bit-Wise AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
OR - Logical OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
XOR - Exclusive OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
NOT - Logical NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Chapter 14
Move Instructions MOV - Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Using the MOV Instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Updates to Math Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
MVM - Masked Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Using the MVM Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Updates to Math Status Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Chapter 15
File Instructions CPW - Copy Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
COP - Copy File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
FLL - Fill File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
BSL - Bit Shift Left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
BSR - Bit Shift Right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
FFL - First In, First Out (FIFO) Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
FFU - First In, First Out (FIFO) Unload . . . . . . . . . . . . . . . . . . . . . . . . . 235
LFL - Last In, First Out (LIFO) Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Chapter 16
Sequencer Instructions SQC- Sequencer Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
SQO- Sequencer Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
SQL - Sequencer Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Chapter 17
Program Control Instructions JMP - Jump to Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
LBL - Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
JSR - Jump to Subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
SBR - Subroutine Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
RET - Return from Subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
SUS - Suspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
TND - Temporary End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
END - Program End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
MCR - Master Control Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Chapter 18
Input and Output Instructions IIM - Immediate Input with Mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
IOM - Immediate Output with Mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
REF- I/O Refresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Chapter 19
Using Interrupts Information About Using Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
What is an Interrupt? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
When Can the Controller Operation be Interrupted? . . . . . . . . . . 264
Priority of User Interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
User Fault Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
User Interrupt Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
INT - Interrupt Subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
STS - Selectable Timed Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
UID - User Interrupt Disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
UIE - User Interrupt Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
UIF - User Interrupt Flush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Using the Selectable Timed Interrupt (STI) Function File . . . . . . . . . . 272
Selectable Time Interrupt (STI) Function File Sub-Elements
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
STI Function File Sub-Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Using the Event Input Interrupt (EII) Function File . . . . . . . . . . . . . . . 276
Event Input Interrupt (EII) Function File Sub-Elements
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
EII Function File Sub-Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Chapter 20
Process Control Instruction The PID Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
The PID Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
PD Data File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
PID - Proportional Integral Derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Setpoint (SPS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Process Variable (PV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Setpoint MAX (MAXS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Setpoint MIN (MINS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Old Setpoint Value (OSP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Output Limit (OL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Control Variable High Limit (CVH) . . . . . . . . . . . . . . . . . . . . . . . . . 286
Control Variable Low Limit (CVL) . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Output Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Control Variable (CV). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Control Variable Percent (CVP). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Scaled Process Variable (SPV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Tuning Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Controller Gain (Kc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Reset Term (Ti) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Rate Term (Td) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Time Mode (TM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Loop Update Time (LUT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Zero Crossing Deadband (ZCD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Feed Forward Bias (FF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Scaled Error (SE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Automatic / Manual (AM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Control Mode (CM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
PV in Deadband (DB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
PLC 5 Gain Range (RG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Setpoint Scaling (SC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Loop Update Too Fast (TF). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Derivative Action Bit (DA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
CV Upper Limit Alarm (UL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
CV Lower Limit Alarm (LL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Setpoint Out Of Range (SP). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
PV Out Of Range (PV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Done (DN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
PD10:0.19Enable (EN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Integral Sum (IS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Altered Derivative Term (AD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Runtime Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Chapter 21
ASCII Instructions General Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
ASCII Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Instruction Types and Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
ASCII String Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
ASCII Port Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Programming ASCII Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Protocol Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Using the Full ASCII Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Using AWA and AWT Instructions with Other Serial Channel
Drivers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
String (ST) Data File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
File Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Addressing String Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Control Data File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
File Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Addressing Control Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
ACL - ASCII Clear Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Instruction Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
AIC - ASCII Integer to String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
AWA - ASCII Write with Append . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Programming AWA Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
AWT - ASCII Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Programming AWT Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
ABL - Test Buffer for Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Entering Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Instruction Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Chapter 22
Communications Instructions Messaging Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
SVC - Service Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Channel Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Communication Status Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
MSG - Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
The Message Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Message File Sub-Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
“Control Bits” Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Timing Diagram for the MSG Instruction. . . . . . . . . . . . . . . . . . . . . . . . . 348
Chapter 23
Modbus TCP Modbus TCP Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Channel Configuration for Modbus TCP . . . . . . . . . . . . . . . . . . . . . . . . . 421
Modbus TCP Server Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Modbus TCP Server Configuration Parameters . . . . . . . . . . . . . . . . 424
Modbus TCP Client Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Modbus TCP Client Configuration Parameters. . . . . . . . . . . . . . . . 427
Messaging for Modbus TCP Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
MSG Configuration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Message Instruction Timeouts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Change between Executing and Non-Executing Controller Modes . .
429
Diagnostics for Modbus TCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Chapter 24
Socket Interface Using CIP Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Generic Messaging Socket Interface Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Number and Type of Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Typical Sequence of Transactions For a TCP Client. . . . . . . . . . . . 436
Typical Sequence of Transactions For a TCP Server . . . . . . . . . . . . 437
Typical Sequence of Transactions For UDP Without
OpenConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Typical Sequence of Transactions For UDP With
OpenConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Communicate With the Socket Object Via a MSG Instruction . . . . . 441
Message Transfer Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Service Timeouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Message Instruction Timeouts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Socket Interface Timeouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Programming Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
TCP Connection Loss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Change Controller Mode Between Executing and
Non-Executing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Application Messages and TCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Partial Reads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Partial Writes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Socket Object Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
CreateSocket. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
OpenConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
MSG Configuration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
AcceptConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Read. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
DeleteSocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
DeleteAllSockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Possible Error Codes for Socket Services. . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Chapter 25
Recipe and Data Logging RCP - Recipe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Recipe File and Programming Example . . . . . . . . . . . . . . . . . . . . . . . . 467
Data Logging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Queues and Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Example Queue 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Example Queue 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
Example Maximum Record of String Data . . . . . . . . . . . . . . . . . . . . . 475
Configuring Data Log Queues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
DLG - Data Log Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
Data Log Status File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
Retrieving (Reading) Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Accessing the Retrieval File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Retrieval Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Information for Creating Your Own Application . . . . . . . . . . . . . . 481
Conditions that Will Erase the Data Retrieval File . . . . . . . . . . . . . . . . . 483
Chapter 26
LCD - LCD Information LCD Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
LCD Function File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
LCD Function File Sub-Elements Summary . . . . . . . . . . . . . . . . . . . . . . . 487
LCD Function File Sub-Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
LCD - LCD Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Appendix A
MicroLogix 1400 Memory Usage Programming Instructions Memory usage and Execution Time. . . . . . 497
and Instruction Execution Time MicroLogix 1400 Indirect Addressing . . . . . . . . . . . . . . . . . . . . . . . . . 501
MicroLogix 1400
Scan Time Calculation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Appendix B
System Status File Status File Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
Status File Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
Arithmetic Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
Controller Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
STI Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
Memory Module Program Compare. . . . . . . . . . . . . . . . . . . . . . . . . . . 511
Math Overflow Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
Watchdog Scan Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
Appendix C
Fault Messages and Error Codes Identifying Controller Faults. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Automatically Clearing Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Manually Clearing Faults Using the Fault Routine . . . . . . . . . . . . . 526
Fault Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
Contacting Rockwell Automation for Assistance . . . . . . . . . . . . . . . . . . 532
Appendix D
Protocol Configuration DH-485 Communication Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
DH-485 Network Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
DH-485 Token Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
Appendix E
Knowledgebase Quick Starts # 17444 Pulse Train Output (PTOX) Quick Start . . . . . . . . . . . . . . . . . 577
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
General Information on the PTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
# 17446 Pulse Width Modulation (PWMX)
Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
# 17447 High Speed Counter (HSC) Quick Start . . . . . . . . . . . . . . . . . . 582
General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
# 17465 Message (MSG) Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
Communications Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
Message (MSG) instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
Appendix F
Number Systems Binary Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
Positive Decimal Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
Negative Decimal Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606
Hexadecimal Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Hex Mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
Glossary
Index
Notes:
Read this preface to familiarize yourself with the rest of the manual. It provides
information concerning:
• who should use this manual
• the purpose of this manual
• related documentation
• conventions used in this manual
• Rockwell Automation support
Who Should Use this Use this manual if you are responsible for designing, installing, programming, or
troubleshooting control systems that use MicroLogix 1400 controller.
Manual
You should have a basic understanding of electrical circuitry and familiarity with
relay logic. If you do not, obtain the proper training before using this product.
Purpose of this Manual This manual is a reference guide for MicroLogix 1400 controller. It describes the
procedures you use to program and troubleshoot your controller. This manual:
• gives you an overview of the file types used by the controllers
• provides the instruction set for the controllers
• contains application examples to show the instruction set in use
Common Techniques Used The following conventions are used throughout this manual:
in this Manual • Bulleted lists such as this one provide information, not procedural steps.
• Numbered lists provide sequential steps or hierarchical information.
• Change bars appear beside information that has been changed or added
since the last revision of this manual. Change bars appear in the margin as
shown to the right of this paragraph.
Related Documentation The following documents contain additional information concerning Rockwell
Automation products. To obtain a copy, contact your local Rockwell Automation
office or distributor.
For Read this Document Document Number
Information on mounting and wiring the MicroLogix 1400 Programmable MicroLogix 1400 Programmable Controllers 1766-IN001
Controller, including a mounting template and door labels. Installation Instructions
Detailed information on planning, mounting, wiring, and troubleshooting your MicroLogix 1400 Programmable Controllers 1766-UM001
MicroLogix 1400 system. User Manual
A description on how to install and connect an AIC+. This manual also contains Advanced Interface Converter (AIC+) User 1761-UM004
information on network wiring. Manual
Information on how to install, configure, and commission a DNI DeviceNet Interface User Manual 1761-UM005
Information on DF1 open protocol. DF1 Protocol and Command Set Reference 1770-6.5.16
Manual
In-depth information on grounding and wiring Allen-Bradley programmable Allen-Bradley Programmable Controller 1770-4.1
controllers Grounding and Wiring Guidelines
A description of important differences between solid-state programmable Application Considerations for Solid-State SGI-1.1
controller products and hard-wired electromechanical devices Controls
An article on wire sizes and types for grounding electrical equipment National Electrical Code - Published by the National Fire Protection
Association of Boston, MA.
A glossary of industrial automation terms and abbreviations Allen-Bradley Industrial Automation Glossary AG-7.1
Rockwell Automation Before you contact Rockwell Automation for technical assistance, we suggest you
review the troubleshooting information contained in this publication first.
Support
If the problem persists, call your local distributor or contact Rockwell
Automation in one of the following ways:
Phone United States/Canada 1.440.646.3434
Outside United States/Canada You can access the phone number for your country via the Internet:
1. Go to http://www.ab.com
2. Click on Product Support (http://support.automation.rockwell.com)
3. Under Support Centers, click on Contact Information
Internet ⇒ 1.Go to http://www.ab.com
2.Click on Product Support (http://support.automation.rockwell.com)
I/O Configuration
This section discusses the various aspects of Input and Output features of the
MicroLogix 1400 controllers. Each controller comes with a certain amount of
embedded I/O, which is physically located on the controller. The controller also
allows for adding expansion I/O.
Embedded I/O The MicroLogix 1400 provide discrete I/O and analog input that is built into the
controller as listed in the following table. These I/O points are referred to as
Embedded I/O.
MicroLogix 1400 Expansion If the application requires more I/O than the controller provides, you can attach
I/O modules. These additional modules are called expansion I/O.
I/O
For the MicroLogix 1400, Bulletin 1762 expansion I/O is used to provide
discrete and analog inputs and outputs, and specialty modules. You can attach up
to seven expansion I/O modules in any combination.
The figure below shows the addressing for the MicroLogix 1400 and its
I/O.
The expansion I/O is addressed as slots 1…7 (the controller’s embedded I/O is
addressed as slot 0). Modules are counted from left to right as shown below.
Slot 1
Slot 2
44563
TIP In most cases, you can use the following address format:
X:s/b (X = file type letter, s = slot number, b = bit number)
See I/O Addressing on page 11 for complete information on address formats.
For each input module, the input data file contains the current state of the field
input points. Bit positions 0…7 correspond to input terminals 0…7.
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 x x x x x x x x r r r r r r r r
For each input module, the input data file contains the current state of the field
input points. Bit positions 0…15 correspond to input terminals 0…15.
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 r r r r r r r r r r r r r r r r
r = read only
For each input module, the input data file contains the current state of the field
input points. Bit positions 0…15 together with word 0/1 correspond to input
terminals 0…31.
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 r r r r r r r r r r r r r r r r
1 r r r r r r r r r r r r r r r r
r = read only
For each output module, the output data file contains the controller-directed
state of the discrete output points. Bit positions 0…5 correspond to output
terminals 0…5.
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w
For each output module, the output data file contains the controller-directed
state of the discrete output points. Bit positions 0…7 correspond to output
terminals 0…7.
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w
For each output module, the output data file contains the controller-directed
state of the discrete output points. Bit positions 0…15 correspond to output
terminals 0…15.
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w
For each output module, the output data file contains the controller-directed
state of the discrete output points. Bit positions 0…15 together with word 0/1
correspond to output terminals 0…31.
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w
1 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w
The following table shows the data ranges for 0…10V dc and 4…20 mA.
For each input module, slot x, words 0 and 1 contain the analog values of the
inputs. The module can be configured to use either raw/proportional data or
scaled-for-PID data. The input data file for each configuration is shown below.
Raw/Proportional Format
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 Channel 0 Data 0 to 32,768 0 0 0
1 0 Channel 1 Data 0 to 32,768 0 0 0
2 Reserved
3 Reserved
4 Reserved S1 S0
5 U0 O0 U1 O1 Reserved
Scaled-for-PID Format
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 Channel 0 Data 0 to 16,383 0 0
1 0 0 Channel 1 Data 0 to 16,383 0 0
2 Reserved
3 Reserved
4 Reserved S1 S0
5 U0 O0 U1 O1 Reserved
• Sx = General status bits for channels 0 and 1. This bit is set when an error
(over- or under-range) exists for that channel, or there is a general module
hardware error.
• Ox = Over-range flag bits for channels 0 and 1. These bits can be used in
the control program for error detection.
• Ux = Under-range flag bits for channels 0 and 1. These bits can be used in
the control program for error detection.
For each module, slot x, words 0 and 1 contain the channel output data.
Raw/Proportional Format
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 Channel 0 Data 0 to 32,768 0 0 0
1 0 Channel 1 Data 0 to 32,768 0 0 0
Scaled-for-PID Format
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 Channel 0 Data 0 to 16,383 0 0
1 0 0 Channel 1 Data 0 to 16,383 0 0
For each module, slot x, words 0 and 1 contain the analog values of the inputs.
The module can be configured to use either raw/proportional data or
scaled-for-PID data. The input data file for either configuration is shown below.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 SGN0 Channel 0 Data
1 SGN1 Channel 1 Data
2 SGN2 Channel 2 Data
3 SGN3 Channel 3 Data
4 Reserved S3 S2 S1 S0
5 U0 O0 U1 O1 U2 O2 U3 O3 Reserved
6 Reserved
• Sx = General status bits for channels 0…3. This bit is set when an error (over- or
under-range) exists for that channel, or there is a general module hardware error.
• Ox = Over-range flag bits for channels 0…3. These bits are set when the input signal is
above the user-specified range. The module continues to convert data to the maximum
full range value during an over-range condition. The bits reset when the over-range
condition clears.
• UIx = Under-range flag bits for input channels 0…3. These bits are set when the input
signal is below the user-specified range. The module continues to convert data to the
maximum full range value during an under-range condition. The bits reset when the
under-range condition clears.
For each module, slot x, words 0 and 1 contain the analog output module status
data for use in the control program.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 Reserved SO3 SO2 SO1 SO0
1 Reserved UO OO UO OO1 UO2 OO2 UO3 OO3
0 0 1
For each module, slot x, words 0…3 contain the channel output data.
Raw/Proportional Format
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 Channel 0 Data 0 to 32,760 0 0 0
1 0 Channel 1 Data 0 to 32,760 0 0 0
2 0 Channel 2 Data 0 to 32,760 0 0 0
3 0 Channel 3 Data 0 to 32,760 0 0 0
Words 0…3 contain the analog output data for channels 0…3, respectively. The
module ignores the “don’t care” bits (0…2), but checks the sign bit (15). If bit 15
equals one, the module sets the output value to 0V or 0 mA.
Scaled-for-PID Format
Bit Position
Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 Channel 0 Data 0 to 16,380 0 0
1 0 0 Channel 1 Data 0 to 16,380 0 0
2 0 0 Channel 2 Data 0 to 16,380 0 0
3 0 0 Channel 3 Data 0 to 16,380 0 0
Words 0…3 contain the analog output data for channels 0…3, respectively. The
module ignores the “don’t care” bits (0 and 1), but checks the sign bit (15), and
bit 14. If bit 15 equals one, the module sets the output value to 0V or 0 mA. If bit
15 equals zero and bit 14 equals one, the module sets the output value to 10.5V
DC or 21 mA.
For each module, slot x, words 0…3 contain the analog values of the inputs.
Words 4 and 5 provide sensor/channel status feedback. The input data file for
each configuration is shown below.
Word 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
/Bit
0 Analog Input Data Channel 0
1 Analog Input Data Channel 1
2 Analog Input Data Channel 2
Word 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
/Bit
3 Analog Input Data Channel 3
4 Reserved OC O O O Reserved S3 S2 S1 S0
3 C2 C C
1 0
5 U0 O0 U1 O1 U2 O2 U O Reserved
3 3
For each module, slot x, words 0…3 contain the analog values of the inputs. The
input data file is shown below.
Word 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
/Bit
0 Analog Input Data Channel 0
SGN
4 Reserved OC OC OC OC OC Reserved S S S2 S1 S0
4 3 2 1 0 4 3
5 U0 O0 U1 O1 U2 O2 U3 O3 U4 O4 Reserved
• Sx = General status bits for channels 0…3 (S0…S3) and the CJC sensor
(S4). This bit is set (1) when an error (over-range, under-range,
open-circuit, or input data not valid) exists for that channel. An input data
not valid condition is determined by the user program. Refer to
MicroLogix 1200 I/O Thermocouple/mV Input Module User Manual,
publication 1762-UM002 for additional details.
• OCx = Open-circuit indication for channels 0…3 (OC0…OC3) and the
CJC sensor (OC4).
• Ox = Over-range flag bits for channels 0…3 (O0…O3) and the CJC sensor
(O4). These bits can be used in the control program for error detection.
• Ux = Under-range flag bits for channels 0…3 (U0…U3) and the CJC
sensor (U4). These bits can be used in the control program for error
detection.
File Type
Input (I) or Output (O)
Xd:s.w/b Bit
Addressing examples
Addressing Level Example Address(1) Slot Word Bit
(2)
Bit addressing O:0/4 Output slot 0 (embedded I/O) Word 0 Output bit 4
O:2/7(2) Output slot 2 (expansion I/O) Word 0 Output bit 7
I:1/4(2) Input slot 1 (expansion I/O) Word 0 Input bit 4
(2)
I:0/15 Input slot 0 (embedded I/O) Word 0 Input bit 15
Word addressing O:1.0 Output slot 1 (expansion I/O) Word 0
I:7.3 Input slot 7 (expansion I/O) Word 3
I:3.1 Input slot 3 (expansion I/O) Word 1
(1) The optional Data File Number is not shown in these examples.
(2) A word delimiter and number are not shown. Therefore, the address refers to word 0.
I/O Forcing I/O forcing is the ability to override the actual status of the I/O at the user’s
discretion.
Input Forcing
When an input is forced, the value in the input data file is set to a user-defined
state. For discrete inputs, you can force an input “on” or “off ”. When an input is
forced, it no longer reflects the state of the physical input or the input LCD
indicator. For embedded inputs, the controller reacts as if the force is applied to
the physical input terminal.
Output Forcing
When an output is forced, the controller overrides the status of the control
program, and sets the output to the user-defined state. Discrete outputs can be
forced “on” or “off ”. The value in the output file is unaffected by the force. It
maintains the state determined by the logic in the control program. However, the
state of the physical output and the output LCD indicator will be set to the
forced state.
Input Filtering The MicroLogix 1400 controllers allow users to configure groups of DC inputs
for high-speed or normal operation. Users can configure each input group’s
response time. A configurable filter determines how long the input signal must be
“on” or “off ” before the controller recognizes the signal. The higher the value, the
longer it takes for the input state to be recognized by the controller. Higher values
provide more filtering, and are used in electrically noisy environments. Lower
values provide less filtering, and are used to detect fast or narrow pulses. The
filters can be set to a lower value when using high-speed counters, latching inputs,
and input interrupts.
The input groups are pre-arranged. Select the filter time required for each input
group. Apply a unique input filter setting to each of the input groups:
The minimum and maximum response times associated with each input filter
setting can be found in your controller’s User Manual.
Input words 4…7 contain the value of analog inputs (Word 4: analog input
channel 0, Word 5: analog input channel 1, Word 6: analog input channel 2,
Word 7: analog input channel 3).
The MicroLogix 1400 analog input filter is programmable. The slower the filter
setting, the more immune the analog inputs are to electrical noise. The more
immune the analog inputs are to electrical noise, the slower the inputs will be to
update. Similarly, the faster the filter setting, the less immune the analog inputs
are to electrical noise. The less immune the analog inputs are to electrical noise,
the faster the inputs will be to update.
EXAMPLE If a 250 Hz filter is selected, the maximum update Time = ladder scan
time + 4ms.
The analog input circuits are able to monitor voltage signals and convert them to
digital data. There are five terminals assigned to the input channels that provide
four voltage inputs, and a return signal (commons).
The following table shows sample Analog Signal and Data Word values using the
nominal transfer function formula:
For example, if an input value of 1200 is in the input image, the calculated value is
as follows:
10V-
----------- × 1200 = 2.9304 ( V )
4095
Analog Outputs The MicroLogix 1400 -L32BWAA, -L32AWAA, and -L32BXBA support
2-channel, 12-bit resolution analog output. These channels have 0…10V DC
output range. Output words 4 and 5 contain the value of analog outputs (Word 4
: analog output channel 0, Word 5 : analog output channel 1).
For example, if an input value of 3000 is in the output image, the calculated value
is as follows:
10V-
----------- × 3000 = 7.326 ( V )
4095
Enable this feature using RSLogix 500/RSLogix Micro. With an open project:
The following information is provided for a controller looking for an “on” pulse.
When an external signal is detected “on”, the controller “latches” this event. In
general, at the next input scan following this event, the input image point is
turned “on” and remains “on” for the next controller scan. It is then set to “off ” at
the next input scan. The following figures help demonstrate this.
External
Input
Latched
Status
Input File
Value
External
Input
Latched
Status
Input File
Value
TIP The “gray” area of the Latched Status waveform is the input filter
delay.
IMPORTANT The input file value does not represent the external input
when the input is configured for latching behavior. When
configured for rising edge behavior, the input file value is
normally “off” (“on” for 1 scan when a rising edge pulse is
detected).
The previous examples demonstrate rising edge behavior. Falling edge behavior
operates exactly the same way with these exceptions:
• The detection is on the “falling edge” of the external input.
• The input image is normally “on” (1), and changes to “off ” (0) for one
scan.
External
Input
Latched
Status
Input File
Value
External
Input
Latched
Input File
Value
TIP The “gray” area of the Latched Status waveform is the input filter
delay.
IMPORTANT The input file value does not represent the external input when the
input is configured for latching behavior. When configured for falling
edge behavior, the input file value is normally “on” (“off” for 1 scan
when a falling edge pulse is detected).
Configure Expansion Expansion I/O must be configured for use with the controller. Configuring
expansion I/O can be done either manually, or automatically. Using RSLogix
I/O Using RSLogix 500/ 500/RSLogix Micro:
RSLogix Micro
1. Open the Controller folder.
2. Open the I/O Configuration folder.
3. For manual configuration, drag the Compact I/O module to the slot.
Notes:
This chapter describes controller memory and the types of files used by the
MicroLogix 1400 controller. The chapter is organized as follows:
• Controller Memory on page 21
• Data Files on page 26
• Protecting Data Files During Download on page 26
• Static File Protection on page 28
• Program Password Protection on page 30
• Clearing the Controller Memory on page 32
• Allow Future Access Setting (OEM Lock) on page 32
• Web View Disable on page 33
TIP The file types shown for data files 3…8 are the default file types for
those file numbers and cannot be changed. Data files 9…255 can be
added to your program to operate as bit, timer, counter, or other files
shown below.
User Memory
User memory is the amount of controller storage available to store data such as
ladder logic, data table files, and I/O configuration.
User data files consist of the system status file, I/O image files, and all other
user-creatable data files (bit, timer, counter, control, integer, string, long word,
MSG, and PID).
• For program files, a word is the equivalent of a ladder instruction with one
operand. For example(1),
– 1 XIC instruction, which has 1 operand, consumes 1 user word
– 1 EQU instruction, which has 2 operands, consumes 2 user words
– 1 ADD instruction, which has 3 operands, consumes 3 user words
• Function files do not consume user memory.
(1) These are approximate values. For actual memory usage, see the tables in Appendix A of this manual.
The MicroLogix 1400 controller supports 20K of memory. Memory can be used
for program files and data files. The maximum data memory usage is 10K words
as shown.
10.0 K -
9.5 K -
9.0 K -
8.5 K -
8.0 K -
7.5 K -
7.0 K -
6.5 K -
6.0 K -
5.5 K -
5.0 K -
4.5 K-
4.0 K-
3.5 K -
3.0 K -
Data Words
2.5 K -
2.0 K -
1.5 K -
1.0 K -
0.5 K -
0K -
--
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
6.0 K -
-
-
-
-
8.5 K -
10.0 K
10.5 K
11.4 K
7.0 K
9.0 K
9.5 K
0.5 K
1.0 K
1.5 K
2.0 K
2.5 K
3.0 K
3.5 K
4.0 K
4.5 K
5.0 K
5.5 K
6.5 K
7.5 K
8.0 K
0K
44582
Program Words
To find the memory usage for specific instructions, see MicroLogix 1400
Memory Usage and Instruction Execution Time on page 497.
The MicroLogix 1400 controller also supports 128K bytes of battery backed
memory for data logging or recipe operations. See Chapter 25 for Data Logging
and Recipe information.
To find the memory usage for specific instructions See System Status File on page 503.
2. The amount of Memory Used and Memory Left will appear in the
Controller Properties window once the program has been verified.
Data Files Data files store numeric information, including I/O, status, and other data
associated with the instructions used in ladder subroutines. The data file types
are:
variables in one or more data files in the controller. This situation can occur when
an application needs to be updated, but the data that is relevant to the installation
needs to remain intact.
Download File Protection can be applied to the following data file types:
• Output (O)
• Input (I)
• Binary (B)
• Timer (T)
• Counter (C)
• Control (R)
• Integer (N)
• Floating Point (F)
• String (ST)
• ASCII (A)
• Long Word (L)
• Proportional Integral Derivative (PD)
• Message (MG)
• Programmable Limit Switch (PLS)
• Routing Information (RI)
• Extended Routing Information (RIX)
• Recipe (Series B only)
Data File Download Protection only operates when the following conditions are
met during a User Program or Memory Module download to the controller:
• The controller contains protected data files.
• The program being downloaded has the same number of protected data
files as the program currently in the controller.
• All protected data file numbers, types, and sizes (number of elements)
currently in the controller exactly match that of the program being
downloaded to the controller.
If all of these conditions are met, the controller will not write over any data file in
the controller that is configured as Download Protected when a program is
downloaded from a memory module or programming software.
If any of these conditions are not met, the entire User Program is transferred to
the controller. Additionally, if the program in the controller contains protected
files, the Data Protection Lost indicator (S:36/10) is set to indicate that
protected data has been lost. For example, a control program with protected files
is transferred to the controller. The original program did not have protected files
or the files did not match. The data protection lost indicator (S:36/10) is then
set. The data protection lost indicator represents that the protected files within
the controller have had values downloaded and the user application may need to
be re-configured.
TIP The controller will not clear the Data Protection Lost indicator. It is
up to the user to clear this bit.
Static File Protection When a data file is Static File Protected, the values contained in it cannot be
changed via communications, except during a program download to the
controller.
Static File Protection and Data File Download Protection can be used in
combination with MicroLogix 1400 Controller Series A and higher.
Static File Protection can be applied to the following data file types:
• Output (O)
• Input (I)
• Status (S)
• Binary (B)
• Timer (T)
• Counter (C)
• Control (R)
• Integer (N)
• Floating Point (F)
• String (ST)
• ASCII (A)
• Long Word (L)
• Proportional Integral Derivative (PD)
• Message (MG)
• Programmable Limit Switch (PLS)
• Routing Information (RI)
• Extended Routing Information (RIX)
Access the Static File Protect feature using RSLogix 500/RSLogix Micro
programming software. For each data file you want protected, select the Static
protection in the Data File Properties screen as shown in this illustration. To
access this screen, right mouse click on the desired data file.
Program Password Programming software access to MicroLogix programs and controllers can be
restricted through password protection. Each controller program may contain
Protection two passwords, the Password and the Master Password. (The Master Password is
ignored unless a Password has also been configured.) The Master Password takes
precedence over the Password. That way, all controllers on an assembly line, for
instance, can each have a different Password, but have the same Master Password,
allowing access to all controllers for supervisory or maintenance purposes.
IMPORTANT Starting with RSLogix 500/Micro version 8.40, these passwords may
optionally be encrypted so that as they are transmitted between the
controller and PCs running RSLogix 500/Micro, someone with physical
access to the network where communications is occurring over will
not be able to "sniff" the network and capture the password(s). Even
so, password protection should not be solely relied upon to prevent
unintended changes to the program and data table. Refer to other
sections in this chapter for additional steps that you may be able to
take with your specific MicroLogix controller to prevent unintended
changes.
By default, no passwords are configured in the controller. You can create, change
or delete a password using the Controller Properties dialog box. Unencrypted
Once a Password has been created and downloaded into the controller, any time
the user attempts to open that offline file or go online with that controller, they
will be prompted to provide either the Password or the Master Password before
the software proceeds.
If a memory module is installed, the user program has the "Load Always"
functionality enabled and the user program is password protected, then the
controller compares the passwords before transferring the user program from the
memory module to the controller. If the passwords do not match, the user
program is not transferred and the Program Mismatch bit (S:5/9) is set.
Clearing the Controller If you are locked out because you do not have the password for the controller, you
can clear the controller memory and download a new User Program.
Memory
You can clear the memory when the programming software prompts you for a
System or Master Password to go online with the controller. To do so:
Allow Future Access The controller supports a feature which allows you to select if future access to the
User Program should be allowed or disallowed after it has been transferred to the
Setting (OEM Lock) controller. This type of protection is particularly useful to an OEM (original
equipment manufacturer) who develops an application and then distributes the
application via a memory module or within a controller.
The Allow Future Access setting is found in the Controller Properties window as
shown below.
When Allow Future Access is deselected, the controller requires that the User
Program in the controller is the same as the one in the programming device. If the
programming device does not have a matching copy of the User Program, access
to the User Program in the controller is denied. To access the User Program, clear
controller memory and reload the program.
TIP Functions such as change mode, clear memory, restore program, and
transfer memory module are allowed regardless of this selection.
Controller passwords are not associated with the Allow Future Access
setting.
Web View Disable This allows selective disabling individual Data Files from Web View.
Using RSLogix 500/RSLogix Micro V8.10 and higher, you can disable
individual data files from being viewed via any web browser by selecting the data
file’s properties page and checking the Web View Disable check box as shown
below. Any data file property changes must be made offline and downloaded to
the processor.
LCD Edit Disable This allows selective protection of individual Data Files on the LCD. Using
RSLogix 500/RSLogix Micro V8.10 and higher, select the data file’s properties
page and check the LCD Edit Disable check box as shown below. Any data file
property changes must be made offline and downloaded to the processor.
Function Files
Overview Function Files are one of the three primary file structures within the MicroLogix
1400 controller (Program Files and Data Files are the others). Function Files
provide an efficient and logical interface to controller resources. Controller
resources are resident (permanent) features such as the Real-Time Clock and
High-Speed Counter. The features are available to the control program through
either instructions that are dedicated to a specific function file, or via standard
instructions such as MOV and ADD. The Function File types are:
File Name File Identifier File Description
High-Speed Counter HSC This file type is associated with the High-Speed Counter function. See Using the High-Speed Counter
and Programmable Limit Switch on page 75 for more information.
Extended Pulse Train Output PTOX This file type is associated with the Pulse Train Output Instruction. See Pulse Train Outputs (PTOX)
Function File on page 113 for more information.
Extended Pulse Width PWMX This file type is associated with the Pulse Width Modulation instruction. See Pulse Width Modulation
Modulation (PWMX) Function File on page 127 for more information.
Selectable Timed Interrupt STI This file type is associated with the Selectable Timed Interrupt function. See Using the Selectable
Timed Interrupt (STI) Function File on page 272 for more information.
Event Input Interrupt EII This file type is associated with the Event Input Interrupt instruction. See Using the Event Input
Interrupt (EII) Function File on page 276 for more information.
Real-Time Clock RTC This file type is associated with the Real-Time Clock (time of day) function. See Real-Time Clock
Function File on page 36 for more information.
Memory Module Information MMI This file type contains information about the Memory Module. See Memory Module Information
Function File on page 40 for more information.
Base Hardware Information BHI This file type contains information about the controller’s hardware. See Base Hardware Information
Function File on page 42 for the file structure.
Communications Status File CS0 This file type contains information about the Communications with the controller. See
for Channel 0 Communications Status File on page 43 for the file structure.
Communications Status File CS2
for Channel 2
Real-Time Clock The real-time clock provides year, month, day of month, day of week, hour,
minute, and second information to the Real-Time Clock (RTC) Function File in
Function File the controller.
The Real-Time Clock parameters and their valid ranges are shown in the table
below.
The RTC settings may be changed by either the user program, a write MSG
instruction from another MicroLogix controller, or the programming software.
Use the Copy Word (CPW) instruction to adjust the RTC settings within the
ladder logic as follows:
IMPORTANT A Major fault (44h) is generated if any of the data being written to the
RTC function file is invalid. For example, setting the Seconds to 61 or
setting the Day of Month to 32.
When valid data is sent to the real-time clock from the programming device or
another controller, the new values take effect immediately. In RSLogix 500/
RSLogix Micro, click on Set Date & Time in the RTC Function File screen to set
the RTC time to the current time on your PC.
The real-time clock does not allow you to load or store invalid date or time data.
TIP Use the Disable Clock button in your programming device to disable the
real-time clock before storing a module. This decreases the drain on the
battery during storage.
The following table indicates the expected accuracy of the real-time clock for
various temperatures.
IMPORTANT The RTA instruction will only change the RTC when the RTA
rung is evaluated true, after it was previously false
(false-to-true transition). The RTA instruction will have no
effect if the rung is always true or false.
RTA is set:
• If RTC Seconds are less than 30, then RTC Seconds is reset to 0.
• If RTC Seconds are greater than or equal to 30, then the RTC Minutes are
incremented by 1 and RTC Seconds are reset to 0.
The following conditions cause the RTA instruction to have no effect on the
RTC data:
• RTC is disabled
• An external (via communications) message to the RTC is in progress when
the RTA instruction is executed. (External communications to the RTC
takes precedence over the RTA instruction.)
To re-activate the RTA instruction, the RTA rung must become false, and then
true.
TIP There is only one internal storage bit allocated in the system for
this instruction. Do not use more than one RTA instruction in your
program.
TIP You can also use a MSG instruction to write RTC data from one
controller to another to synchronize time. To send (write) RTC
data, use RTC:0 as the source and the destination.
Memory Module The controller has a Memory Module Information (MMI) File which is updated
with data from the attached memory module. At power-up or on detection of a
Information Function File memory module being inserted, the catalog number, series, revision, and type are
identified and written to the MMI file in the user program. If a memory module
is not attached, zeros are written to the MMI file.
The parameters and their valid ranges are shown in the table below.
FT - Functionality Type
MP - Module Present
The MP (Module Present) bit can be used in the user program to determine
when a memory module is present on the controller. This bit is updated once per
scan, provided the memory module is first recognized by the controller. To be
WP - Write Protect
When the WP (Write Protect) bit is set (1), the module is write-protected and
the user program and data within the memory module cannot be overwritten
IMPORTANT Once the WP bit is set (1), it cannot be cleared. Only set this bit if
you want the contents of the memory module to become
permanent.
FO - Fault Override
The FO (Fault Override) bit represents the status of the fault override setting of
the program stored in the memory module. It enables you to determine the value
of the FO bit without actually loading the program from the memory module.
The LPC (Load Program Compare) bit shows the status of the load program
compare selection in the memory module’s user program status file. It enables you
to determine the value without actually loading the user program from the
memory module.
See Memory Module Program Compare on page 511 for more information.
LE - Load on Error
The LE (Load on Error) bit represents the status of the load on error setting in
the program stored in the memory module. It enables you to determine the value
of the selection without actually loading the user program from the memory
module.
See Load Memory Module On Error Or Default Program on page 507 for more
information.
LA - Load Always
The LA (Load Always) bit represents the status of the load always setting in the
program stored in the memory module. It enables you to determine the value of
the selection without actually loading the user program from the memory
module.
See Load Memory Module Always on page 507 for more information.
MB - Mode Behavior
The MB (Mode Behavior) bit represents the status of the mode behavior setting
in the program stored in the memory module. It enables you to determine the
value of the selection without actually loading the user program from the
memory module.
Base Hardware Information The base hardware information (BHI) file is a read-only file that contains a
description of the MicroLogix 1400 Controller.
Function File
Base Hardware Information Function File (BHI)
Address Description
BHI:0.CN CN – Catalog Number
BHI:0.SRS SRS – Series
BHI:0.REV REV – Revision
BHI:0.FT FT – Functionality Type
Communications Status File The Communications Status (CS) File is a read-only file that contains
information on how the controller communication parameters are configured
and status information on communications activity.
There are three Communications Status Files for each communications port.
Communications Status File CS0 and CS2 correspond to Channel 0 and
Channel 2 on the controller. Ethernet Communications Status File ES
corresponds to Channel 1 on the controller.
The following tables show the details of each block in the Communications
Status File.
With RSLogix 500/RSLogix Micro version 8.10.00 and later, formatted displays
of the diagnostic counters for each configured channel are available under
Channel Status. These displays include a Clear button that allows you to reset the
diagnostic counters while monitoring them online with the programming
software.
TIP Clicking the Clear button while online monitoring Channel Status of
any channel will reset the channel status diagnostic counters for all
three channels to zero.
If you are using RSLogix 500/RSLogix Micro version 8.10.00 or higher, you can
view the active node table by clicking on “Processor Status” and then selecting the
tab for the configured channel.
Ethernet Communications The Ethernet Communications Status (ES) File is a read-only file that contains
information on how the controller Ethernet communication parameters are
Status File configured and status information on Ethernet communications activity.
The following tables show the details of each block in the Ethernet
Communications Status File.
With RSLogix 500/RSLogix Micro version 8.10.00 and later, formatted displays
of the diagnostic counters for Ethernet communications channel are available
under Channel Status. These displays include a Clear button that allows you to
reset the diagnostic counters while monitoring them online with the
programming software.
The last Port tab will show the current states of Ethernet communications port
according to word 5 of Ethernet Communications Status File.
Input/Output Status File The input/output status (IOS) file is a read-only file in the controller that
contains information on the status of the embedded and local expansion I/O.
The data file is structured as:
Input/Output Status File
Word Description
0 Embedded Module Error Code – Always zero
1…4 Expansion Module Error Code – The word number corresponds to the module’s slot number. Refer to the I/O module’s documentation for
specific information. (MicroLogix 1400)
Notes:
Instruction Set The following table shows the MicroLogix 1400 programming instructions listed
within their functional group.(1)
(1) The Memory Module Information Function File appears on page 40 following the Real-Time Clock Function File information.
Using the Instruction Throughout this manual, each instruction (or group of similar instructions) has a
table similar to the one shown below. This table provides information for all
Descriptions sub-elements (or components) of an instruction or group of instructions. This
table identifies the type of compatible address that can be used for each
sub-element of an instruction or group of instructions in a data file or function
file. The definitions of the terms used in these tables are listed below this example
table.
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
ASCII
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Source A • • • • • • • • • • • • • • • • • • • • • • • • • • • •
Source B • • • • • • • • • • • • • • • • • • • • • • • • • • • •
Destination • • • • • • • • • • • • • • • • • • • • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Addressing Modes
How or when each type is used depends on the instruction being programmed
and the type of elements specified within the operands of the instruction. By
supporting these three addressing methods, the MicroLogix 1400 allows
incredible flexibility in how data can be monitored or manipulated. Each of the
addressing modes are described below.
Immediate Addressing
Direct Addressing
When you use direct addressing, you define a specific data location within the
controller. Any data location that is supported by the elements of an operand
within the instruction being programmed can be used. In this example we are
illustrating a limit instruction, where:
• Low Limit = Numeric value (from -32,768…32,767) entered
from the programming software.
• Test Value = LCD:0.POT0 (This is the current position/value of
trim pot 0.)
• High Limit = N7:17 (This is the data resident in Integer file 7,
element 17.)
The Test Value (LCD:0.POT0) and High Limit (N7:17) are direct addressing
examples. The Low Limit is immediate addressing.
Indirect Addressing
The MicroLogix 1400 supports indirection (indirect addressing) for Files, Words
and Bits. To define which components of an address are to be indirected, a closed
bracket “[ ]” is used. The following examples illustrate how to use indirect
addressing.
Indirect Addressing of a Word
B3:0 ADD
ADD
0000 Add
0 Source A N7:[N10:1]
0<
Source B 1234
1234<
Dest N11:33
0<
• Address: N7:[N10:1]
• In this example, the element number to be used for source A in the ADD
instruction is defined by the number located in N10:1. If the value of
location N10:1 = 15, the ADD instruction operates as
“N7:15 + Source B”.
• In this example, the element specified by N10:1 must be between 0 and
255, because all data files have a maximum individual size of 256 elements.
TIP If a number larger than the number of elements in the data
file is placed in N10:1 (in this example), data integrity
cannot be guaranteed, because a file boundary will be
crossed. This may not generate a controller fault, but the
data location is invalid/unknown.
LIM
LIM B3:0 COP
COP
0001 Limit Test Copy File
Low Lim 10 0 Source #N[N50:100]:10
10< Dest #N7:0
Test N50:100 Length 15
10<
High Lim 25
25<
• Address: N[N50:100]:10
B3:0 B3:0
0002
[B25:0] 10
0003 END
• Address: B3/[B25:0]
• Description: In this example, the element to be used for the indirection is
B25:0. The data in B25:0 defines the bit within file B3. If the value of
location B25:0 = 1017, the XIC instruction is processed using B3/1017.
TIP If a number larger than 4096 (or larger than the number of
elements in the data file) is placed in B25:0 in this example,
data integrity cannot be guaranteed. Exceeding the number of
elements in the data file would cause the file boundary to be
crossed.
These are only some of the examples that can be used; others include:
• File and Element Indirection: N[N10:0]:[N25:0]
• Input Slot Indirection: I1:[N7:0].0
Each group of instructions may or may not allow indirection. Please review the
compatibility table for each instruction to determine which elements within an
instruction support indirection.
The following ADD instruction uses an indexed address in the Source A and
Destination addresses. If the indexed offset value is 20 (stored in S:24), the
controller uses the data stored at the base address plus the indexed offset to
perform the operation.
Indexed ADD
ADD Working ADD
ADD
Addresses Add Addresses Add
Source A #N7:0 Source A N7:20
Source B 25 Source B 25
The following ADD instruction uses an indirect address in the Source A and
Destination addresses. If the indirect offset value is 20 (stored in N7:3), the
controller uses the data stored at the base address plus the indirect offset to
perform to instruction.
Indirect ADD
ADD Working ADD
ADD
Addresses Add Addresses Add
Source A N7:[N7:3] Source A N7:20
Source B 25 Source B 25
Notes:
High-Speed Counter All MicroLogix 1400, except the 1766-L32AWA and 1766_L32AWAA, have six
100kHz high-speed counters. There are three main high-speed counters (counter
Overview 0, 1, 2) and three sub high speed counters (counter 3, 4, 5). Each main high-speed
counter has four dedicated inputs and each sub high-speed counter has two
dedicated inputs. HSC0 utilizes inputs 0…3, HSC1 utilizes inputs 4…7, HSC2
utilizes inputs 8…11, HSC3 utilizes inputs 2 and 3, HSC4 utilizes inputs 6 and 7
and HSC5 utilizes inputs 10 and 11. In some cases, a sub counter will be disabled
by master counter mode. See the section HSC Mode (MOD) on page 89.
TIP HSC0 is used in this document to define how any HSC works.
IMPORTANT The HSC function can only be used with the controller’s embedded I/
O. It cannot be used with expansion I/O modules.
This chapter describes how to use the HSC function and also contains sections
on the HSL and RAC instructions, as follows:
• High-Speed Counter (HSC) Function File on page 76.
• HSL - High-Speed Counter Load on page 101.
• RAC - Reset Accumulated Value on page 102.
Programmable Limit Switch The Programmable Limit Switch function allows you to configure the
High-Speed Counter to operate as a PLS (programmable limit switch) or rotary
Overview cam switch. See page 103 for more information.
High-Speed Counter (HSC) Within the RSLogix 500/RSLogix Micro Function File Folder, you see a HSC
Function File. This file provides access to HSC configuration data, and also
Function File allows the control program access to all information pertaining to the
High-Speed Counter.
TIP If the controller is in the run mode, the data within sub-element
fields may be changing.
The HSC function, along with the PTOX and PWMX instructions, are different
than most other controller instructions. Their operation is performed by custom
circuitry that runs in parallel with the main system processor. This is necessary
because of the high performance requirements of these functions.
The HSC is extremely versatile; the user can select or configure the master HSC
for any one of ten (10) modes and the sub HSC for any one of five (5) modes of
operation.
Operating Modes are discussed later in this chapter. See the section HSC Mode
(MOD) on page 89. Some of the enhanced capabilities of the High-Speed
Counters are:
• 100 kHz operation
• High-speed direct control of outputs
• 32-bit signed integer data (count range of ± 2,147,483,647)
• Programmable High and Low presets, and Overflow and Underflow
setpoints
• Automatic Interrupt processing based on accumulated count
• Run-time editable parameters (from the user control program)
High Preset
Low Preset
High-Speed Counter The HSC is comprised of 36 sub-elements. These sub-elements are either bit,
word, or long word structures that are used to provide control over the HSC
Function File Sub-Elements function, or provide HSC status information for use within the control program.
Summary Each of the sub-elements and their respective functions are described in this
chapter. A summary of the sub-elements is provided in the following table. All
examples illustrate HSC0.
High-Speed Counter Function File (HSC:0, HSC:1, HSC:2, HSC3, HSC4 or HSC5)
Sub-Element Description Address Data Format HSC Functio User Program For More
Modes(1) n Access Information
PFN - Program File Number HSC:0.PFN word (INT) 0…9 control read only 79
ER - Error Code HSC:0.ER word (INT) 0…9 status read only 79
UIX - User Interrupt Executing HSC:0/UIX bit 0…9 status read only 82
UIE - User Interrupt Enable HSC:0/UIE bit 0…9 control read/write 82
UIL - User Interrupt Lost HSC:0/UIL bit 0…9 status read/write 83
UIP - User Interrupt Pending HSC:0/UIP bit 0…9 status read only 83
FE - Function Enabled HSC:0/FE bit 0…9 control read/write 80
AS - Auto Start HSC:0/AS bit 0…9 control read only 80
ED - Error Detected HSC:0/ED bit 0…9 status read only 80
CE - Counting Enabled HSC:0/CE bit 0…9 control read/write 81
SP - Set Parameters HSC:0/SP bit 0…9 control read/write 81
LPM - Low Preset Mask HSC:0/LPM bit 2…9 control read/write 83
HPM - High Preset Mask HSC:0/HPM bit 0…9 control read/write 84
UFM - Underflow Mask HSC:0/UFM bit 2…9 control read/write 86
OFM - Overflow Mask HSC:0/OFM bit 0…9 control read/write 87
LPI - Low Preset Interrupt HSC:0/LPI bit 2…9 status read/write 84
HPI - High Preset Interrupt HSC:0/HPI bit 0…9 status read/write 85
UFI - Underflow Interrupt HSC:0/UFI bit 2…9 status read/write 86
OFI - Overflow Interrupt HSC:0/OFI bit 0…9 status read/write 87
LPR - Low Preset Reached HSC:0/LPR bit 2…9 status read only 84
HPR - High Preset Reached HSC:0/HPR bit 2…9 status read only 85
DIR - Count Direction HSC:0/DIR bit 0…9 status read only 88
UF - Underflow HSC:0/UF bit 0…9 status read/write 85
OF - Overflow HSC:0/OF bit 0…9 status read/write 87
MD - Mode Done HSC:0/MD bit 0 or 1 status read/write 88
CD - Count Down HSC:0/CD bit 2…9 status read only 88
CU - Count Up HSC:0/CU bit 0…9 status read only 88
MOD - HSC Mode HSC:0.MOD word (INT) 0…9 control read only 89
ACC - Accumulator HSC:0.ACC long word (32-bit INT) 0…9 control read/write 97
HIP - High Preset HSC:0.HIP long word (32-bit INT) 0…9 control read/write 97
LOP - Low Preset HSC:0.LOP long word (32-bit INT) 2…9 control read/write 97
OVF - Overflow HSC:0.OVF long word (32-bit INT) 0…9 control read/write 98
High-Speed Counter Function File (HSC:0, HSC:1, HSC:2, HSC3, HSC4 or HSC5)
Sub-Element Description Address Data Format HSC Functio User Program For More
Modes(1) n Access Information
UNF - Underflow HSC:0.UNF long word (32-bit INT) 2…9 control read/write 98
OMB - Output Mask Bits HSC:0.OMB word (16-bit binary) 0…9 control read only 99
HPO - High Preset Output HSC:0.HPO word (16-bit binary) 0…9 control read/write 99
LPO - Low Preset Output HSC:0.LPO word (16-bit binary) 2…9 control read/write 100
(1) For Mode descriptions, see HSC Mode (MOD) on page 89.
n/a = not applicable
The PFN (Program File Number) variable defines which subroutine is called
(executed) when HSC0 counts to High Preset or Low Preset, or through
Overflow or Underflow. The integer value of this variable defines which program
file will run at that time. A valid subroutine file is any program file (3…255).
The ERs (Error Codes) detected by the HSC sub-system are displayed in this
word. Errors include:
The FE (Function Enabled) is a status/control bit that defines when the HSC
interrupt is enabled, and that interrupts generated by the HSC are processed
based on their priority.
This bit can be controlled by the user program or is automatically set by the HSC
sub-system if auto start is enabled.
See also:Priority of User Interrupts on page 265.
The AS (Auto Start) is configured with the programming device and stored as
part of the user program. The auto start bit defines if the HSC function
automatically starts whenever the controller enters any run or test mode. The CE
(Counting Enabled) bit must also be set to enable the HSC.
The ED (Error Detected) flag is a status bit that can be used in the control
program to detect if an error is present in the HSC sub-system. The most
common type of error that this bit represents is a configuration error. When this
bit is set (1), you should look at the specific error code in parameter HSC:0.ER.
This bit is maintained by the controller and is set and cleared automatically.
This bit can be controlled by the user program and retains its value through a
power cycle. This bit must be set for the high-speed counter to operate.
The SP (Set Parameters) control bit is used to load new variables to the HSC
sub-system. When an OTE instruction with the address of HSC:0/SP is solved
true (off-to-on rung transition), all configuration variables currently stored in the
HSC function are checked and loaded into the HSC sub-system. The HSC
sub-system then operates based on those newly loaded settings.
This bit is controlled by the user program and retains its value through a power
cycle. It is up to the user program to set and clear this bit. SP can be toggled while
the HSC is running and no counts are lost.
The UIE (User Interrupt Enable) bit is used to enable or disable HSC subroutine
processing. This bit must be set (1) if the user wants the controller to process the
HSC subroutine when any of the following conditions exist:
• Low preset reached
• High preset reached
• Overflow condition - count up through the overflow value
• Underflow condition - count down through the underflow value
If this bit is cleared (0), the HSC sub-system does not automatically scan the
HSC subroutine. This bit can be controlled from the user program (using the
OTE, UIE, or UID instructions).
The UIX (User Interrupt Executing) bit is set (1) whenever the HSC sub-system
begins processing the HSC subroutine due to any of the following conditions:
• Low preset reached
• High preset reached
• Overflow condition - count up through the overflow value
• Underflow condition - count down through the underflow value
The HSC UIX bit can be used in the control program as conditional logic to
detect if an HSC interrupt is executing.
The HSC sub-system will clear (0) the UIX bit when the controller completes its
processing of the HSC subroutine.
The UIP (User Interrupt Pending) is a status flag that represents an interrupt is
pending. This status bit can be monitored or used for logic purposes in the
control program if you need to determine when a subroutine cannot be executed
immediately.
This bit is maintained by the controller and is set and cleared automatically.
The UIL (User Interrupt Lost) is a status flag that represents an interrupt has
been lost. The controller can process 1 active and maintain up to 2 pending user
interrupt conditions.
This bit is set by the controller. It is up to the control program to utilize, track if
necessary, and clear the lost condition.
The LPM (Low Preset Mask) control bit is used to enable (allow) or disable (not
allow) a low preset interrupt from occurring. If this bit is clear (0), and a Low
Preset Reached condition is detected by the HSC, the HSC user interrupt is not
executed.
This bit is controlled by the user program and retains its value through a power
cycle. It is up to the user program to set and clear this bit.
The LPI (Low Preset Interrupt) status bit is set (1) when the HSC accumulator
reaches the low preset value and the HSC interrupt has been triggered. This bit
can be used in the control program to identify that the low preset condition
caused the HSC interrupt. If the control program needs to perform any specific
control action based on the low preset, this bit would be used as conditional logic.
This bit can be cleared (0) by the control program and is also be cleared by the
HSC sub-system whenever these conditions are detected:
• High Preset Interrupt executes
• Underflow Interrupt executes
• Overflow Interrupt executes
• Controller enters an executing mode
The LPR (Low Preset Reached) status flag is set (1) by the HSC sub-system
whenever the accumulated value (HSC:0.ACC) is less than or equal to the low
preset variable (HSC:0.LOP).
This bit is updated continuously by the HSC sub-system whenever the controller
is in an executing mode.
The HPM (High Preset Mask) control bit is used to enable (allow) or disable
(not allow) a high preset interrupt from occurring. If this bit is clear (0), and a
High Preset Reached condition is detected by the HSC, the HSC user interrupt
is not executed.
This bit is controlled by the user program and retains its value through a power
cycle. It is up to the user program to set and clear this bit.
The HPI (High Preset Interrupt) status bit is set (1) when the HSC accumulator
reaches the high preset value and the HSC interrupt is triggered. This bit can be
used in the control program to identify that the high preset condition caused the
HSC interrupt. If the control program needs to perform any specific control
action based on the high preset, this bit is used as conditional logic.
This bit can be cleared (0) by the control program and is also cleared by the HSC
sub-system whenever these conditions are detected:
• Low Preset Interrupt executes
• Underflow Interrupt executes
• Overflow Interrupt executes
• Controller enters an executing mode
The HPR (High Preset Reached) status flag is set (1) by the HSC sub-system
whenever the accumulated value (HSC:0.ACC) is greater than or equal to the
high preset variable (HSC:0.HIP).
This bit is updated continuously by the HSC sub-system whenever the controller
is in an executing mode.
Underflow (UF)
Description Address Data Format HSC Modes(1) Type User Program Access
UF - Underflow HSC:0/UF bit 0…9 status read/write
(1) For Mode descriptions, see HSC Mode (MOD) on page 89.
The UF (Underflow) status flag is set (1) by the HSC sub-system whenever the
accumulated value (HSC:0.ACC) has counted through the underflow variable
(HSC:0.UNF).
This bit is transitional and is set by the HSC sub-system. It is up to the control
program to utilize, track if necessary, and clear (0) the underflow condition.
The UFM (Underflow Mask) control bit is used to enable (allow) or disable (not
allow) a underflow interrupt from occurring. If this bit is clear (0), and a
Underflow Reached condition is detected by the HSC, the HSC user interrupt is
not executed.
This bit is controlled by the user program and retains its value through a power
cycle. It is up to the user program to set and clear this bit.
The UFI (Underflow Interrupt) status bit is set (1) when the HSC accumulator
counts through the underflow value and the HSC interrupt is triggered. This bit
can be used in the control program to identify that the underflow condition
caused the HSC interrupt. If the control program needs to perform any specific
control action based on the underflow, this bit is used as conditional logic.
This bit can be cleared (0) by the control program and is also cleared by the HSC
sub-system whenever these conditions are detected:
• Low Preset Interrupt executes
• High Preset Interrupt executes
• Overflow Interrupt executes
• Controller enters an executing mode
Overflow (OF)
Description Address Data Format HSC Modes(1) Type User Program Access
OF - Overflow HSC:0/OF bit 0…9 status read/write
(1) For Mode descriptions, see HSC Mode (MOD) on page 89.
The OF (Overflow) status flag is set (1) by the HSC sub-system whenever the
accumulated value (HSC:0.ACC) has counted through the overflow variable
(HSC:0.OF).
This bit is transitional and is set by the HSC sub-system. It is up to the control
program to utilize, track if necessary, and clear (0) the overflow condition.
The OFM (Overflow Mask) control bit is used to enable (allow) or disable (not
allow) an overflow interrupt from occurring. If this bit is clear (0), and an
overflow reached condition is detected by the HSC, the HSC user interrupt is
not executed.
This bit is controlled by the user program and retains its value through a power
cycle. It is up to the user program to set and clear this bit.
The OFI (Overflow Interrupt) status bit is set (1) when the HSC accumulator
counts through the overflow value and the HSC interrupt is triggered. This bit
can be used in the control program to identify that the overflow variable caused
the HSC interrupt. If the control program needs to perform any specific control
action based on the overflow, this bit is used as conditional logic.
This bit can be cleared (0) by the control program and is also cleared by the HSC
sub-system whenever these conditions are detected:
• Low Preset Interrupt executes
• High Preset Interrupt executes
The DIR (Count Direction) status flag is controlled by the HSC sub-system.
When the HSC accumulator counts up, the direction flag is set (1). Whenever
the HSC accumulator counts down, the direction flag is cleared (0).
If the accumulated value stops, the direction bit retains its value. The only time
the direction flag changes is when the accumulated count reverses.
This bit is updated continuously by the HSC sub-system whenever the controller
is in a run mode.
The MD (Mode Done) status flag is set (1) by the HSC sub-system when the
HSC is configured for Mode 0 or Mode 1 behavior, and the accumulator counts
up to the High Preset.
The CD (Count Down) bit is used with the bidirectional counters (modes 2…9).
If the CE bit is set, the CD bit is set (1). If the CE bit is clear, the CD bit is cleared
(0).
Count Up (CU)
Description Address Data Format HSC Modes(1) Type User Program Access
CU - Count Up HSC:0/CU bit 0…9 status read only
(1) For Mode descriptions, see HSC Mode (MOD) on page 89.
The CU (Count Up) bit is used with all of the HSCs (modes 0…9). If the CE bit
is set, the CU bit is set (1). If the CE bit is clear, the CU bit is cleared (0).
The MOD (Mode) variable sets the High-Speed Counter to one of 10 types of
operation. This integer value is configured through the programming device and
is accessible in the control program as a read-only variable.
HSC0's sub counter is HSC3, HSC1's sub counter is HSC4 and HSC2's sub
counter is HSC5. Each set of counters share the input. The following table shows
the dedicated inputs for the HSCs depending on the mode.
The main high-speed counters support 10 types of operation mode and the sub
high-speed counters support 5 types (mode 0, 2, 4, 6, 8). If the main high-speed
counter is set to mode 1, 3, 5, 7 or 9, then belong the sub high-speed counter will
be disabled.
TIP Inputs I1:0.0/0 through I1:0.0/11 are available for use as inputs to
other functions regardless of the HSC being used.
TIP Inputs I1:0.0/0 through I1:0.0/11 are available for use as inputs to
other functions regardless of the HSC being used.t
TIP Inputs I1:0.0/0 through I1:0.0/11 are available for use as inputs to
other functions regardless of the HSC being used.
TIP Inputs I1:0.0/0 through I1:0.0/11 are available for use as inputs to
other functions regardless of the HSC being used.
TIP Inputs I1:0.0/0 through I1:0.0/11 are available for use as inputs to
other functions regardless of the HSC being used.
HSC Mode 5 - Two Input Counter (up and down) with External Reset and Hold
TIP Inputs I1:0.0/0 through I1:0.0/11 are available for use as inputs to
other functions regardless of the HSC being used.
The counter can be reset using the Z input. The Z outputs from the encoders
typically provide one pulse per revolution.
Input 0
A
Input 1
B
Quadrature Encoder Input 2
Z
(Reset input)
Forward Rotation Reverse Rotation
B
1 2 3 2 1
Count
TIP Inputs I1:0.0/0 through I1:0.0/11 are available for use as inputs to
other functions regardless of the HSC being used.
TIP Inputs I1:0.0/0 through I1:0.0/11 are available for use as inputs
to other functions regardless of the HSC being used.
Accumulator (ACC)
Description Address Data Format Type User Program Access
ACC - Accumulator HSC:0.ACC long word (32-bit INT) control read/write
The ACC (Accumulator) contains the number of counts detected by the HSC
sub-system. If either mode 0 or mode 1 is configured, the value of the software
accumulator is cleared (0) when a high preset is reached or when an overflow
condition is detected.
The HIP (High Preset) is the upper setpoint (in counts) that defines when the
HSC sub-system generates an interrupt. To load data into the high preset, the
control program must do one of the following:
• Toggle (low to high) the Set Parameters (HSC:0/SP) control bit. When
the SP bit is toggled high, the data currently stored in the HSC function
file is transferred/loaded into the HSC sub-system.
• Load new HSC parameters using the HSL instruction. See HSL -
High-Speed Counter Load on page 101.
The data loaded into the high preset must be less than or equal to the data
resident in the overflow (HSC:0.OVF) parameter or an HSC error is generated.
The LOP (Low Preset) is the lower setpoint (in counts) that defines when the
HSC sub-system generates an interrupt. To load data into the low preset, the
control program must do one of the following:
• Toggle (low to high) the Set Parameters (HSC:0/SP) control bit. When
the SP bit is toggled high, the data currently stored in the HSC function
file is transferred/loaded into the HSC sub-system.
• Load new HSC parameters using the HSL instruction. See HSL -
High-Speed Counter Load on page 101.
The data loaded into the low preset must greater than or equal to the data
resident in the underflow (HSC:0.UNF) parameter, or an HSC error is
generated. (If the underflow and low preset values are negative numbers, the low
preset must be a number with a smaller absolute value.)
Overflow (OVF)
Description Address Data Format Type User Program Access
OVF - Overflow HSC:0.OVF long word (32-bit INT) control read/write
The OVF (Overflow) defines the upper count limit for the counter. If the
counter’s accumulated value increments past the value specified in this variable,
an overflow interrupt is generated. When the overflow interrupt is generated, the
HSC sub-system rolls the accumulator over to the underflow value and the
counter continues counting from the underflow value (counts are not lost in this
transition). The user can specify any value for the overflow position, provided it is
greater than the underflow value and falls between -2,147,483,648 and
2,147,483,647.
To load data into the overflow variable, the control program must toggle (low to
high) the Set Parameters (HSC:0.0/SP) control bit. When the SP bit is toggled
high, the data currently stored in the HSC function file is transferred/loaded into
the HSC sub-system.
TIP Data loaded into the overflow variable must be greater than or equal
to the data resident in the high preset (HSC:0.HIP) or an HSC error is
generated.
Underflow (UNF)
Description Address Data Format Type User Program Access
UNF - Underflow HSC:0.UNF long word (32-bit INT) control read/write
The UNF (Underflow) defines the lower count limit for the counter. If the
counter’s accumulated value decrements past the value specified in this variable,
an underflow interrupt is generated. When the underflow interrupt is generated,
the HSC sub-system resets the accumulated value to the overflow value and the
counter then begins counting from the overflow value (counts are not lost in this
transition). The user can specify any value for the underflow position, provided it
is less than the overflow value and falls between -2,147,483,648 and
2,147,483,647.
To load data into the underflow variable, the control program must toggle (low to
high) the Set Parameters (HSC:0.0/SP) control bit. When the SP bit is toggled
high, the data currently stored in the HSC function file is transferred/loaded into
the HSC sub-system.
TIP Data loaded into the underflow variable must be less than or
equal to the data resident in the low preset (HSC:0.LOP) or an
HSC error is generated.
The OMB (Output Mask Bits) define which outputs on the controller can be
directly controlled by the high-speed counter. The HSC sub-system has the
ability to directly (without control program interaction) turn outputs ON or
OFF based on the HSC accumulator reaching the High or Low presets. The bit
pattern stored in the OMB variable defines which outputs are controlled by the
HSC and which outputs are not controlled by the HSC.
The bit pattern of the OMB variable directly corresponds to the output bits on
the controller. Bits that are set (1) are enabled and can be turned on or off by the
HSC sub-system. Bits that are clear (0) cannot be turned on or off by the HSC
sub-system. The mask bit pattern can be configured only during initial setup.
O0:0.0 0 1 0 1 0 1
The outputs shown in the black boxes are the outputs under the control of the
HSC sub-system. The mask defines which outputs can be controlled. The high
preset output or low preset output values (HPO or LPO) define if each output is
either ON (1) or OFF (0). Another way to view this is that the high or low preset
output is written through the output mask, with the output mask acting like a
filter.
The bits in the gray boxes are unused. The first 6 bits of the mask word are used
and the remaining mask bits are not functional because they do not correlate to
any physical outputs on the base unit.
The mask bit pattern can be configured only during initial setup.
The HPO (High Preset Output) defines the state (1 = ON or 0 = OFF) of the
outputs on the controller when the high preset is reached. See Output Mask Bits
(OMB) on page 99 for more information on how to directly turn outputs on or
off based on the high preset being reached.
The high output bit pattern can be configured during initial setup, or while the
controller is operating. Use the HSL instruction or the SP bit to load the new
parameters while the controller is operating.
The LPO (Low Preset Output) defines the state (1 = “on”, 0 = “off ”) of the
outputs on the controller when the low preset is reached. See Output Mask Bits
(OMB) on page 99 for more information on how to directly turn outputs on or
off based on the low preset being reached.
The low output bit pattern can be configured during initial setup, or while the
controller is operating. Use the HSL instruction or the SP bit to load the new
parameters while the controller is operating.
The HSL (High-Speed Load) instruction allows the high and low presets, and
high and low output source to be applied to a high-speed counter. These
parameters are described below:
• Counter Number - Specifies which high-speed counter is being used; 0 =
HSC0, 1 = HSC1, 2 = HSC2, 3 = HSC3, 4 = HSC4 and 5 = HSC5
• High Preset - Specifies the value in the high preset register. The data ranges
for the high preset are -32768…32767 (word) and
-2,147,483,648…2,147,483,647 (long word).
• Low Preset - Specifies the value in the low preset register. The data ranges
for the low preset are -32768…32767 (word) and
-2,147,483,648…2,147,483,647 (long word).
• Output High Source - Specifies the value in the HPO - high preset output
register. The data range for the output high source is from 0…65,535.
• Output Low Source - Specifies the value in the LPO - low preset output
register. The data range for the output low source is from 0…65,535.
Address
Data Files Function Files Address Level
Mode
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Counter
• •
Number
High Preset • • • • • • • • • • • •
Low Preset • • • • • • • • • • • •
Output High
• • • • • • • • • • • •
Source
Output Low
• • • • • • • • • • • •
Source
The RAC instruction resets the high-speed counter and allows a specific value to
be written to the HSC accumulator. The RAC instruction uses the following
parameters:
• Counter Number - Specifies which high-speed counter is being used:
– Counter Number 0 = HSC0, 1 = HSC1, 2 = HSC2, 3 = HSC3, 4 =
HSC4, 5 = HSC5
• Source - Specifies the location of the data to be loaded into the HSC
accumulator. The data range is from -2,147,483,648…2,147,483,647.
Address
Data Files Function Files Address Level
Mode
CSF - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Counter
•
Number
Source • • • • •
Programmable Limit Switch The Programmable Limit Switch function allows you to configure the
High-Speed Counter to operate as a PLS (programmable limit switch) or rotary
(PLS) File cam switch.
When PLS operation is enabled, the HSC (High-Speed Counter) uses a PLS data
file for limit/cam positions. Each limit/cam position has corresponding data
parameters that are used to set or clear physical outputs on the controller’s base
unit. The PLS data file is illustrated below.
IMPORTANT The PLS Function only operates in tandem with the HSC of a
MicroLogix 1400. To use the PLS function, an HSC must first be
configured.
Data files 9…255 can be used for PLS operations. Each PLS data file can be up to
256 elements long. Each element within a PLS file consumes 6 user words of
memory. The PLS data file is shown below:
PLS Operation
When the PLS function is enabled, and the controller is in the run mode, the
HSC will count incoming pulses. When the count reaches the first preset (High -
HIP or Low - LOP) defined in the PLS file, the output source data (High - OHD
or Low - OLD) will be written through the HSC mask.
At that point, the next preset (High - HIP or Low - LOP) defined in the PLS file
becomes active.
When the HSC counts to that new preset, the new output data is written
through the HSC mask. This process continues until the last element within the
PLS file is loaded. At that point the active element within the PLS file is reset to
zero. This behavior is referred to as circular operation.
TIP The Output High Data (OHD) is only written when the High preset
(HIP) is reached. The Output Low Data (OLD) is written when the
low preset is reached.
TIP Output High Data is only operational when the counter is counting
up. Output Low Data is only operational when the counter is
counting down.
If invalid data is loaded during operation, an HSC error is generated (within the
HSC function file). The error will not cause a controller fault. If an invalid
parameter is detected, it will be skipped and the next parameter will be loaded for
execution (provided it is valid).
You can use the PLS in Up (high), Down (low), or both directions. If your
application only counts in one direction, simply ignore the other parameters.
The PLS function can operate with all of the other HSC capabilities. The ability
to select which HSC events generate a user interrupt are not limited.
Format Explanation
PLSf:e.s PLS Programmable Limit Switch file
f File number The valid file number range is from 9…255.
: Element delimiter
e Element number The valid element number range is from 0…255.
. Sub-Element delimiter
s Sub-Element number The valid sub-element number range is from 0…5
Examples: PLS10:2 PLS File 10, Element 2
PLS12:36.5 PLS File 12, Element 36, Sub-Element 5 (Output Low Source)
PLS Example
3. Enter a file number (9…255) and select Programmable Limit Switch as the
type. A Name and/or Description may be entered as well, but is not
required.
4. Elements refers to the number of PLS steps. For this example enter a value
of 4.
If more steps are required at a later time, simply go to the properties for the
PLS data file and increase the number of elements.
5. Under Data Files, PLS10 should appear as shown here:
6. Double-click on PLS10 under Data Files. For this example, enter the
values as illustrated below.
Once the values above have been entered for HIP and OHD, the PLS is
configured.
When the ladder logic first runs, HSC.ACC equals 0, therefore PLS10:0.OLD's
data is sent through the HSC.OMB mask and sets all the outputs off.
This will repeat as the HSC.ACC reaches 500, 750, and 1000. Once completed,
the cycle resets and repeats.
The high-speed output instructions allow you to control and monitor the PTO
and PWM functions which control the physical high-speed outputs.
Instruction Used To: Page
PTO - Pulse Train Output Generate stepper pulses 109
PWM - Pulse Width Modulation Generate PWM output 126
IMPORTANT The PTO instruction should only be used with MicroLogix 1400 BXB or
BXBA units. Relay outputs are not capable of performing very
high-speed operations.
Pulse Train Output Function The MicroLogix 1400 1766-L32BXB and 1766-L32BXBA controller supports
three high-speed outputs. These outputs can be used as standard outputs (not
high-speed) or individually configured for PTO or PWM operation. The PTO
functionality allows a simple motion profile or pulse profile to be generated
directly from the controller. The pulse profile has three primary components:
• Total number of pulses to be generated
• Accelerate/decelerate intervals
• Run interval
The PTO instruction, along with the HSC and PWM functions, are different
than most other controller instructions. Their operation is performed by custom
circuitry that runs in parallel with the main system processor. This is necessary
because of the high performance requirements of these functions.
Within the PTOX function file, there are PTO element(s). An element can be set
to control either output 2 (O0:0/2 on 1766-L32BXB or 1766-L32BXBA),
output 3 (O0:0/3 on 1766-L32BXB or 1766-L32BXBA) or output 4 (O0:0/4
on 1766-L32BXB or 1766-L32BXBA)
While the PTO instruction is being executed, status bits and information are
updated as the main controller continues to operate. Because the PTO
instruction is actually being executed by a parallel system, status bits and other
information are updated each time the PTO instruction is scanned while it is
running. This provides the control program access to PTO status while it is
running.
TIP PTO status is only as fresh as the scan time of the controller. Worst
case latency is the same as the maximum scan of the controller. This
condition can be minimized by placing a PTO instruction in the STI
(selectable timed interrupt) file, or by adding PTO instructions to your
program to increase how often a PTO instruction is scanned.
The charts in the following examples illustrate the typical timing sequence/
behavior of a PTO instruction. The stages listed in each chart have nothing to do
with controller scan time. They simply illustrate a sequence of events. In actuality,
the controller may have hundreds or thousands of scans within each of the stages
illustrated in the examples.
In this example, the rung state is a momentary or transitional type of input. This
means that the false-to-true rung transition enables the PTO instruction and
then returns to a false state prior to the PTO instruction completing its
operation.
If a transitional input to the PTO instruction is used, the Done (DN) bit turns
on when the instruction completes, but only remains on until the next time the
PTO instruction is scanned in the user program. The structure of the control
program determines when the DN bit goes off. So, to detect when the PTO
instruction completes its output, you can monitor the Done (DN), Idle (ID), or
Normal Operation (NO) status bits.
Stage 0 1 2 3 4 5 6 7 8 9 10 11 12
Rung State
Accelerate Status/AS
Run Status/RS
Decelerate Status/DS
Enable/EN
Done/DN
Idle/ID
Jog Pulse/JP
In this example, the rung state is a maintained type of input. This means that it
enables the PTO instruction Normal Operation (NO) and maintains its logic
state until after the PTO instruction completes its operation. With this type of
logic, status bit behavior is as follows:
The Done (DN) bit becomes true (1) when the PTO completes and remains set
until the PTO rung logic is false. The false rung logic re-activates the PTO
instruction. To detect when the PTO instruction completes its output, monitor
the done (DN) bit.
Stage 0 1 2 3 4 5 6 7 8 9 10 11 12
Rung State
Enable /EN
Done /DN
Idle /ID
Pulse Train Outputs (PTOX) Within the RSLogix 500/RSLogix Micro Function File Folder, you see a PTOX
Function File with three elements. These elements provide access to PTO
Function File configuration data and also allow the control program access to all information
pertaining to each of the Pulse Train Outputs.
TIP If the controller mode is run, the data within sub-element fields may
be changing.
Pulse Train Output Function The variables within each PTOX sub-element, along with what type of behavior
and access the control program has to those variables, are listed individually
File Sub-Elements below. All examples illustrate PTOX:0. Terms and behavior for PTOX:1 and
Summary PTOX:2 are identical.
OPP - Output Pulses Produced PTOX:0.OPP long word 0…2,147,483,647 status read only 120
(32-bit INT)
ADP - Accel/Decel Pulses PTOX:0.ADP long word see p. 121 control read/write 121
(32-bit INT)
The PTOX OUT (Output) variable defines the output (O0:0/2, O0:0/3 or or
O0:0/4) that the PTOX instruction controls. This variable is set within the
function file folder when the control program is written and cannot be set by the
user program.
• When OUT = 2, PTOX pulses output 2 (O0:0.0/2) of the embedded
outputs.
• When OUT = 3, PTOX pulses output 3 (O0:0.0/3) of the embedded
outputs
• When OUT = 4, PTOX pulses output 4 (O0:0.0/4) of the embedded
outputs.
The PTOX DN (Done) bit is controlled by the PTOX sub-system. It can be used
by an input instruction on any rung within the control program. The DN bit
operates as follows:
• Set (1) - Whenever a PTOX instruction has completed its operation
successfully.
• Cleared (0) - When the rung the PTOX is on is false. If the rung is false
when the PTOX instruction completes, the Done bit is set until the next
scan of the PTOX instruction.
The PTOX DS (Decel) bit is controlled by the PTOX sub-system. It can be used
by an input instruction on any rung within the control program. The DS bit
operates as follows:
• Set (1) – Whenever a PTO instruction is within the deceleration phase of
the output profile.
• Cleared (0) – Whenever a PTOX instruction is not within the
deceleration phase of the output profile.
The PTOX RS (Run Status) bit is controlled by the PTOX sub-system. It can be
used by an input instruction on any rung within the control program. The RS bit
operates as follows:
• Set (1) – Whenever a PTOX instruction is within the run phase of the
output profile.
• Cleared (0) – Whenever a PTOX instruction is not within the run phase
of the output profile.
The PTOX RP (Ramp Profile) bit controls how the output pulses generated by
the PTOX sub-system accelerate to and decelerate from the Output Frequency
that is set in the PTOX function file (PTOX:0.OF). It can be used by an input or
output instruction on any rung within the control program. The RP bit operates
as follows:
• Set (1) – Configures the PTOX instruction to produce an S-Curve profile.
• Cleared (0) – Configures the PTOX instruction to produce a Trapezoid
profile.
The PTOX IS (Idle Status) is controlled by the PTOX sub-system. It can be used
in the control program by an input instruction. The PTOX sub-system must be
in an idle state whenever any PTOX operation needs to start.
The PTOX EH (Enable Hard Stop) bit is used to stop the PTOX sub-system
immediately. Once the PTOX sub-system starts a pulse sequence, the only way to
stop generating pulses is to set the enable hard stop bit. The enable hard stop
aborts any PTOX sub-system operation (idle, normal, jog continuous or jog
pulse) and generates a PTOX sub-system error. The EH bit operates as follows:
• Set (1) – Instructs the PTOX sub-system to stop generating pulses
immediately (output off = 0)
• Cleared (0) – Normal operation
The PTOX OF (Output Frequency) variable defines the frequency of the PTOX
output during the RUN phase of the pulse profile. This value is typically
determined by the type of device that is being driven, the mechanics of the
application, or the device/components being moved. In the MicroLogix 1400
controller, the data less than zero or greater than 100,000 generates a PTOX
error.
TIP The value displayed may not exactly match the value entered in the
PTOX:0.OF. This is because the PTOX sub-system may not be
capable of reproducing an exact frequency at some of the higher
frequencies. For PTOX applications, this is typically not an issue
because, in all cases, an exact number of pulses are produced.
The PTOX TOP (Total Output Pulses) defines the total number of pulses to be
generated for the pulse profile (accel/run/decel inclusive).
The PTOX ADI (Accel/Decel Pulses Independent) bit is used to define whether
the acceleration and deceleration intervals will be the same, or if each will have a
unique value. When this bit is set (1), separate profiles are used. When this bit is
clear (0), the PTOX will operate with the deceleration profile as a mirror of the
acceleration profile.
If separate acceleration and deceleration profiles are desired, you must choose a
long integer file number and a starting element. There must be four long elements
available in the file:
The choice of selecting a common profile or separate profiles must be made at the
time of programming. This cannot be changed once the program is downloaded
into the controller. The selection of the ramp type must be made prior to going to
run. The acceleration and deceleration counts must be entered before the PTOX
is enabled. If the four long elements are not properly identified, the controller will
return a -3 error in the PTOX function file when going to run.
The PTOX ADP (Accel/Decel Pulses) defines how many of the total pulses
(TOP variable) will be applied to each of the ACCEL and DECEL components.
The ADP will determine the acceleration and deceleration rate from 0 to the
PTOX Output Frequency (OF). The PTOX Output Frequency (OF) defines
the operating frequency in pulses/second during the run portion of the profile.
TIP When entering the ADP parameters, the PTOX will generate an Accel/
Decel Error if one of the following conditions occur:
· The PTOX ADP for accel and/or decel is negative.
· The total pulses for the acceleration and deceleration phases is
greater than the total output pulses to be generated (TOP).
Acceleration and deceleration values can either be identical (ADI = 0),
or a unique value for each (ADI = 1).
12,000
Accel Run Decel
6,000 0 6,000
In this example, the maximum value that could be used for accelerate/decelerate
is 6000, because if both accelerate and decelerate are 6000, the total number of
pulses = 12,000. The run component would be zero. This profile would consist
of an acceleration phase from 0…6000. At 6000, the output frequency (OF
variable) is generated and immediately enters the deceleration phase,
The following formulas can be used to calculate the maximum value that could be
used for accelerate/decelerate for both profiles. The maximum pulses of accel/
decel = the integer which is less than or equal to the result found below (OF =
output frequency):
• For Trapezoid Profiles: [OF x (OF/4)] + 0.5
• For S-Curve Profiles: 0.999 x OF x SQRT(OF/6)
Controlled
Stop (CS) Set
If the CS bit is set during the accel phase, the accel phase completes and the
PTOX immediately enters the decel phase.
Controlled
Stop (CS) Set
Accel Decel
The PTOX JF ( Jog Frequency) variable defines the frequency of the PTOX
output during all Jog phases. This value is typically determined by the type of
device that is being driven, the mechanics of the application, or the device/
components being moved. In the MicroLogix 1400 controller, the data less than
zero or greater than 100,000 generates a PTOX error.
The PTOX JP ( Jog Pulse) bit is used to instruct the PTOX sub-system to
generate a single pulse. The width is defined by the Jog Frequency parameter in
the PTOX function file. Jog Pulse operation is only possible under the following
conditions:
• PTOX sub-system in idle
• Jog continuous not active
• Enable not active
The PTOX JPS ( Jog Pulse Status) bit is controlled by the PTOX sub-system. It
can be used by an input instruction on any rung within the control program to
detect when the PTOX has generated a Jog Pulse.
TIP The output (jog) pulse is normally complete with the JP bit set. The
JPS bit remains set until the JP bit is cleared (0 = off).
The PTOX JC ( Jog Continuous) bit instructs the PTOX sub-system to generate
continuous pulses. The frequency generated is defined by the Jog Frequency
parameter in the PTOX function file. Jog Continuous operation is only possible
under the following conditions:
• PTOX sub-system in idle
• Jog Pulse not active
• Enable not active
When the Jog Continuous bit is cleared, the current output pulse is truncated.
The PTOX JCS ( Jog Continuous Status) bit is controlled by the PTOX
sub-system. It can be used by an input instruction on any rung within the control
program to detect when the PTOX is generating continuous Jog Pulses. The JCS
bit operates as follows:
• Set (1) – Whenever a PTOX instruction is generating continuous Jog
Pulses
• Cleared (0) – Whenever a PTOX instruction is not generating continuous
Jog Pulses.
PTOX ER (Error Codes) detected by the PTOX sub-system are displayed in this
register. The error codes are shown in the table below:
IMPORTANT The PWM instruction should only be used with MicroLogix 1400
BXB or BXBA unit. Relay outputs are not capable of performing very
high-speed operations.
PWM Function The PWM function allows a field device to be controlled by a PWM wave form.
The PWM profile has two primary components:
• Frequency to be generated
• Duty Cycle interval
The PWM instruction, along with the HSC and PTO functions, are different
than all other controller instructions. Their operation is performed by custom
circuitry that runs in parallel with the main system processor. This is necessary
because of the high performance requirements of these instructions.
While the PWM instruction is being executed, status bits and data are updated as
the main controller continues to operate. Because the PWM instruction is
actually being executed by a parallel system, the status bits and other information
are updated each time the PWM instruction is scanned while it is running. This
provides the control program access to PWM status while it is running.
TIP PWM status is only as fresh as the scan time of the controller. Worst case
latency is the maximum scan of the controller. This condition can be
minimized by placing a PWM instruction in the STI (selectable timed
interrupt) file, or by adding PWM instructions to your program to increase
how often a PWM instruction is scanned.
Pulse Width Modulation Within the PWM function file are three PWM elements. Each element can be set
to control either output 2 (O0:0/2), output 3 (O0:0/3), or output 4 (O0:0/4).
(PWMX) Function File Function file element PWMX:0 is shown below.
Pulse Width Modulated The variables within each PWMX element, along with what type of behavior and
access the control program has to those variables, are listed individually below.
Function File Elements
Summary
PWM Function File Elements
Element Description Address Data Format Range Type User Program For More
Access Information
OUT - PWMX Output PWMX:0.OUT word (INT) 2…4 status read only 129
DS - Decelerating Status PWMX:0/DS bit 0 or 1 status read only 129
RS - PWMX Run Status PWMX:0/RS bit 0 or 1 status read only 129
AS - Accelerating Status PWMX:0/AS bit 0 or 1 status read only 130
PP - Profile Parameter Select PWMX:0/PP bit 0 or 1 control read/write 130
IS - PWMX Idle Status PWMX:0/IS bit 0 or 1 status read only 130
ED - PWMX Error Detection PWMX:0/ED bit 0 or 1 status read only 131
NS - PWMX Normal Operation PWMX:0/NS bit 0 or 1 status read only 131
EH - PWMX Enable Hard Stop PWMX:0/EH bit 0 or 1 control read/write 131
ES - PWMX Enable Status PWMX:0/ES bit 0 or 1 status read only 131
OF - PWMX Output Frequency PWMX:0.OF long word 0…40,000 control read/write 132
(32-bit INT)
OFS - PWMX Operating Frequency Status PWMX:0.OFS long word 0…40,000 status read only 132
(32-bit INT)
DC - PWMX Duty Cycle PWMX:0.DC word (INT) 1…1000 control read/write 132
DCS - PWMX Duty Cycle Status PWMX:0.DCS word (INT) 1…1000 status read only 133
ADD - Accel/Decel Delay PWMX:0.ADD word (INT) 0…32,767 control read/write 133
ER - PWMX Error Codes PWMX:0.ER word (INT) -2…5 status read only 133
The PWMX OUT (Output) variable defines the physical output that the
PWMX instruction controls. This variable is set within the function file folder
when the control program is written and cannot be set by the user program. The
outputs are defined as O0:0/2, O0:0/3 or O0:0/4 as listed below:
• O0:0.0/2: PWMX modulates output 2 of the embedded outputs.
• O0:0.0/3: PWMX modulates output 3 of the embedded outputs.
• O0:0.0/4: PWMX modulates output 4 of the embedded outputs.
The PWMX RS (Run Status) bit is controlled by the PWMX sub-system. It can
be used by an input instruction on any rung within the control program.
• Set (1) - Whenever the PWMX instruction is within the run phase of the
output profile.
• Cleared (0) - Whenever the PWMX instruction is not within the run
phase of the output profile.
The PWMX PP bit cannot be modified while the PWMX output is running/
enabled. See PWMX ADD on page 133 for more information.
The PWMX EH (Enable Hard Stop) bit stops the PWMX sub-system
immediately. A PWMX hard stop generates a PWMX sub-system error.
• Set (1) – Instructs the PWMX sub-system to stop its output modulation
immediately (output off = 0).
• Cleared (0) – Normal operation.
instruction is enabled, and the enable status bit is set. When the rung preceding
the PWMX instruction transitions to a false state, the enable status bit is reset (0)
immediately.
• Set (1) – PWMX is enabled.
• Cleared (0) – PWMX has completed or the rung preceding the PWMX is
false.
The PWMX DC (Duty Cycle) variable controls the output signal produced by
the PWMX sub-system. Changing this variable in the control program changes
the output waveform. Typical values and output waveform:
• DC = 1000: 100% Output ON (constant, no waveform)
• DC = 750: 75% Output ON, 25% output OFF
• DC = 500: 50% Output ON, 50% output OFF
• DC = 250: 25% Output ON, 75% output OFF
• DC = 0: 0% Output OFF (constant, no waveform)
The PWMX DCS (Duty Cycle Status) provides feedback from the PWMX
sub-system. The Duty Cycle Status variable can be used within an input
instruction on a rung of logic to provide PWMX system status to the remaining
control program.
The PWMX ADD value is loaded and activated immediately (whenever the
PWMX instruction is scanned on a true rung of logic). This allows multiple steps
or stages of acceleration or deceleration to occur.
Use relay-type (bit) instructions to monitor and/or control bits in a data file or
function file, such as input bits or timer control-word bits. The following
instructions are described in this chapter:
These instructions operate on a single bit of data. During operation, the processor
may set or reset the bit, based on logical continuity of ladder rungs. You can
address a bit as many times as your program requires.
Use the XIC instruction to determine if the addressed bit is on. Use the XIO
instruction to determine if the addressed bit is off.
When used on a rung, the bit address being examined can correspond to the
status of real world input devices connected to the base unit or expansion I/O, or
internal addresses (data or function files). Examples of devices that turn on or off:
• a push button wired to an input (addressed as I1:0/4)
• an output wired to a pilot light (addressed as O0:0/2)
• a timer controlling a light (addressed as T4:3/DN)
• a bit in the bit file (addressed as B3/16)
Addressing Modes and File Types can be used as shown in the following table:
XIC and XIO Instructions Valid Addressing Modes and File Types
For definitions of the terms used in this table see Using the Instruction Descriptions on page 68.
Address
Data Files Function Files(1) Address Level
Mode(2)
DLS - Data Log
PTOX, PWMX
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Operand Bit • • • • • • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, LCD, and DLS files.
Use an OTE instruction to turn a bit location on when rung conditions are
evaluated as true and off when the rung is evaluated as false. An example of a
device that turns on or off is an output wired to a pilot light (addressed as O0:0/
4). OTE instructions are reset (turned OFF) when:
• You enter or return to the program or remote program mode or power is
restored.
• The OTE is programmed within an inactive or false Master Control Reset
(MCR) zone.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files(1) Address Level
Mode(2)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Destination Bit • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, LCD, CS, IOS, and DLS files.
The OTL and OTU instructions are retentive output instructions. OTL turns on
a bit, while OTU turns off a bit. These instructions are usually used in pairs, with
both instructions addressing the same bit.
Since these are latching outputs, once set (or reset), they remain set (or reset)
regardless of the rung condition.
Addressing Modes and File Types can be used as shown in the following table:
OTL and OTU Instructions Valid Addressing Modes and File Types
For definitions of the terms used in this table see Using the Instruction Descriptions on page 68.
Address
Data Files Function Files(1) Address Level
Mode(2)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Operand Bit • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, LCD, and DLS files.
TIP The ONS instruction for the MicroLogix 1400 provides the same
functionality as the OSR instruction for the MicroLogix 1000 and
SLC 500 controllers.
The ONS Storage Bit is the bit address that remembers the rung state from the
previous scan. This bit is used to remember the false-to-true rung transition.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Storage Bit • • • •
OSF
OSF True False True False
One Shot Falling
Storage Bit B3:0/0 MicroLogix 1400 1.3766 µs 1.3724 µs 1.3672 µs 2.0952 µs
Output Bit B3:0/1
TIP The OSR instruction for the MicroLogix 1400 does not provide the same
functionality as the OSR instruction for the MicroLogix 1000 and SLC 500
controllers. For the same functionality as the OSR instruction for the
MicroLogix 1000 and SLC 500 controllers, use the ONS instruction.
Use the OSR and OSF instructions to trigger an event to occur one time. These
instructions trigger an event based on a change of rung state, as follows:
• Use the OSR instruction when an event must start based on the
false-to-true (rising edge) change of state of the rung.
• Use the OSF instruction when an event must start based on the
true-to-false (falling edge) change of state of the rung.
These instructions use two parameters, Storage Bit and Output Bit.
• Storage Bit - This is the bit address that remembers the rung state from the
previous scan.
• Output Bit - This is the bit address which is set based on a false-to-true
(OSR) or true-to-false (OSF) rung transition. The Output Bit is set for
one program scan.
To re-activate the OSR, the rung must become false. To re-activate the OSF, the
rung must become true.
Addressing Modes and File Types can be used as shown in the following table:
OSR and OSF Instructions Valid Addressing Modes and File Types
For definitions of the terms used in this table see Using the Instruction Descriptions on page 68.
Address
Data Files Function Files Address Level
Mode
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Storage Bit • • • •
Output Bit • • • • • • • •
Notes:
Timers and counters are output instructions that let you control operations based
on time or a number of events. The following Timer and Counter Instructions
are described in this chapter:
For information on using the High-Speed Counter output(s), see Using the
High-Speed Counter and Programmable Limit Switch on page 75.
Timer Instructions Timers in a controller reside in a timer file. A timer file can be assigned as any
unused data file. When a data file is used as a timer file, each timer element within
Overview the file has three sub-elements. These sub-elements are:
• Timer Control and Status
• Preset - This is the value that the timer must reach before the timer times
out. When the accumulator reaches this value, the DN status bit is set
(TON and RTO only). The preset data range is from 0…32767. The
minimum required update interval is 2.55 seconds regardless of the time
base.
• Accumulator - The accumulator counts the time base intervals. It
represents elapsed time. The accumulator data range is from 0…32767.
Each timer address is made of a 3-word element. Word 0 is the control and status
word, word 1 stores the preset value, and word 2 stores the accumulated value.
Timer File
Word Bit
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN TT DN Internal Use
Word 1 Preset Value
Word 2 Accumulated Value
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files(1) Function Files
Mode
Address Level
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Timer • • •
Time Base • •
Preset • •
Accumulator • •
TIP Use an RES instruction to reset a timer’s accumulator and status bits.
Timer Accuracy
Timer accuracy refers to the length of time between the moment a timer
instruction is enabled and the moment the timed interval is complete.
Timer Accuracy
Time Base Accuracy
0.001 seconds -0.001…0.00
0.01 seconds -0.01…0.00
1.00 seconds -1.00…0.00
If your program scan can exceed 2.5 seconds, repeat the timer instruction on a
different rung (identical logic) in a different area of the ladder code so that the
rung is scanned within these limits.
Using the enable bit (EN) of a timer is an easy way to repeat its complex
conditional logic at another rung in your ladder program.
TIP Timing could be inaccurate if Jump (JMP), Label (LBL), Jump to Subroutine
(JSR), or Subroutine (SBR) instructions skip over the rung containing a timer
instruction while the timer is timing. If the skip duration is within 2.5
seconds, no time is lost; if the skip duration exceeds 2.5 seconds, an
undetectable timing error occurs. When using subroutines, a timer must be
scanned at least every 2.5 seconds to prevent a timing error.
Use the TON instruction to delay turning on an output. The TON instruction
begins to count time base intervals when rung conditions become true. As long as
rung conditions remain true, the timer increments its accumulator until the
preset value is reached. When the accumulator equals the preset, timing stops.
The accumulator is reset (0) when rung conditions go false, regardless of whether
the timer has timed out. TON timers are reset on power cycles and mode
changes.
Timer Control and Status Bits, Timer Word 0 (Data File 4 is configured as a timer file for this example.)
Bit Is Set When: And Remains Set Until One of the Following
Occurs:
bit 13 - T4:0/DN DN - timer done accumulated value ≥ preset value rung state goes false
bit 14 - T4:0/TT TT - timer timing rung state is true and accumulated value < • rung state goes false
preset value
• DN bit is set
bit15 - T4:0/EN EN - timer enable rung state is true rung state goes false
Use the TOF instruction to delay turning off an output. The TOF instruction
begins to count time base intervals when rung conditions become false. As long as
rung conditions remain false, the timer increments its accumulator until the
preset value is reached.
The accumulator is reset (0) when rung conditions go true, regardless of whether
the timer is timed out. TOF timers are reset on power cycles and mode changes.
Timer Control and Status Bits, Timer Word 0 (Data File 4 is configured as a timer file for this example.)
Bit Is Set When: And Remains Set Until One of the Following
Occurs:
bit 13 - T4:0/DN DN - timer done rung conditions are true rung conditions go false and the accumulated
value is greater than or equal to the preset value
bit 14 - T4:0/TT TT - timer timing rung conditions are false and accumulated value is rung conditions go true or when the done bit is
less than the preset value reset
bit15 - T4:0/EN EN - timer enable rung conditions are true rung conditions go false
Use the RTO instruction to delay turning “on” an output. The RTO begins to
count time base intervals when the rung conditions become true. As long as the
rung conditions remain true, the timer increments its accumulator until the
preset value is reached.
The RTO retains the accumulated value when the following occur:
• rung conditions become false
• you change the controller mode from run or test to program
• the processor loses power
• a fault occurs
When you return the controller to the RUN or TEST mode, and/or the rung
conditions go true, timing continues from the retained accumulated value. RTO
timers are retained through power cycles and mode changes.
To reset the accumulator of a retentive timer, use an RES instruction. See RES -
Reset on page 152.
How Counters Work The figure below demonstrates how a counter works. The count value must
remain in the range of -32,768…+32,767. If the count value goes above +32,767,
the counter status overflow bit (OV) is set (1). If the count goes below -32,768,
the counter status underflow bit (UN) is set (1). A reset (RES) instruction is used
to reset (0) the counter.
-32,768 0 +32,767
Count Up
Count Down
Underflow Overflow
Word Bit
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 CU CD D OV U Not Used
N N
Word 1 Preset Value
Word 2 Accumulated Value
TIP The counter continues to count when the accumulator is greater than the
CTU preset and when the accumulator is less than the CTD preset.
Addressing Modes and File Types can be used as shown in the following table:
CTD and CTU Instructions Valid Addressing Modes and File Types
For definitions of the terms used in this table see Using the Instruction Descriptions on page 68.
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Counter • • •
Preset • •
Accumulator • •
Like the accumulated value, the counter status bits are also retentive until reset, as
described below.
CTU - Count Up
CTD - Count Down
Instruction Type: output
CTU
CTU
Count Up CU
Counter C5:0 Execution Time for the CTU and CTD Instructions
Preset 0< DN
Accum 0< Controller CTU - When Rung Is: CTD - When Rung Is:
True False True False
CTU
CTD
Count Down CU MicroLogix 1400 0.4849 µs 0.3812 µs 0.4350 µs 0.3803 µs
Counter C5:0
Preset 0< DN
Accum 0< The CTU and CTD instructions are used to increment or decrement a counter
at each false-to-true rung transition. When the CTU rung makes a false-to-true
transition, the accumulated value is incremented by one count. The CTD
instruction operates the same, except the count is decremented.
TIP If the signal is coming from a field device wired to an input on the
controller, the on and off duration of the incoming signal must not be less
than twice the controller scan time (assuming 50% duty cycle). This
condition is needed to enable the counter to detect false-to-true transitions
from the incoming device.
RES - Reset
Instruction Type: output
R6:0
RES
Execution Time for the RES Instructions
Controller When Rung Is:
True False
MicroLogix 1400 0.6320 µs 0.4305 µs
The RES instruction resets timers, counters, and control elements. When the
RES instruction is executed, it resets the data defined by the RES instruction.
The RES instruction has no effect when the rung state is false. The following
table shows which elements are modified:
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Structure • • •
Compare Instructions
Use these input instructions when you want to compare values of data.
Using the Compare Most of the compare instructions use two parameters, Source A and Source B
(MEQ and LIM have an additional parameter and are described later in this
Instructions chapter). Both sources cannot be immediate values. The valid data ranges for
these instructions are:
• -32,768…32,767 (word)
• -2,147,483,648…2,147,483,647 (long word)
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files(1) Address Level
Mode(3)
DLS - Data Log
PTOX, PWMX
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
HSC(2)
RI/RIX
Direct
T, C, R
Word
MMI
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source A • • • • • • • • • • • • • • • • • • • • • • • • •
Source B • • • • • • • • • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) Only use the High Speed Counter Accumulator (HSC.ACC) for Source A in GRT, LES, GEQ and LEQ instructions.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
IMPORTANT Only use the High Speed Counter Accumulator (HSC.ACC) for Source
A in GRT, LES, GEQ and LEQ instructions.
IMPORTANT Only use the High Speed Counter Accumulator (HSC.ACC) for Source A
in GRT, LES, GEQ and LEQ instructions.
The MEQ instruction is used to compare whether one value (source) is equal to a
second value (compare) through a mask. The source and the compare are
logically ANDed with the mask. Then, these results are compared to each other.
If the resulting values are equal, the rung state is true. If the resulting values are
not equal, the rung state is false.
For example:
Source: Compare:
1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
Mask: Mask:
1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1
Intermediate Result: Intermediate Result:
1 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0
Comparison of the Intermediate Results: not equal
The source, mask, and compare values must all be of the same data size (either
word or long word). The data ranges for mask and compare are:
• -32,768…32,767 (word)
• -2,147,483,648…2,147,483,647 (long word)
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files(1) Address Level
Mode(2)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • • • • • • • • •
Mask • • • • • • • • • • • • • • • • • • • • • • • • •
Compare • • • • • • • • • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
The LIM instruction is used to test for values within or outside of a specified
range. The LIM instruction is evaluated based on the Low Limit, Test, and High
Limit values as shown in the following table.
LIM Instruction Operation Based on Low Limit, Test, and High Limit Values
When: And: Rung State
Low Limit ≤ High Limit Low Limit ≤ Test ≤ High Limit true
Low Limit ≤ High Limit Test < Low Limit or Test > High Limit false
High Limit < Low Limit High Limit < Test < Low Limit false
High Limit < Low Limit Test ≥ High Limit or Test ≤ Low Limit true
The Low Limit, Test, and High Limit values can be word addresses or constants,
restricted to the following combinations:
• If the Test parameter is a constant, both the Low Limit and High Limit
parameters must be word or long word addresses.
• If the Test parameter is a word or long word address, the Low Limit and
High Limit parameters can be either a constant, a word, or a long word
address.
When mixed-sized parameters are used, all parameters are put into the format of
the largest parameter. For instance, if a word and a long word are used, the word is
converted to a long word.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files(1) Address Level
Mode(2)
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Low Limit • • • • • • • • • • • • • • • • • • • • • • • • •
Test • • • • • • • • • • • • • • • • • • • • • • • • •
High Limit • • • • • • • • • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Math Instructions
General Information
Before using math instructions, become familiar with the following topics at the
beginning of this chapter:
• Using the Math Instructions
• Updates to Math Status Bits
• Using the Floating Point (F) Data File
This chapter also explains how advanced math instructions and application
specific instructions function in your logic program. Each of the advanced math
instructions include information on:
• instruction symbol
• instruction usage.
Instructions
Math Instructions
Instruction Used To: Page
ADD - Add Add two values 165
SUB - Subtract Subtract two values 165
MUL - Multiply Multiply two values 166
DIV - Divide Divide one value by another 166
NEG - Negate Change the sign of the source value and place it in the 166
destination
CLR - Clear Set all bits of a word to zero 166
ABS - Absolute Value Find the absolute value of the source value 167
SQR - Square Root Find the square root of a value 171
SCL - Scale Scale a value 168
SCP - Scale with Parameters Scale a value to a range determined by creating a linear 169
relationship
Using the Math Instructions Most math instructions use three parameters, Source A, Source B, and
Destination (additional parameters are described where applicable, later in this
chapter). The mathematical operation is performed using both Source values.
The result is stored in the Destination.
• Long File Type Address, Constant and Float File Type Address cannot be
used together in Source A, Source B and Destination.
Addressing Modes and File Types can be used as shown in the following table:
Math Instructions (ADD, SUB, MUL, DIV, NEG, CLR) Valid Addressing Modes and File Types
For definitions of the terms used in this table see Using the Instruction Descriptions on page 68.
Address
Data Files Function Files(1) Address Level
Mode(3)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Source A • • • • • • • • • • • • • • • • • • • • • • • • • •
Source B • • • • • • • • • • • • • • • • • • • • • • • • • •
Destination • • • • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Updates to Math Status Bits After a math instruction is executed, the arithmetic status bits in the status file are
updated. The arithmetic status bits are in word 0 in the processor status file (S2).
In applications where a math overflow or divide by zero occurs, you can avoid a
controller fault by using an unlatch (OTU) instruction with address S:5/0 in
your program. The rung must be between the overflow point and the END or
TND statement.
The following illustration shows the rung you can use to unlatch the overflow
trap bit.
S:5
U
0
Floating point numbers are represented using the IEEE-754 format, where:
• Bit 31 is the sign bit. This bit is set for negative numbers (note that
negative zero is a valid value).
• Bits 23…30 are the exponent.
• Bits 0…22 are the mantissa.
The value represented by a 32-bit floating point number (not one of the
exception values defined on page 163) is given by the following expression. Note
the restoration of the suppressed most significant bit of the mantissa.
(-1)s x 2 e - 127 x (1 + m)
where:
The valid range for floating point numbers is from -3.4028 x 1038…+3.4028 x
1038.
Definitions
Overflow - occurs when the result of an operation produces an exponent that is
greater than 254.
Floating point operations are rounded using the round-to-even rule. If the bits of
the result to the right of the least significant bit (LSB) represent a value less than
one-half of the LSB, then the result remains as is. If the bits to the right of the
LSB represent a value greater than one-half of the LSB, the result is rounded up
by adding one LSB. If the bits to the right of the LSB represent a value of exactly
one-half LSB, the result is rounded up or down so that the LSB is an even
number.
The addressing format for floating point data files is shown below.
Format Explanation
Ff:e F Floating Point file
f File number The valid file number range is from 8 (default) to 255.
: Element delimiter
e Element number The valid element number range is from 0…255.
Examples: F8:2 Floating Point File 8, Element 2
F10:36 Floating Point File 10, Element 36
The following table shows items to consider when using floating point data.
IMPORTANT These rules do not apply to the SCP instruction. See page 170 for the
rules for that instruction.
Use the NEG instruction to change the sign of the Source and place the result in
the Destination.
The ABS instruction takes the absolute value of the Source and places it in the
Destination. The data range for this instruction is
-2,147,483,648…2,147,483,647 or IEEE-754 floating point value.
Source and Destination do not have to be the same data type. However, if the
signed result does not fit in Destination, the following will occur.
The following table shows how the math status bits are updated upon execution
of the ABS instruction:
Addressing Modes and File Types are shown in the following table:
Address
Data Files Function Files Address Level
Mode(1)
Floating Point
PTOX, PWMX
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • • • • • • • • • • • •
Destination • • • • • • • • • • • • • • • • • • • • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,t
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
The following equations express the linear relationship between the input value
and the resulting scaled value:
Rate and Offset can both be immediate values. The data range for rate and offset
is -32768…32767.
Addressing Modes and File Types can be used as shown in the following table:
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • •
Rate • • • • • • • • • •
Offset • • • • • • • • • •
Destination • • • • • • • • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
IMPORTANT Do not use the High Speed Counter Accumulator (HSC.ACC) for the
Destination parameter in the SCL instruction.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files(1) Address Level
Mode(2)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Input (x) • • • • • • • • • • • • • • • • • • • • • • • •
Input Min. (x0) • • • • • • • • • • • • •
Input Max. (x1) • • • • • • • • • • • • •
Scaled Min. (y0) • • • • • • • • • • • • •
Scaled Max. (y1) • • • • • • • • • • • • •
Output (y) • • • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) See Important note about indirect addressing.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
IMPORTANT Do not use the High Speed Counter Accumulator (HSC.ACC) for the
Scaled Output parameter in the SCP instruction.
If any of the parameters (except Output) are NAN (not a number), Infinity, or
De-normalized; then the result is -NAN.
Other Considerations
If x1 - x0 = 0 and x does not equal x0, The Result becomes a negative overflow (for
integer values) or a negative NAN (for floating point values)
The SQR instruction calculates the square root of the absolute value of the source
and places the rounded result in the destination.
Address
Data Files Function Files Address Level
Mode(1)
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
F
L
I
Source • • • • • • • • • • • • •
Destination • • • • • • • • • • • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
ABS
SIN
Sine
Source N7:0
Execution Time for the SIN Instruction
0<
Dest N7:1 Controller Data Size When Rung Is:
0<
True False
MicroLogix 1400 word 92.8635 µs 0.4210 µs
long word 95.0760 µs 0.4210 µs
The SIN instruction places the sine of the Source (in radians) in the Destination.
Address Levels for the operands involved in the SIN can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
Paramet PTOX, PWMX
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute the sine of the Source (in
radians) and place the result in Destination. If the Destination is floating point,
the result shall always be rounded using the round to even rule.
SIN Instruction Operation
Inputs Conditions Output
Source Type Destination Type S:2/14 S:0/3-0 S:5/0 Destination
S, Z, V, C
W,DW, F F X Sin(Source) > 0 0,0,0,0 L Sin(Source)
(1)
DNRM X X X 0,1,0,0 L 0
W,DW, F F X Sin(Source) < 0 1,0,0,0 L Sin(Source)
W,DW, F W, DW X Sin(Source) >= 0.5 0,0,0,0 L 1
W,DW, F W, DW X -0.5 < Sin(Source) < 0.5 0,1,0,0 L 0
(2) If the Destination is floating point, all overflows(Source is NAN or infinity) shall produce NAN(0x7FFFFFFF).
(3) If the Destination is word or double-word, overflow occurs, a saturated result is stored in Destination. Destination shall be 32767 for Word and 2147483647 for Double
Word.
The Math Overflow Trap Bit shall ONLY be set if the Overflow bit is set.
Otherwise, it remains in last state.
ABS
COS
Cosine
Source N7:0
Execution Time for the COS Instruction
0<
Dest N7:1 Controller Data Size When Rung Is:
0<
True False
MicroLogix 1400 word 112.7110 µs 0.7686 µs
long word 19.8070 µs 0.7694 µs
The COS instruction places the sine of the Source (in radians) in the
Destination.
Address Levels for the operands involved in the COS can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
(3) See Important note about indirect addressing.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute cosine of the Source (in
radians) and place the result in Destination. If the Destination is floating point,
the result shall always be rounded using the round to even rule.
COS Instruction Operation
Inputs Conditions Output
Source Type Destination Type S:2/14 S:0/3-0 S:5/0 Destination
S, Z, V, C
W,DW, F F X Cos(Source) > 0 0,0,0,0 L Cos(Source)
(1) DNRM X X X 0,1,0,0 L 1
W,DW, F F X Cos(Source) < 0 1,0,0,0 L Cos(Source)
W,DW, F W, DW X Cos(Source) >= 0.5 0,0,0,0 L 1
W,DW, F W, DW X -0.5 < Cos(Source) < 0.5 0,1,0,0 L 0
W,DW, F W, DW X Cos(Source) <= 0.5 1,0,0,0 L -1
(2) X F X Source is NAN or INF 0,0,1,0 1 0x7FFFFFFF
(3)
X W X Source is NAN or INF 0,0,1,0 1 32767
(3)
X DW X Source is NAN or INF 0,0,1,0 1 2147483647
(1) All denormalized inputs shall be treated as plus zero. Any underflow result shall produce plus zero.
(2) If the Destination is floating point, all overflows(Source is NAN or infinity) shall produce NAN(0x7FFFFFFF).
(3) If the Destination is word or double-word, overflow occurs, a saturated result is stored in Destination. Destination shall be 32767 for Word and 2147483647 for Double
Word.
The Math Overflow Trap Bit shall ONLY be set if the Overflow bit is set.
Otherwise, it remains in last state.
ABS
TAN
Tangent Execution Time for the TAN Instruction
Source N7:0
Controller Data Size When Rung Is:
0<
Dest N7:1 True False
0<
MicroLogix 1400 word 122.6760 µs 0.3915 µs
long word 126.9135 µs 0.4234 µs
The TAN instruction places the sine of the Source (in radians) in the
Destination.
Address Levels for the operands involved in the TAN can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute tangent of the Source (in
radians) and place the result in Destination. If the Destination is floating point,
the result shall always be rounded using the round to even rule.
TAN Instruction Operation
Inputs Conditions Output
Source Type Destination S:2/14 S:0/3-0 S:5/0 Destination
Type S, Z, V, C
W,DW, F F X Tan(Source) > 0 0,0,0,0 L Tan(Source)
(1) DNRM X X X 0,1,0,0 L 0
W,DW, F F X Tan(Source) < 0 1,0,0,0 L Tan(Source)
W,DW, F W, DW X Tan(Source )>= 0.5 && no overflow 0,0,0,0 L Rnd(Tan(Source))
W,DW, F W, DW X -0.5 < Tan(Source) < 0.5 0,1,0,0 L 0
W,DW, F W, DW X Tan(Source) <= 0.5 && no overflow 1,0,0,0 L Rnd(Tan(Source))
(2)
W,DW, F W X Tan(Source) >= 32767.5 0,0,1,0 1 32767
(2) W,DW, F W X Tan(Source) <= -32768.5 1,0,1,0 1 -32768
(2)
W,DW, F DW X Tan(Source) >= 214748.647.5 0,0,1,0 1 2147483647
(2) W,DW, F DW X Tan(Source) <= -214748.648.5 1,0,1,0 1 -2147483648
(3)
X F X Source is NAN or INF 0,0,1,0 1 0x7FFFFFFF
(4)
X W X Source is NAN or INF 0,0,1,0 1 32767
(4) X DW X Source is NAN or INF 0,0,1,0 1 2147483647
(1) All denormalized inputs shall be treated as plus zero. Any underflow result shall produce plus zero.
(2) If the Destination is word or double-word and an overflow occurs(except source is NAN or INF):
If the result is positive, Destination is 32767 for Word and 2147483647 for Double Word. If the result is negative, Destination is -32768 for Word and -2147483648 for
Double Word.
(3) If the Destination is floating point, all overflows(Source is NAN or infinity) shall produce NAN(0x7FFFFFFF).
(4) If Destination is an integer, the Source is NAN or infinity, a saturated result (32767 for Word and 2147483647 for Double Word) shall be stored
The Math Overflow Trap Bit shall ONLY be set if the Overflow bit is set.
Otherwise, it remains in last state.
ABS
ASN
Arc Sine
Source N7:0
Execution Time for the ASN Instruction
0<
Dest N7:1 Controller Data Size When Rung Is:
0<
True False
MicroLogix 1400 word 42.4610 µs 0.3870 µs
long word 43.1010 µs 0.3790 µs
Use the ASN instruction to take the arc sine of a number and store the result (in
radians) in the destination. The source must be greater than or equal to -1 and less
than or equal to 1. The resulting value in the destination is always greater than or
equal to -π/2 and less than or equal to π/2, where π = 3.141592.
Address Levels for the operands involved in the ASN can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute arc-sine of the Source and
place the result in Destination. Valid input range is from -1.0…1.0 and output
range is from -π/2…π/2.
If the Destination is floating point, the result shall always be rounded using the
round to even rule.
ASN Instruction Operation
Inputs Conditions Output
Source Type Destination S:2/14 S:0/3-0 S:5/0 Destination
Type S, Z, V, C
W,DW, F F X 0 < Source <= 1.0 0,0,0,0 L Asin(Source)
(1) DNRM X X X 0,1,0,0 L 0
W,DW, F F X -1.0 < Source < 0 1,0,0,0 L Asin(Source)
W,DW, F W, DW X Source <=1 && Asin(Source) >= 0.5 0,0,0,0 L Rnd(Asin(Source))
W,DW, F W, DW X -0.5 < Asin(Source) < 0.5 0,1,0,0 L 0
W,DW, F W, DW X Source >= -1 && Asin(Source) <= -0.5 1,0,0,0 L Rnd(Asin(Source))
(2) X F X Source < -1 or Source > 1 0,0,1,0 1 0x7FFFFFFF
(2)
X F X Source is NAN or INF 0,0,1,0 1 0x7FFFFFFF
X W X Source < -1 or Source > 1 0,0,1,0 1 32767
(2) If the Destination is floating point, all overflows(Source is NAN or infinity) shall produce NAN(0x7FFFFFFF).
(3) If the Destination is word or double-word, and an overflow occurs, destination shall be 32767 for Word and 2147483647 for Double Word.
ABS
ACS
Arc Cosine Execution Time for the ACS Instruction
Source N7:0
Controller Data Size When Rung Is:
0<
Dest N7:1 True False
0<
MicroLogix 1400 word 18.0150 µs 0.3750 µs
long word 18.3070 µs 0.4150 µs
Use the ACS instruction to take the arc cosine of a number (source in radians)
and store the result (in radians) in the destination. The source must be greater
than or equal to -1 and less than or equal to 1. The resulting value in the
destination is always greater than or equal to 0 and less than or equal to π, where π
= 3.141592.
Address Levels for the operands involved in the ACS can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute arc cosine of the Source and
place the result in Destination. Valid input range is from -1.0…1.0 and output
range is from 0…π.
If the Destination is floating point, the result shall always be rounded using the
round to even rule.
ACS Instruction Operation
Inputs Conditions Output
Source Type Destination S:2/14 S:0/3-0 S:5/0 Destination
Type S, Z, V, C
W,DW, F F X -1.0 <= Source < 1.0 0,0,0,0 L Acos(Source)
W,DW, F F X Source= 1.0 0,1,0,0 L 0
(1)
DNRM F X X 0,0,0,0 L π/2
W,DW, F W, DW X Acos(Source) >= 0.5 0,0,0,0 L Rnd(Acos(Source))
W,DW, F W, DW X Acos(Source) < 0.5 0,1,0,0 L 0
(2) X F X Source < -1 or Source > 1 0,0,1,0 1 0x7FFFFFFF
(2) X F X Source is NAN or INF 0,0,1,0 1 0x7FFFFFFF
X W X Source < -1 or Source > 1 0,0,1,0 1 32767
(2) If the Destination is floating point, all overflows shall produce NAN(0x7FFFFFFF).
(3) If the Destination is word or double-word, and an overflow occurs, destination shall be 32767 for Word and 2147483647 for Double Word.
ABS
ATN
Arc Tangent
Source N7:0
Execution Time for the ATN Instruction
0<
Dest N7:1 Controller Data Size When Rung Is:
0<
True False
MicroLogix 1400 word 146.7510 µs 0.3740 µs
long word 146.4885 µs 0.4088 µs
Use the ATN instruction to take the arc tangent of a number (source) and store
the result (in radians) in the destination. The resulting value in the destination is
always greater than or equal to -π/2 and less than or equal to π/2, where π =
3.141592.
Address Levels for the operands involved in the ATN can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute arc tangent of the Source
and place the result in Destination. Valid input range is from -∝…+∝ and
produced output range is from -π/2…π/2.
If the Destination is floating point, the result shall always be rounded using the
round to even rule.
(2) If the Destination is floating point, all overflows shall produce NAN(0x7FFFFFFF).
(3) If the Destination is word or double-word, and an overflow occurs, destination shall be 32767 for Word and 2147483647 for Double Word.
ABS
DEG
Radians to Degrees
Source N7:0
Execution Time for the DEG Instruction
0<
Dest N7:1 Controller Data Size When Rung Is:
0<
True False
MicroLogix 1400 word 27.7310 µs 0.4106 µs
long word 31.2470 µs 0.4098 µs
The DEG instruction converts the Source(in radians) to degrees and store the
result in the Destination.
Source * 180/Π
where Π = 3.141592
Address Levels for the operands involved in the DEG can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall convert the Source(in radians) in
degrees and place the result in Destination.
If the Destination is floating point, the result shall always be rounded using the
round to even rule.
(2) If the Destination is word or double-word and an overflow occurs(except source is NAN or INF):
If the result is positive, Destination is 32767 for Word and 2147483647 for Double Word. If the result is negative, Destination is -32768 for Word and -2147483648 for
Double Word.
(3) If the Destination is floating point, all overflows (Source is NAN or infinity) shall produce NAN (0x7FFFFFFF).
(4) If Destination is an integer and the Source is NAN or infinity, a saturated result (32767 for Word and 2147483647 for Double Word) shall be stored.
ABS
RAD
Degrees to Radians
Source N7:0
Execution Time for the RAD Instruction
0<
Dest N7:1 Controller Data Size When Rung Is:
0<
True False
MicroLogix 1400 word 23.0610 µs 0.4070 µs
long word 26.211 µs 0.3790 µs
The RAD instruction converts the Source (in degrees) to radians and stores the
result in the Destination.
Source * Π/180
where Π = 3.141592
Address Levels for the operands involved in the RAD can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Double Word
CS - Comms
Parameter
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • •
Destination • • • • • • • • • • • • •
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall convert the Source (in degrees) in
radians and place the result in Destination.
If the Destination is floating point, the result shall always be rounded using the
round to even rule.
(2) If the Destination is word or double-word and an overflow occurs(except source is NAN or INF):
If the result is positive, Destination is 32767 for Word and 2147483647 for Double Word. If the result is negative, Destination is -32768 for Word and -2147483648 for
Double Word.
(3) If the Destination is floating point, all overflows (Source is NAN or infinity) shall produce NAN (0x7FFFFFFF).
(4) If Destination is an integer and the Source is NAN or infinity, a saturated result (32767 for Word and 2147483647 for Double Word) shall be stored.
ABSLN
Natural Log
Source N7:0
Execution Time for the LN Instruction
0<
Dest N7:1 Controller Data Size When Rung Is:
0<
True False
MicroLogix 1400 word 127.3260 µs 0.4094 µs
long word 130.3635 µs 0.4094 µs
Use the LN instruction to take the natural log of the value in the source and store
the result in the destination. The source must be greater than zero.
Address Levels for the operands involved in the LN can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute the natural logarithm of the
Source and place the result in Destination.
If the Destination is floating point, the result shall always be rounded using the
round to even rule.
LOG - Base 10 Logarithm
ABS
LOG
Log Base 10
Source N7:0
0<
Dest N7:1
0<
LN Instruction Operation
Inputs Conditions Output
Source Type Destination S:2/14 S:0/3-0 S:5/0 Destination
Type S, Z, V, C
W,DW, F F X Source > 1 0,0,0,0 L Ln(Source)
W,DW, F F X Source = 1 1,0,0,0 L 0
W,DW, F F X 0 < Source < 1 1,0,0,0 L Ln(Source)
W,DW, F W, DW X Source >= Sqrt(e) 0,0,0,0 L Rnd(Ln(Source))
W,DW, F W, DW X 1/Sqrt(e) < Source < Sqrt(e) 1,0,0,0 L 0
W,DW, F W, DW X 0 < Source <= 1/Sqrt(e) 1,0,0,0 L Rnd(Ln(Source))
LN Instruction Operation
Inputs Conditions Output
Source Type Destination S:2/14 S:0/3-0 S:5/0 Destination
Type S, Z, V, C
(1)
+DNRM F X X 1,0,1,0 1 -INF
(1)(2)
+DNRM W X X 1,0,1,0 1 -32768
(1)
+DNRM DW X X 1,0,1,0 1 -2147483648
(2)
(1)(3)
W,DW, F F X Source <= 0 (including -DNRM) 0,0,1,0 1 0x7FFFFFFF
(2)
W,DW, F F X Source = +INF 0,0,1,0 1 +INF
(3)
X F X Source is NAN or -INF 0,0,1,0 1 0x7FFFFFFF
(4)
X W X Source is NAN or INF 0,0,1,0 1 32767
(4)
X DW X Source is NAN or INF 0,0,1,0 1 2147483647
(1) All denormalized inputs shall be treated as plus zero.
(2) If the Destination is word or double-word and an overflow occurs (except source is NAN or INF), destination is -32768 for Word and -2147483648 for Double Word.
(3) If the Destination is floating point, all overflows (except +INF) shall produce NAN (0x7FFFFFFF).
(4) If Destination is an integer and the Source is NAN or infinity (+INF or -INF), a saturated result (32767 for Word and 2147483647 for Double Word) shall be stored.
Use the LOG instruction to take the log base 10 of the value in the source and
store the result in the destination. The source must be greater than zero.
Address Levels for the operands involved in the LOG can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • •
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute the natural logarithm of the
Source and place the result in Destination.
If the Destination is floating point, the result shall always be rounded using the
round to even rule.
(2) If the Destination is word or double-word and an overflow occurs (except source is NAN or INF), destination is -32768 for Word and -2147483648 for Double Word.
(3) If the Destination is floating point, all overflows (except +INF) shall produce NAN (0x7FFFFFFF).
(4) If Destination is an integer and the Source is NAN or infinity (+INF or -INF), a saturated result (32767 for Word and 2147483647 for Double Word) shall be stored.
Use the XPY instruction to raise a value (source A) to a power (source B) and
store the result in the destination. If the value in source A is negative, the
exponent (source B) should be a whole number. If it is not a whole number, the
overflow bit is set and the absolute value of the base is used in the calculation
Address Levels for the operands involved in the XPY can be ALL word, ALL
double word, ALL float, or a combination. These operands shall undergo a
conversion to float. The calculation of the source (in float) is then performed,
and the result is then cast to the data type of Destination.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source A/
• • • • • • • • • • • • • •
B
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute the Source A to power
Source B and place the result in Destination.
If the Destination is floating point, the result shall always be rounded using the
round to even rule.
IMPORTANT The XPY instruction processes at the floating-point level, so the result
causes the truncation error when it is used with the long data types.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Destinatio
• • • • • • • • • • • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall compute the expression and place the
result in Destination.
Note that it takes on the attributes of the instruction which it is computing. The
following instructions can be included in the expression section of CPT
instruction.
• Zero: shall be set if the lower 31 bits of float result of Destination are all
zero (handles negative zero), otherwise reset.
• Sign: shall be set if the most significant bit of Destination is set (bit 31 for
float), otherwise reset.
The Math Overflow Trap Bit shall ONLY be set if the Overflow bit is set.
Otherwise, it remains in last state.
Notes:
These instructions simplify your ladder program by allowing you to use a single
instruction or pair of instructions to perform common complex operations.
In this chapter you will find a general overview preceding groups of instructions.
Before you learn about the instructions in each of these groups, we suggest that
you read the overview that precedes each section. This chapter contains the
following overviews:
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Destinatio
• • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
This instruction executes on a true rung. When the rung is true, this instruction
moves the current value of the 9.92063492 μs free running clock into the
Destination.
If the Destination is an integer address type, only 16 bits are moved into the
address. If the Destination is floating point address, the long integer value is
converted into a float and is moved the relative address.
After the free running clock reaches 0xFFFFFFFF (42608.8025 seconds) value, it
wraps around to 0 and continues incrementing. The RESET signal or Power
Cycle sets the free running clock to 0.
The RPC instruction reads Program copies the checksum of the processor
program from either the processor's RAM memory or from the installed memory
module into the designated destination integer file location
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
Int16
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Source A • •
Destinatio
• •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction shall read Program Checksum from
processor memory or from memory module and places the result into
Destination.
Address Levels for the operands involved in the RPC should be Word. The result
is stored to the data type of Destination. The RPC instruction destination
address supports Direct Addressing. It does not support Indirect addressing,
Indexed addressing, or Indirect Indexed Addressing.
When the Source A is 1(read from Memory Module), the memory module
should be installed in Non-Executing mode. If the Memory Module is installed
during RUN mode, the Destination value will be 0.
All of these parameters should be of the same data type (Nx:x, Lx:x or Fx:x). The
data range for the Start and Stop timestamp is from -32768…32767 (Word) or
-2,147,483,648…2,147,483,647 (Long Word), or any IEEE-754 32-bit value.
Immediate Float
Immediate Int32
PTOX, PWMX
Paramet
Double Word
CS - Comms
Immediate
er
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
Float
MMI
Int16
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Start • • • •
Stop • • • •
Destinatio
• • • •
n
(1) PTOX and PWMX files are only for use with MicroLogix 1400 BXB or BXBA unit.
(2) The Data Log Status file can only be used for the following math instructions: ADD, SUB, MUL, DIV, NEG, and SCP.
(3) See Important note about indirect addressing.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Instruction Operation
When the rung is true, this instruction calculates the number of 9.92063492 μs
"ticks" that have elapsed from the Start value to the Stop value and places the
result into the Destination.
Any TDF instruction with a floating point address computes the time difference
between 2 timestamps captured within 10.4025 seconds of each other (1048575
9.92063492 μsec ticks). It calculates an invalid result if more than 10.4025
seconds have elapsed between the start and stop timestamps.
Any TDF instruction with an integer address computes the positive time
difference between the START and END timestamps. It calculates an invalid
result if more than 327.67 ms have elapsed between the start and stop
timestamps.
Any TDF instruction with a double word address computes the time difference
between 2 timestamps captured within 42608.8025 seconds of each other
(4294967295 9.92063492 μsec ticks). It calculates an invalid result if more than
42608.8025 seconds have elapsed between the start and stop timestamps.
Notes:
Conversion Instructions
Using Decode and Encode Addressing Modes and File Types can be used as shown in the following table:
Instructions
Conversion Instructions Valid Addressing Modes and File Types
For definitions of the terms used in this table see Using the Instruction Descriptions on page 68.
Address
Data Files Function Files Address Level
Mode(1)
DLS - Data Log
PTOX, PWMX
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • •
Destination • • • • • • • • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
The DCD instruction uses the lower four bits of the source word to set one bit of
the destination word. All other bits in the destination word are cleared. The
DCD instruction converts the values as shown in the table below:
Decode 4 to 1-of-16
Source Bits Destination Bits
15 to 04 03 02 01 00 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
x 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
x 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
x 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
x 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
x 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
x 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
x 0 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
x 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
x 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
x 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
x 1 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
x 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
x 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
x 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
x 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
x = not used
The ENC instruction searches the source from the lowest to the highest bit,
looking for the first bit set. The corresponding bit position is written to the
destination as an integer. The ENC instruction converts the values as shown in
the table below:
Encode 1-of-16 to 4
Source Bits Destination Bits
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 15 to 04 03 02 01 00
x x x x x x x x x x x x x x x 1 0 0 0 0 0
x x x x x x x x x x x x x x 1 0 0 0 0 0 1
x x x x x x x x x x x x x 1 0 0 0 0 0 1 0
x x x x x x x x x x x x 1 0 0 0 0 0 0 1 1
x x x x x x x x x x x 1 0 0 0 0 0 0 1 0 0
x x x x x x x x x x 1 0 0 0 0 0 0 0 1 0 1
x x x x x x x x x 1 0 0 0 0 0 0 0 0 1 1 0
x x x x x x x x 1 0 0 0 0 0 0 0 0 0 1 1 1
x x x x x x x 1 0 0 0 0 0 0 0 0 0 1 0 0 0
x x x x x x 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1
x x x x x 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
x x x x 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1
x x x 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0
x x 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1
x 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
x = determines the state of the flag
TIP If source is zero, the destination is zero and the math status
is zero, the flag is set to 1.
The FRD instruction is used to convert the Binary Coded Decimal (BCD)
source value to an integer and place the result in the destination.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(1)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • (2)
Destination • • • • • • • • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
The source can be either a word address or the math register. The maximum
BCD source values permissible are:
• 9999 if the source is a word address (allowing only a 4-digit BCD value)
• 32768 if the source is the math register (allowing a 5-digit BCD value with
the lower 4 digits stored in S:13 and the high order digit in S:14).
If the source is the math register, it must be directly addressed as S:13. S:13 is the
only status file element that can be used.
TIP Always provide ladder logic filtering of all BCD input devices prior to
performing the FRD instruction. The slightest difference in
point-to-point input filter delay can cause the FRD instruction to
overflow due to the conversion of a non-BCD digit.
MOV
MOVE
Source I:0.0
0
Dest N7:1
0
The two rungs shown cause the controller to verify that the value I:0 remains the
same for two consecutive scans before it executes the FRD. This prevents the
FRD from converting a non-BCD value during an input value change.
TIP To convert numbers larger than 9999 BCD, the source must be
the Math Register (S:13). You must reset the Minor Error Bit
(S:5.0) to prevent an error.
Example
The BCD value 32,760 in the math register is converted and stored in N7:0. The
maximum source value is 32767 (BCD).
FRD
FRD
From BCD
Source S:13
00032760<
Dest N7:0
32760<
S:14 S:13
0000 0000 0000 0011 0010 0111 0110 0000
15 0 15 0 5-digit BCD
0 0 0 3 2 7 6 0
You should convert BCD values to integer before you manipulate them in your
ladder program. If you do not convert the values, the controller manipulates them
as integers and their value may be lost.
TIP If the math register (S:13 and S:14) is used as the source for the FRD
instruction and the BCD value does not exceed four digits, be sure to
clear word S:14 before executing the FRD instruction. If S:14 is not
cleared and a value is contained in this word from another math
instruction located elsewhere in the program, an incorrect decimal
value is placed in the destination word.
I:1 MOV
] [ MOVE
Source N7:2
0001 0010 0011 0100
0
4660
Dest S:13
4660
CLR
CLEAR
Dest S:14
0
FRD
FROM BCD S:13 and S:14 are
Source S:13 displayed in BCD format.
00001234
Dest N7:0
1234
0000 0100 1101 0010
When the input condition I:0/1 is set (1), a BCD value (transferred from a
4-digit thumbwheel switch for example) is moved from word N7:2 into the math
register. Status word S:14 is then cleared to make certain that unwanted data is
not present when the FRD instruction is executed.
The TOD instruction is used to convert the integer source value to BCD and
place the result in the destination.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(1)
CS0 - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
Ri
N
O
B
S
F
L
I
Source • • • • • • • • •
Destination • • • • • • • • • • (2)
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
If the destination is the math register, it must be directly addressed as S:13. S:13 is
the only status file element that can be used.
Contains the 5-digit BCD result of the conversion. This result is valid at
overflow.
Example
The integer value 9760 stored at N7:3 is converted to BCD and the BCD
equivalent is stored in N7:0. The maximum BCD value is 9999.
TOD
TOD
To BCD
Source N7:3 The destination value is
9760< displayed in BCD format.
Dest N10:0
9760<
MSB LSB
GCD
GCD
Gray Code Execution Time for the GCD Instructions
Source I1:2.0
225< Controller When Rung Is:
Dest N7:1 True False
190<
MicroLogix 1400 5.4970 µs 0.5618 µs
The GCD instruction converts Gray code data (Source) to an integer value
(Destination). If the Gray code input is negative (high bit set), the Destination is
set to 32767 and the overflow flag is set.
Addressing Modes and File Types are shown in the following table:
Address
Data Files Function Files Address Level
Mode
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • •
Destination • • • • • • • • •
Notes:
Logical Instructions
Using Logical Instructions When using logical instructions, observe the following:
• Source and Destination must be of the same data size (that is, all words or
all long words).
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files(2) Address Level
Mode(3)
DLS- Data Log
PTOX, PWMX
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source A • • • • • • • • • • • • • • • • • • • • • • • • •
(1) • • • • • • • • • • • • • • • • • • • • • • • • •
Source B
Destination • • • • • • • • • • • • • • • • • •
(1) Source B does not apply to the NOT instruction. The NOT instruction only has one source value.
(2) PTOX and PWMX files are valid for MicroLogix 1400 BXB or BXBA unit.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Updates to Math Status Bits After a logical instruction is executed, the arithmetic status bits in the status file
are updated. The arithmetic status bits are in word 0 bits 0-3 in the processor
status file (S2).
The AND instruction performs a bit-wise logical AND of two sources and places
the result in the destination.
Truth Table for the AND Instruction
Destination = A AND B
Source: A
1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0
Source: B
1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1
Destination:
1 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0
IMPORTANT Do not use the High Speed Counter Accumulator (HSC.ACC) for
the Destination parameter in the AND, OR, and XOR instructions.
For more information, see Using Logical Instructions on page 215 and Updates
to Math Status Bits on page 216.
The OR instruction performs a logical OR of two sources and places the result in
the destination.
Truth Table for the OR Instruction
Destination = A OR B
Source: A
1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0
Source: B
1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1
Destination:
1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1
IMPORTANT Do not use the High Speed Counter Accumulator (HSC.ACC) for
the Destination parameter in the AND, OR, and XOR
instructions.
The XOR instruction performs a logical exclusive OR of two sources and places
the result in the destination.
Truth Table for the XOR Instruction
Destination = A XOR B
Source: A
1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0
IMPORTANT Do not use the High Speed Counter Accumulator (HSC.ACC) for
the Destination parameter in the AND, OR, and XOR
instructions.
For more information, see Using Logical Instructions on page 215 and Updates
to Math Status Bits on page 216.
NOT - Logical NOT Instruction Type: output
NOT
NOT
NOT Execution Time for the NOT Instruction
Source N7:0
0<
Dest N7:1 Controller Data Size When Rung Is:
0< True False
MicroLogix 1400 word 1.3682 µs 0.4074 µs
long word 1.3620 µs 0.3900 µs
The NOT instruction is used to invert the source bit-by-bit (one’s complement)
and then place the result in the destination.
Truth Table for the NOT Instruction
Destination = A NOT B
Source:
1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0
Destination:
0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1
For more information, see Using Logical Instructions on page 215 and Updates
to Math Status Bits on page 216.
Move Instructions
The MOV instruction is used to move data from the source to the destination. As
long as the rung remains true, the instruction moves the data each scan.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files(1) Address Level
Mode(3)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • • • • • • • • • • • •
(1) PTOX and PWMX files are valid for MicroLogix 1400 BXB or BXBA unit.
(2) Some elements can be written to. Consult the function file for details.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
After a MOV instruction is executed, the arithmetic status bits in the status file
are updated. The arithmetic status bits are in word 0, bits 0 to 3 in the processor
status file (S2).
TIP If you want to move one word of data without affecting the
math flags, use a copy (COP) instruction with a length of 1 word
instead of the MOV instruction.
The MVM instruction is used to move data from the source to the destination,
allowing portions of the destination to be masked. The mask bit functions as
follows:
Mask data by setting bits in the mask to zero; pass data by setting bits in the mask
to one. The mask can be a constant, or you can vary the mask by assigning a direct
address. Bits in the Destination that correspond to zeros in the Mask are not
altered.
To mask data, set the mask bit to zero; to pass data, set the mask bit to one.
The mask can be a constant value, or you can vary the mask by assigning a
direct address.
TIP Bits in the destination that correspond to zeros in the mask are
not altered as shown in the shaded areas in the following table.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(1)
Parameter CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • •
Mask • • • • • • • • • • • • •
Destination • • • • • • • • • • • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
After a MVM instruction is executed, the arithmetic status bits in the status file
are updated. The arithmetic status bits are in word 0 bits 0-3 in the processor
status file (S2).
Notes:
File Instructions
Table 1:
The CPW instruction copies words of data, in ascending order, from one
location (Source) to another (Destination). Although similar to the File Copy
(COP) instruction, the CPW instruction allows different source and destination
parameters. Examples include:
• integer to long word
• long word to floating point
• long word to integer
• integer to PTOX function file
Addressing Modes and File Types are shown in the following table:
Address
Data Files Function Files Address Level
Mode(2)
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
ST(1)
HSC
LCD
RTC
PLS
BHI
A(1)
STI
Bit
EII
N
O
B
S
L
I
Source • • • • • • • • • • • • • • • • • • • • •
Destination • • • • • • • • • • • • • • • • • •
Length •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
The COP instruction copies blocks of data from one location into another.
Address
Data Files Function Files Address Level
Mode(1)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Source • • • • • • • • • • • • •
Destination • • • • • • • • • • • • •
Length •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
The source and destination file types must be the same except bit (B) and integer
(N); they can be interchanged. It is the address that determines the maximum
length of the block to be copied, as shown in the following table:
The FLL instruction loads elements of a file with either a constant or an address
data value for a given length. The following figure shows how file instruction data
is manipulated. The instruction fills the words of a file with a source value. It uses
no status bits. If you need an enable bit, program a parallel output that uses a
storage address.
Destination
Source
Word to File
TIP The source and destination operands must be of the same file
type, unless they are bit (B) and integer (N).
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(1)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Source • • • • • • • • • • • • • • •
Destination • • • • • • • • • • • •
Length •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC,
HSC, PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS
files.
The BSL instruction loads data into a bit array on a false-to-true rung transition,
one bit at a time. The data is shifted left through the array, then unloaded, one bit
at a time. The following figure shows the operation of the BSL instruction.
Source Bit
I:22/12
Unload Bit
(R6:0/10)
If you wish to shift more than one bit per scan, you must create a loop in your
application using the JMP, LBL, and CTU instructions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN(1) -- DN (2)
-- ER (3)
UL (4)
not used
Word 1 Size of bit array (number of bits).
Word 2 not used
(1) EN - Enable Bit is set on false-to-true transition of the rung and indicates the instruction is enabled.
(2) DN - Done Bit, when set, indicates that the bit array has shifted one position.
(3) ER - Error Bit, when set, indicates that the instruction detected an error such as entering a negative number for the
length or source operand.
(4) UL - Unload Bit is the instruction’s output. Avoid using the UL (unload) bit when the ER (error) bit is set.
• Bit Address - The source is the address of the bit to be transferred into the
bit array at the first (lowest) bit position.
• Length - The length operand contains the length of the bit array in bits.
The valid data range for length is from 0…2048.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(2)
DLS - Data Log
PTOX, PWMX
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
File • • • • • • • • • •
Control (1) • •
Length • •
Source • • • • • • • • •
(1) Control file only. Not valid for Timers and Counters.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
If you wish to shift more than one bit per scan, you must create a loop in your
application using the JMP, LBL, and CTU instructions.
The BSR instruction loads data into a bit array on a false-to-true rung transition,
one bit at a time. The data is shifted right through the array, then unloaded, one
bit at a time. The following figure shows the operation of the BSR instruction.
Unload Bit
(R6:0/10)
47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 38 Bit Array
INVALID 69 68 67 66 65 64 #B3:2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN(1) -- DN(2) -- ER(3) UL(4) not used
Word 1 Size of bit array (number of bits).
Word 2 not used
(1) EN - Enable Bit is set on false-to-true transition of the rung and indicates the instruction is enabled.
(2) DN - Done Bit, when set, indicates that the bit array has shifted one position.
(3) ER - Error Bit, when set, indicates that the instruction detected an error such as entering a negative number for the
length or source operand.
(4) UL - Unload Bit is the instruction’s output. Avoid using the UL (unload) bit when the ER (error) bit is set.
• Bit Address - The source is the address of the bit to be transferred into the
bit array at the last (highest) bit position.
• Length - The length operand contains the length of the bit array in bits.
The data range for length is from 0…2048.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(2)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
F
L
I
File • • • • • • • • • •
Control (1) • •
Length • •
Source • • • • • • • • •
(1) Control file only. Not valid for Timers and Counters.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
On a false-to-true rung transition, the FFL instruction loads words or long words
into a user-created file called a FIFO stack. This instruction’s counterpart, FIFO
unload (FFU), is paired with a given FFL instruction to remove elements from
the FIFO stack. Instruction parameters have been programmed in the FFL - FFU
instruction pair shown below.
FFL
FIFO LOAD (EN) Destination Position
Source N7:10 (DN) N7:11 N7:12 0
FIFO #N7:12 (EM)
Control R6:0 N7:13 1
Length 34
Position 9 FFU instruction N7:14 2
unloads data from 3
FFU stack #N7:12 at 4
FIFO UNLOAD (EU) position 0, N7:12
FIFO #N7:12 (DN) 5 34 words are allocated
Dest N7:11 (EM)
Control R6:0 6 for FIFO stack starting
Length 34 at N7:12, ending at
Position 9 7
N7:45
FFL and FFU Instruction Pair Source 8
N7:10 9
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN(1) -- DN (2)
EM (3)
not used
Word 1 Length - maximum number of words or long words in the stack.
Word 2 Position - the next available location where the instruction loads data.
(1) EN - Enable Bit is set on false-to-true transition of the rung and indicates the instruction is enabled.
(2) DN - Done Bit, when set, indicates that the stack is full.
• Length - The length operand contains the number of elements in the FIFO
stack to receive the value or constant found in the source. The length of the
stack can range from 1…128 (word) or 1…64 (long word). The position is
incremented after each load.
• Position - This is the current location pointed to in the FIFO stack. It
determines the next location in the stack to receive the value or constant
found in source. Position is a component of the control register. The
position can range from 0…127 (word) or 0…63 (long word).
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(2)
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
Source • • • • • • • • • • • •
FIFO • • • • • • • • • •
Control (1) • •
Length • •
Position • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
FFL
FIFO LOAD (EN) Destination Position
Source N7:10 (DN) N7:11 N7:12 0
FIFO #N7:12 (EM)
Control R6:0 N7:13 1
Length 34
Position 9 FFU instruction N7:14 2
unloads data from 3
FFU stack #N7:12 at 4
FIFO UNLOAD (EU) position 0, N7:12
FIFO #N7:12 (DN) 5 34 words are allocated
Dest N7:11 (EM)
Control R6:0 6 for FIFO stack starting
Length 34 at N7:12, ending at
Position 9 7
N7:45
FFL and FFU Instruction Pair Source 8
N7:10 9
• Control - This is a control file address. The status bits, stack length, and
the position value are stored in this element. The control element consists
of 3 words:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 -- EU(1) DN (2)
EM (3)
not used
Word 1 Length - maximum number of words or long words in the stack.
Word 2 Position - the next available location where the instruction unloads data.
(1) EU - Enable Unload Bit is set on false-to-true transition of the rung and indicates the instruction is enabled.
(2) DN - Done Bit, when set, indicates that the stack is full.
• Length - The length operand contains the number of elements in the FIFO
stack. The length of the stack can range from 1…128 (word) or 1…64 (long
word).
• Position - Position is a component of the control register. The position can
range from 0…127 (word) or 0…63 (long word). The position is
decremented after each unload. Data is unloaded at position zero.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(2)
DLS - Data Log
PTOX, PWMX
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
FIFO • • • • • • • • • •
Destination • • • • • • • • • • •
Control (1) • •
Length • •
Position • •
(1) Control file only. Not valid for Timers and Counters.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX, PWMX,
STI, EII, BHI, MMI, CS, IOS, and DLS files.
On a false-to-true rung transition, the LFL instruction loads words or long words
into a user-created file called a LIFO stack. This instruction’s counterpart, LIFO
unload (LFU), is paired with a given LFL instruction to remove elements from
the LIFO stack. Instruction parameters have been programmed in the LFL - LFU
instruction pair shown below.
LFL Destination Position
LIFO LOAD (EN)
Source N7:10 (DN) N7:11 N7:12 0
LIFO #N7:12 (EM)
Control R6:0 N7:13 1
Length 34
Position 9 LFU instruction N7:14 2
unloads data from 3
LFU stack #N7:12 at 4
LIFO UNLOAD (EU) position 0, N7:12
LIFO #N7:12 (DN) 5 34 words are allocated
Dest N7:11 (EM)
Control R6:0 6 for FIFO stack starting
Length 34 at N7:12, ending at
Position 9 7
N7:45
LFL and LFU Instruction Pair Source 8
N7:10 9
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN(1) -- DN (2)
EM (3)
not used
Word 1 Length - maximum number of words or long words in the stack.
Word 2 Position - the next available location where the instruction loads data.
(1) EN - Enable Bit is set on false-to-true transition of the rung and indicates the instruction is enabled.
(2) DN - Done Bit, when set, indicates that the stack is full.
• Length - The length operand contains the number of elements in the FIFO
stack to receive the value or constant found in the source. The length of the
stack can range from 1…128 (word) or 1…64 (long word). The position is
incremented after each load.
• Position - This is the current location pointed to in the LIFO stack. It
determines the next location in the stack to receive the value or constant
found in source. Position is a component of the control register. The
position can range from 0…127 (word) or 0…63 (long word).
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(2)
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Source • • • • • • • • • • • •
LIFO • • • • • • • • • •
Control (1) • •
Length • •
Position • •
(1) Control file only. Not valid for Timers and Counters.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 -- EU(1) DN (2)
EM (3)
not used
Word 1 Length - maximum number of words or double words in the stack.
Word 2 Position - the next available location where the instruction unloads data.
(1) EU - Enable Unload Bit is set on false-to-true transition of the rung and indicates the instruction is enabled.
(2) DN - Done Bit, when set, indicates that the stack is full.
Address
Data Files Function Files Address Level
Mode(2)
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
B
S
L
I
LIFO • • • • • • • • • •
Destination • • • • • • • • • • •
Control (1) • •
Length • •
Position • •
(1) Control file only. Not valid for Timers and Counters.
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Use the SWP instruction to swap the low and high bytes of a specified number of
words in a bit, integer, or string file. The SWP instruction has 2 operands:
• Source is the word address containing the words to be swapped.
• Length is the number of words to be swapped, regardless of the file type.
The address is limited to integer constants. For bit and integer filetypes,
the length range is 1…128. For the string filetype, the length range is 1…41.
Note that this instruction is restricted to a single string element and cannot
cross a string element boundary.
Addressing Modes and File Types can be used as shown in the following table:
CS - Comms
Long Word
er
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Source • • • • • • •
Length • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
Example:
SWP
SWP Source Value before executing SWP instruction: a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g
Swap Source Value before executing SWP instruction: b a d c f e h g j i l k n m p o r q t s v u x w z y a b c d e f g
Source #ST10:1.DATA[0]
Length 13
The underlined characters show the 13 words where the low byte was swapped
with the high byte.
Notes:
Sequencer Instructions
Use the sequencer compare instruction to detect when a step is complete; use the
sequencer output instruction to set output conditions for each step. Use the
sequencer load instruction to load data into the sequencer file.
You can use bit integer or double integer files with sequencer instructions.
When the status of all non-masked bits in the source word match those of the
corresponding reference word, the instruction sets the found bit (FD) in the
control word. Otherwise, the found bit (FD) is cleared.
The bits mask data when reset (0) and pass data when set (1).
The mask can be fixed or variable. If you enter a hexadecimal code, it is fixed. If
you enter an element address or a file address (direct or indirect) for changing the
mask with each step, it is variable.
When the rung goes from false-to-true, the instruction increments to the next
step (word) in the sequencer file. Data stored there is transferred through a mask
and compared against the source for equality. While the rung remains true, the
source is compared against the reference data for every scan. If equal, the FD bit is
set in the SQCs control counter.
SQC
SQC
Sequencer Compare EN
File #B10:11
Mask FFF0 DN
Source I:3.0
Control R6:21 FD
Length 4<
Position 2<
SQC FD bit is set when the instruction detects that an input word matches
(through mask) its corresponding reference word.
The FD bit R6:21/FD is set in the example, since the input word matches the
sequencer reference value using the mask value.
TIP If file type is word, then mask and source must be words. If
file type is long word, mask and source must be long
words.
• Mask - The mask operand contains the mask constant, word, or file which
is applied to both file and source. When mask bits are set to 1, data is
allowed to pass through for comparison. When mask bits are reset to 0, the
data is masked (does not pass through to for comparison). The immediate
data ranges for mask are from 0…0xFFFF or 0…0xFFFFFFFF.
.
TIP If mask is direct or indirect, the position selects the location in
the specified file.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN(1) -- DN(2) -- ER(3) not used FD(4) not used
Word 1 Length - contains the number of steps in the sequencer reference file.
Word 2 Position - the current position in the sequence
(1) EN - Enable Bit is set by a false-to-true rung transition and indicates that the instruction is enabled.
(2) DN - Done Bit is set after the instruction has operated on the last word in the sequencer file. It is reset on the next
false-to-true rung transition after the rung goes false.
(3) ER - Error Bit is set when the controller detects a negative position value, or a negative or zero length value. When the
ER bit is set, the minor error bit (S2:5/2) is also set.
(4) FD - Found bit is set when the status of all non-masked bits in the source address match those of the word in the
sequencer reference file. This bit is assessed each time the SQC instruction is evaluated while the rung is true.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(2)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
File • • • • • • • • • •
Mask • • • • • • • • • • • •
Source • • • • • • • • • • •
Control (1) • •
Length • •
Position • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, LCD, and DLS files.
The done bit is set when the last word of the sequencer file is transferred. On the
next false-to-true rung transition, the instruction resets the position to step one.
If the position is equal to zero at start-up, when you switch the controller from the
program mode to the run mode, the instruction operation depends on whether
the rung is true or false on the first scan.
• If the rung is true, the instruction transfers the value in step zero.
• If the rung is false, the instruction waits for the first rung transition from
false-to-true and transfers the value in step one.
The bits mask data when reset (0) and pass data when set (1). The instruction will
not change the value in the destination word unless you set mask bits.
The mask can be fixed or variable. It is fixed if you enter a hexadecimal code. It is
variable if you enter an element address or a file address (direct or indirect) for
changing the mask with each step.
SQO
SQO
Sequencer Output EN
File #B10:1
Mask 0F0F DN
Dest O14:0
Control R6:20
Length 4<
Position 2<
• Mask - The mask operand contains the mask value. When mask bits are set
to 1, data is allowed to pass through to destination. When mask bits are
reset to 0, the data is masked (does not pass through to destination). The
immediate data ranges for mask are from 0…0xFFFF (word) or
0…0xFFFFFFFF (long word).
TIP If mask is direct or indirect, the position selects the
location in the specified file.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN(1) -- DN(2) -- ER(3) not used FD not used
Word 1 Length - contains the index of the last element in the sequencer reference file
Word 2 Position - the current position in the sequence
(1) EN - Enable Bit is set by a false-to-true rung transition and indicates that the instruction is enabled.
(2) DN - Done Bit is set after the instruction has operated on the last word in the sequencer file. It is reset on the next
false-to-true rung transition after the rung goes false.
(3) ER - Error Bit is set when the controller detects a negative position value, or a negative or zero length value. When the
ER bit is set, the minor error bit (S2:5/2) is also set.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(3)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
File(1) • • • • • • • • • •
Mask(1) • • • • • • • • • • • •
(1) • • • • • • • • • • •
Destination
Control (2) • •
Length • •
Position • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, LCD, and DLS files.
On a false-to-true rung transition, the SQL instruction loads words or long words
into a sequencer file at each step of a sequencer operation. This instruction uses
the following operands:
• File - This is the sequencer reference file. Its contents are received on an
element-by-element basis from the source.
TIP If file type is word, then mask and source must be words. If
file type is long word, mask and source must be long
words.
• Source - The source operand is a constant or address of the value used to fill
the currently available position sequencer file. The address level of the
source must match the sequencer file. If file is a word type, then source
must be a word type. If file is a long word type, then source must be a long
word type. The data range for the source is from -32,768…32,767 (word)
or -2,147,483,648…2,147,483,647 (long word).
• Control - This is a control file address. The status bits, stack length, and
the position value are stored in this element. The control element consists
of 3 words:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN(1) -- DN (2)
-- ER (3)
not used FD not used
Word 1 Length - contains the index of the last element in the sequencer reference file
Word 2 Position - the current position in the sequence
(1) EN - Enable Bit is set by a false-to-true rung transition and indicates that the instruction is enabled.
(2) DN - Done Bit is set after the instruction has operated on the last word in the sequencer file. It is reset on the next
false-to-true rung transition after the rung goes false.
(3) ER - Error Bit is set when the controller detects a negative position value, or a negative or zero length value. When the
ER bit is set, the minor error bit (S2:5/2) is also set.
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode(3)
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
File(1) • • • • • • • • • •
Source(1) • • • • • • • • • • •
Control (2) • •
Length • •
Position • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC, PTOX,
PWMX, STI, EII, BHI, MMI, CS, IOS, LCD, and DLS files.
Notes:
Use these instructions to change the order in which the processor scans a ladder
program. Typically these instructions are used to minimize scan time, create a
more efficient program, and troubleshoot a ladder program.
The JMP instruction causes the controller to change the order of ladder
execution. Jumps cause program execution to go to the rung marked LBL label
number. Jumps can be forward or backward in ladder logic within the same
program file. Multiple JMP instructions may cause execution to proceed to the
same label.
The immediate data range for the label is from 0…999. The label is local to a
program file.
The immediate data range for the label is from 0…999. The label is local to a
program file.
The JSR instruction causes the controller to start executing a separate subroutine
file within a ladder program. JSR moves program execution to the designated
subroutine (SBR file number). After executing the SBR, control proceeds to the
instruction following the JSR instruction.
The immediate data range for the JSR file is from 3…255.
The SBR instruction is a label which is not used by the processor. It is for user
subroutine identification purposes as the first rung for that subroutine. This
instruction is the first instruction on a rung and is always evaluated as true.
The RET instruction marks the end of subroutine execution or the end of the
subroutine file. It causes the controller to resume execution at the instruction
following the JSR instruction, user interrupt, or user fault routine that caused this
subroutine to execute.
On a true rung within the main program (file 2), TND will stop the processor
from scanning the rest of the main program and go directly to the end-of-scan
aspects of the processor scan cycle. On a true rung within a subroutine program,
TND will return from the subroutine and continue to scan the rest of the main
program (file 2). If this instruction is executed in a nested subroutine, it
terminates execution of all nested subroutines.
The END instruction must appear at the end of every ladder program. For the
main program file (file 2), this instruction ends the program scan. For a
subroutine, interrupt, or user fault file, the END instruction causes a return from
subroutine.
The MCR instruction works in pairs to control the ladder logic found between
those pairs. Rungs within the MCR zone are still scanned, but scan time is
reduced due to the false state of non-retentive outputs. Non-retentive outputs are
reset when the rung goes false.
This instruction defines the boundaries of an MCR Zone. An MCR Zone is the
set of ladder logic instructions bounded by an MCR instruction pair. The start of
an MCR zone is defined to be the rung that contains an MCR instruction
preceded by conditional logic. The end of an MCR zone is defined to be the first
rung containing just an MCR instruction following a start MCR zone rung as
shown below.
I:1
0030 MCR
0
0031
Ladder Logic within MCR Zone
0032
0033 MCR
While the rung state of the first MCR instruction is true, execution proceeds as if
the zone were not present. When the rung state of the first MCR instruction is
false, the ladder logic within the MCR zone is executed as if the rung is false. All
non-retentive outputs within the MCR zone are reset.
MCR zones let you enable or inhibit segments of your program, such as for recipe
applications.
Notes:
The input and output instructions allow you to selectively update data without
waiting for the input and output scans.
The IIM instruction allows you to selectively update input data without waiting
for the automatic input scan. This instruction uses the following operands:
• Slot - This operand defines the location where data is obtained for
updating the input file. The location specifies the slot number and the
word where data is to be obtained. For example, if slot = I:0, input data
from slot 0 starting at word 0 is masked and placed in input data file I:0
starting at word 0 for the specified length. If slot = I:0.1, word 1 of slot 0 is
used, and so on.
IMPORTANT Slot 0 is the only valid slot number that can be used with this
instruction. IIM cannot be used with expansion I/O.
• Mask - The mask is a hex constant or register address containing the mask
value to be applied to the slot. If a given bit position in the mask is a “1”, the
corresponding bit data from slot is passed to the input data file. A “0”
prohibits corresponding bit data in slot from being passed to the input data
file. The mask value can range from 0…0xFFFF.
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Real Input Input Word
Mask 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Input Data Data is Not Updated Updated to Match Input Word
File
• Length - This is the number of masked words to transfer to the input data
file.
Address
Data Files Function Files Address Level
Mode
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Slot • • • •
Mask • • • • • • • • •
Length •
The IOM instruction allows you to selectively update output data without
waiting for the automatic output scan. This instruction uses the following
operands:
• Slot - The slot is the physical location that is updated with data from the
output file.
IMPORTANT Slot 0 is the only valid slot number that can be used with this
instruction. IOM cannot be used with expansion I/O.
• Mask - The mask is a hex constant or register address containing the mask
value to be applied. If a given bit position in the mask is a “1”, the
corresponding bit data is passed to the physical outputs. A “0” prohibits
corresponding bit data from being passed to the outputs. The mask value
can range from 0…0xFFFF.
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Output Data Output Word
Mask 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Real Outputs Data is Not Updated Updated to Match Output Word
Address
Data Files Function Files Address Level
Mode
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Slot • • • •
Mask • • • • • • • • •
Length •
The REF instruction is used to interrupt the program scan to execute the
I/O scan and service communication portions of the operating cycle for all
communication channels. This includes: write outputs, service communications
(all communication channels, communications toggle functionality, and comms
housekeeping), and read inputs.
TIP Using an REF instruction may result in input data changing in the
middle of a program scan. This condition needs to be evaluated when
using the REF instruction.
Using Interrupts
Interrupts allow you to interrupt your program based on defined events. This
chapter contains information about using interrupts, the interrupt instructions,
and the interrupt function files. The chapter is arranged as follows:
• Information About Using Interrupts on page 263.
• User Interrupt Instructions on page 267.
• Using the Selectable Timed Interrupt (STI) Function File on page 272.
• Using the Event Input Interrupt (EII) Function File on page 276.
See also: Using the High-Speed Counter and Programmable Limit Switch on
page 75.
Information About Using The purpose of this section is to explain some fundamental properties of the User
Interrupts, including:
Interrupts
• What is an interrupt?
• When can the controller operation be interrupted?
• Priority of User Interrupts
• Interrupt Latency
• User Fault Routine
What is an Interrupt?
An interrupt is an event that causes the controller to suspend the task it is
currently performing, perform a different task, and then return to the suspended
task at the point where it suspended. The Micrologix 1400 supports the
following User Interrupts:
• User Fault Routine
• Event Interrupts (8)
• High-Speed Counter Interrupts (6)
• Selectable Timed Interrupt
An interrupt must be configured and enabled to execute. When any one of the
interrupts is configured (and enabled) and subsequently occurs, the user
program:
When multiple interrupts occur, the interrupts are serviced based upon their
individual priority.
When an interrupt occurs and another interrupt(s) has already occurred but has
not been serviced, the new interrupt is scheduled for execution based on its
priority relative to the other pending interrupts. At the next point in time when
an interrupt can be serviced, all the interrupts are executed in the sequence of
highest priority to lowest priority.
The user fault routine gives you the option of preventing a controller shutdown
when a specific user fault occurs. The fault routine is executed when any
recoverable or non-recoverable user fault occurs. The fault routine is not executed
for non-user faults.
Fault Types
Recoverable Non-Recoverable Non-User Fault
Recoverable Faults are caused Non-Recoverable Faults are Non-User Faults are caused by
by the user and may be caused by the user, and cannot various conditions that cease
recovered from by executing be recovered from. The user ladder program execution. The
logic in the user fault routine. fault routine executes when this user fault routine does not
The user can attempt to clear type of fault occurs. However, execute when this type of fault
the Major Error Halted bit, the fault cannot be cleared. occurs.
S:1/13. Note: You may initiate a MSG
Note: You may initiate a MSG instruction to another device to
instruction from the controller identify the fault condition of
to another device to identify the controller.
the fault condition of the
controller.
The Arithmetic Flags (Status File word S:0) are saved on entry to the user fault
subroutine and re-written upon exiting the subroutine.
Controller Operation
The INT instruction is used as a label to identify a user interrupt service routine
(ISR). This instruction is placed as the first instruction on a rung and is always
evaluated as true. Use of the INT instruction is optional.
The STS instruction can be used to start and stop the STI function or to change
the time interval between STI user interrupts. The STI instruction has one
operand:
• Time - This is the amount of time (in milliseconds) which must expire
prior to executing the selectable timed user interrupt. A value of zero
disables the STI function. The time range is from 0…65,535 milliseconds.
The STS instruction applies the specified set point to the STI function as
follows:
• If a zero set point is specified, the STI is disabled and STI:0/TIE is cleared
(0).
• If the STI is disabled (not timing) and a value greater than 0 is entered into
the set point, the STI starts timing to the new set point and STI:0/TIE is
set (1).
• If the STI is currently timing and the set point is changed, the new setting
takes effect immediately and the STI continues to time until it reaches the
new set point.
Note that if the new setting is less than the current accumulated time, the
STI times-out immediately. For example, if the STI has been timing for 15
microseconds, and the STI set point is changed from 20 microseconds to
10 microseconds, an STI user interrupt occurs at the next start-of-rung.
Addressing Modes and File Types can be used as shown below:
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Time • • • • • • • • • •
IMPORTANT You cannot use indirect addressing with: S, MG, PD, RTC, HSC,
PTOX, PWMX, STI, EII, BHI, MMI, CS, IOS, and DLS files.
The UID instruction is used to disable selected user interrupts. The table below
shows the types of interrupts with their corresponding disable bits:
To disable interrupt(s):
The UIE instruction is used to enable selected user interrupts. The table below
shows the types of interrupts with their corresponding enable bits:
To enable interrupt(s):
The UIF instruction is used to flush (remove pending interrupts from the
system) selected user interrupts. The table below shows the types of interrupts
with their corresponding flush bits:
To flush interrupt(s):
The Selectable Timed Interrupt (STI) provides a mechanism to solve time critical
control requirements. The STI is a trigger mechanism that allows you to scan or
solve control program logic that is time sensitive.
The PFN (Program File Number) variable defines which subroutine is called
(executed) when the timed interrupt times out. A valid subroutine file is any
program file (3…255).
The subroutine file identified in the PFN variable is not a special file within the
controller; it is programmed and operates the same as any other program file.
From the control program perspective it is unique, in that it is automatically
scanned based on the STI set point.
Error codes detected by the STI sub-system are displayed in this register. The
table below explains the error codes.
STI Error Code
Error Recoverable Fault Description
Code (Controller)
1 Invalid Program File Program file number is less than 3, greater than 255, or does not
Number exist.
The UIX (User Interrupt Executing) bit is set whenever the STI mechanism
completes timing and the controller is scanning the STI PFN. The UIX bit is
cleared when the controller completes processing the STI subroutine.
The STI UIX bit can be used in the control program as conditional logic to
detect if an STI interrupt is executing.
The UIE (User Interrupt Enable) bit is used to enable or disable STI subroutine
processing. This bit must be set if you want the controller to process the STI
subroutine at the configured time interval.
If you need to restrict when the STI subroutine is processed, clear the UIE bit. An
example of when this is important is if a series of math calculations need to be
processed without interruption. Before the calculations take place, clear the UIE
bit. After the calculations are complete, set the UIE bit and STI subroutine
processing resumes.
The UIL (User Interrupt Lost) is a status flag that indicates an interrupt was lost.
The controller can process 1 active and maintain up to 2 pending user interrupt
conditions before it sets the lost bit.
This bit is set by the controller. It is up to the control program to utilize, track if
necessary, and clear the lost condition.
The UIP (User Interrupt Pending) is a status flag that represents an interrupt is
pending. This status bit can be monitored or used for logic purposes in the
control program if you need to determine when a subroutine cannot execute
immediately.
This bit is automatically set and cleared by the controller. The controller can
process 1 active and maintain up to 2 pending user interrupt conditions before it
sets the lost bit.
The TIE (Timed Interrupt Enabled) control bit is used to enable or disable the
timed interrupt mechanism. When set (1), timing is enabled, when clear (0)
timing is disabled. If this bit is cleared (disabled) while the timer is running, the
accumulated value is cleared (0). If the bit is then set (1), timing starts.
This bit is controlled by the user program and retains its value through a power
cycle.
The AS (Auto Start) is a control bit that can be used in the control program. The
auto start bit is configured with the programming device and stored as part of the
user program. The auto start bit automatically sets the STI Timed Interrupt
Enable (TIE) bit when the controller enters any executing mode.
The ED (Error Detected) flag is a status bit that can be used by the control
program to detect if an error is present in the STI sub-system. The most common
type of error that this bit represents is a configuration error. When this bit is set,
the user should look at the error code in parameter STI:0.ER
When the controller transitions to an executing mode, the SPM (set point in
milliseconds) value is loaded into the STI. If the STI is configured correctly, and
enabled, the program file identified in the STI variable PFN is scanned at this
interval. This value can be changed from the control program by using the STS
instruction.
TIP The minimum value cannot be less than the time required to scan the
STI program file (STI:0.PFN) plus the Interrupt Latency.
Using the Event Input The EII (event input interrupt) is a feature that allows the user to scan a specific
program file (subroutine) when an input condition is detected from a field
Interrupt (EII) Function File device.
Within the function file section of RSLogix 500/RSLogix Micro, the user sees
an EII folder. Within the folder are eight EII elements. Each of these elements
(EII:0, EII:1, EII:2, EII:3, EII:4, EII:5, EII6 and EII7) are identical; this
explanation uses EII:0 as shown below.
Each EII can be configured to monitor any one of the first eight inputs (I1:0.0/0
to I1:0.0/7). Each EII can be configured to detect rising edge or falling edge input
signals. When the configured input signal is detected at the input terminal, the
controller immediately scans the configured subroutine.
PFN (Program File Number) defines which subroutine is called (executed) when
the input terminal assigned to EII:0 detects a signal. A valid subroutine file is any
program file (3…255).
The subroutine file identified in the PFN variable is not a special file within the
controller. It is programmed and operated the same as any other program file.
From the control program perspective it is unique, in that it is automatically
scanned based on the configuration of the EII.
Any ER (Error Code) detected by the EII sub-system is displayed in this register.
The table below explains the error codes.
The UIX (User Interrupt Executing) bit is set whenever the EII mechanism
detects a valid input and the controller is scanning the PFN. The EII mechanism
clears the UIX bit when the controller completes its processing of the EII
subroutine.
The EII UIX bit can be used in the control program as conditional logic to detect
if an EII interrupt is executing.
The UIE (User Interrupt Enable) bit is used to enable or disable EII subroutine
processing. This bit must be set if you want the controller to process the EII
subroutine when an EII event occurs.
If you need to restrict when the EII subroutine is processed, clear the UIE bit. An
example of when this is important is if a series of math calculations need to be
processed without interruption. Before the calculations take place, clear the UIE
bit. After the calculations are complete, set the UIE bit and EII subroutine
processing resumes.
UIL (User Interrupt Lost) is a status flag that represents an interrupt has been
lost. The controller can process 1 active and maintain up to 2 pending user
interrupt conditions before it sets the lost bit.
This bit is set by the controller. It is up to the control program to utilize, track,
and clear the lost condition.
This bit is automatically set and cleared by the controller. The controller can
process 1 active and maintain up to 2 pending user interrupt conditions before it
sets the pending bit.
EIE (Event Interrupt Enabled) allows the event interrupt function to be enabled
or disabled from the control program. When set (1), the function is enabled,
when cleared (0, default) the function is disabled.
This bit is controlled by the user program and retains its value through a power
cycle.
AS (Auto Start) is a control bit that can be used in the control program. The auto
start bit is configured with the programming device and stored as part of the user
program. The auto start bit automatically sets the EII Event Interrupt Enable
(EIE) bit when the controller enters any executing mode.
The ED (Error Detected) flag is a status bit that can be used by the control
program to detect if an error is present in the EII sub-system. The most common
type of error that this bit represents is a configuration error. When this bit is set,
look at the specific error code in parameter EII:0.ER
The ES (Edge Select) bit selects the type of trigger that causes an Event Interrupt.
This bit allows the EII to be configured for rising edge (off-to-on, 0-to-1) or
falling edge (on-to-off, 1-to-0) signal detection. This selection is based on the
type of field device that is connected to the controller.
The default condition is 1, which configures the EII for rising edge operation.
The IS (Input Select) parameter is used to configure each EII to a specific input
on the controller. Valid inputs are 0…7, which correspond to I1:0.0/0…I1:0.0/7.
The PID Concept The PID instruction normally controls a closed loop using inputs from an analog
input module and providing an output to an analog output module. For
temperature control, you can convert the analog output to a time proportioning
on/off output for driving a heater or cooling unit. An example appears on page
298.
The PID instruction can be operated in the timed mode or the Selectable Time
Interrupt (STI mode). In the timed mode, the instruction updates its output
periodically at a user-selectable rate. In the STI mode, the instruction should be
placed in an STI interrupt subroutine. It then updates its output every time the
STI subroutine is scanned. The STI time interval and the PID loop update rate
must be the same in order for the equation to execute properly. See Using the
Selectable Timed Interrupt (STI) Function File on page 272 for more
information on STI interrupts.
PID closed loop control holds a process variable at a desired set point. A flow
rate/fluid level example is shown below.
Feed Forward Bias
Level
Detector
Control Valve
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. Alternately, the smaller the error, the smaller the output
signal. An additional value (feed forward or bias) can be added to the control
output as an offset. The PID result (control variable) drives the process variable
toward the set point.
The PID Equation The PID instruction uses the following algorithm:
The derivative term (rate) provides smoothing by means of a low-pass filter. The
cut-off frequency of the filter is 16 times greater than the corner frequency of the
derivative term.
PD Data File
The PID instruction implemented by the MicroLogix 1400 controllers is
virtually identical in function to the PID implementation used by the
Allen-Bradley SLC 5/03 and higher processors. Minor differences primarily
involve enhancements to terminology. The major difference is that the PID
instruction now has its own data file. In the SLC family of processors, the PID
instruction operated as a block of registers within an integer file. The Micrologix
1400 PID instruction utilizes a PD data file.
You can create a PD data file by creating a new data file and classifying it as a PD
file type. RSLogix automatically creates a new PD file or a PD sub-element
whenever a PID instruction is programmed on a rung. The PD file then appears
in the list of Data Files as shown in the illustration.
Each PD data file has a maximum of 255 elements and each PID instruction
requires a unique PD element. Each PD element is composed of 20 sub-elements,
which include bit, integer and long integer data. All of the examples in this
chapter use PD file 10 sub-element 0.
TIP In order to stop and restart the PID instruction, you need to create
a false-to-true rung transition.
The example below shows a PID instruction on a rung with RSLogix 500/
RSLogix Micro programming software.
B3:0 PIDPID
0047 PID
0 PID File PD8:0
Process Variable N7:0
Control Variable N7:1
Setup Screen
When programming, the setup screen provides access to the PID instruction
configuration parameters. The illustration below shows the RSLogix 500/
RSLogix Micro setup screen.
Input Parameters The table below shows the input parameter addresses, data formats, and types of
user program access. See the indicated pages for descriptions of each parameter.
Input Parameter Descriptions Address Data Format Range Type User For More
Program Information
Access
SPS - Setpoint PD10:0.SPS word (INT) 0…16383(1) control read/write 284
PV - Process Variable user defined word (INT) 0…16383 control read/write 284
MAXS - Setpoint Maximum PD10:0.MAXS word (INT) -32,768…+32,767 control read/write 285
MINS - Setpoint Minimum PD10:0.MINS word (INT) -32,768…+32,767 control read/write 285
OSP - Old Setpoint Value PD10:0.OSP word (INT) -32,768…+32,767 status read only 285
OL - Output Limit PD10:0/OL binary 1 = enabled control read/write 285
0 = disabled
CVH - Control Variable High Limit PD10:0.CVH word (INT) 0…100% control read/write 286
CVL - Control Variable Low Limit PD10:0.CVL word (INT) 0…100% control read/write 286
(1) The range listed in the table is for when scaling is not enabled. With scaling, the range is from minimum scaled (MINS) to maximum scaled (MAXS).
Setpoint (SPS)
Input Parameter Address Data Format Range Type User Program
Descriptions Access
SPS - Setpoint PD10:0.SPS word (INT) 0…16383(1) control read/write
(1) The range listed in the table is for when scaling is not enabled. With scaling, the range is from minimum scaled
(MINS) to maximum scaled (MAXS).
The SPS (Setpoint) is the desired control point of the process variable.
If the SPV is read in engineering units, then the MAXS (Setpoint Maximum)
parameter corresponds to the value of the setpoint in engineering units when the
control input is at its maximum value.
If the SPV is read in engineering units, then the MINS (Setpoint Minimum)
parameter corresponds to the value of the setpoint in engineering units when the
control input is at its minimum value.
TIP MinS - MaxS scaling allows you to work in engineering units. The
deadband, error, and SPV are also displayed in engineering units.
The process variable, PV, must be within the range of 0…16383.
Use of MinS - MaxS does not minimize PID PV resolution.
Scaled errors greater than +32767 or less than -32768 cannot be represented. If
the scaled error is greater than +32767, it is represented as +32767. If the scaled
error is less than -32768, it is represented as -32768.
The OSP (Old Setpoint Value) is substituted for the current setpoint, if the
current setpoint goes out of range of the setpoint scaling (limiting) parameters.
When the output limit bit (PD10:0/OL) is enabled (1), the CVH (Control
Value High) you enter is the maximum output (in percent) that the control
variable attains. If the calculated CV exceeds the CVH, the CV is set (overridden)
to the CVH value you entered and the upper limit alarm bit (UL) is set.
When the output limit bit (PD10:0/OL) is disabled (0), the CVH value you
enter determines when the upper limit alarm bit (UL) is set.
If CV exceeds the maximum value, the output is not overridden and the upper
limit alarm bit (UL) is set.
When the output limit bit (PD10:0/OL) is enabled (1), the CVL (Control Value
Low) you enter is the minimum output (in percent) that the Control Variable
attains. If the calculated CV is below the minimum value, the CV is set
(overridden) to the CVL value you entered and the lower limit alarm bit (LL) is
set.
When the output limit bit (PD10:0/OL) is disabled (0), the CVL value you
enter determines when the lower limit alarm bit (LL) is set. If CV is below the
minimum value, the output is not overridden and the lower limit alarm bit (LL)
is set.
Output Parameters The table below shows the output parameter addresses, data formats, and types of
user program access. See the indicated pages for descriptions of each parameter.
Output Parameter Descriptions Address Data Format Range Type User Program For More
Access Information
CV - Control Variable User-defined word (INT) 0…16,383 control read/write 287
CVP - Control Variable Percent PD10:0.CVP word (INT) 0…100 control read/write 287
SPV - Scaled Process Variable PD10:0.SPV word (INT) 0…16383 status read only 288
CVP (Control Variable Percent) displays the control variable as a percentage. The
range is 0…100%.
If the PD10:0/AM bit is off (automatic mode), CVP tracks the control variable
(CV) output being calculated by the PID equation.
If the PD10:0/AM bit is on (manual mode), CVP tracks the value that can be
manipulated in the Control Variable (CV) data word.
The only way for a programmer to have control of the PID CV is to place the
PID instruction in manual mode and write to the CV word via the control
program or programming software. If no change is made to CV while in manual
mode, the CVP will display the last value calculated by the PID equation.
The SPV (Scaled Process Variable) is the analog input variable. If scaling is
enabled, the range is the minimum scaled value (MinS) to maximum scaled value
(MaxS).
Tuning Parameters The table below shows the tuning parameter addresses, data formats, and types of
user program access. See the indicated pages for descriptions of each parameter.
TIP Controller gain is affected by the reset and gain range (RG) bit. For
information, see PLC 5 Gain Range (RG) on page 293.
Reset Ti (word 4) is the Integral gain, ranging from 0…3276.7 (when RG = 0), or
327.67 (when RG = 1) minutes per repeat. Set the reset time equal to the natural
period measured in the above gain calibration. A value of 1 adds the maximum
integral term into the PID equation.
TIP Reset term is affected by the reset and gain range (RG) bit. For
information, see PLC 5 Gain Range (RG) on page 293.
TIP This word is not effected by the reset and gain range (RG) bit. For
information, see PLC 5 Gain Range (RG) on page 293.
The time mode bit specifies when the PID is in timed mode (1) or STI mode (0).
This bit can be set or cleared by instructions in your ladder program.
When set for timed mode, the PID updates the CV at the rate specified in the
loop update parameter (PD10:0.LUT).
When set for STI mode, the PID updates the CV every time the PID instruction
is scanned in the control program. When you select STI, program the PID
instruction in the STI interrupt subroutine. The STI routine should have a time
interval equal to the setting of the PID “loop update” parameter (PD10:0.LUT).
Set the STI period in word STI:0.SPM. For example, if the loop update time
contains the value 10 (for 100 ms), then the STI time interval must also equal
100 (for 100 ms).
TIP When using timed mode, your processor scan time should be at least
ten times faster than the loop update time to prevent timing
inaccuracies or disturbances.
The loop update time (word 13) is the time interval between PID calculations.
The entry is in 0.01 second intervals. Enter a loop update time five to ten times
faster than the natural period of the load. The natural period of the load is
determined by setting the reset and rate parameters to zero and then increasing
the gain until the output begins to oscillate. When in STI mode, this value must
equal the STI time interval value loaded in STI:0.SPM. The valid range is
0.01…10.24 seconds.
The deadband extends above and below the setpoint by the value entered. The
deadband is entered at the zero crossing of the process variable and the setpoint.
This means that the deadband is in effect only after the process variable enters the
deadband and passes through the setpoint.
The valid range is 0 to the scaled maximum, or 0…16,383 when no scaling exists.
The feed forward bias is used to compensate for disturbances that may affect the
CV output.
Scaled error is the difference between the process variable and the setpoint. The
format of the difference (E = SP-PV or E = PV-SP) is determined by the control
mode (CM) bit. See Control Mode (CM) on page 293.
The auto/manual bit can be set or cleared by instructions in your ladder program.
When off (0), it specifies automatic operation. When on (1), it specifies manual
operation. In automatic operation, the instruction controls the control variable
(CV). In manual operation, the user/control program controls the CV. During
tuning, set this bit to manual.
Forward acting (E=PV-SP) causes the control variable to increase when the
process variable is greater than the setpoint.
Reverse acting (E=SP-PV) causes the control variable to decrease when the
process variable is greater than the setpoint.
PV in Deadband (DB)
Tuning Parameter Address Data Format Range Type User Program
Descriptions Access
DB - PV in Deadband PD10:0/DB binary (bit) 0 or 1 status read/write
This bit is set (1) when the process variable is within the zero-crossing deadband
range.
When set (1), the reset (TI) and gain range enhancement bit (RG) causes the
reset minute/repeat value and the gain multiplier (KC) to be divided by a factor
of 10. That means a reset multiplier of 0.01 and a gain multiplier of 0.01.
When clear (0), this bit allows the reset minutes/repeat value and the gain
multiplier value to be evaluated with a reset multiplier of 0.1 and a gain multiplier
of 0.1.
Example with the RG bit set: The reset term (TI) of 1 indicates that the integral
value of 0.01 minutes/repeat (0.6 seconds/repeat) is applied to the PID integral
algorithm. The gain value (KC) of 1 indicates that the error is multiplied by 0.01
and applied to the PID algorithm.
Example with the RG bit clear: The reset term (TI) of 1 indicates that the integral
value of 0.1 minutes/repeat (6.0 seconds/repeat) is applied to the PID integral
algorithm. The gain value (KC) of 1 indicates that the error is multiplied by 0.1
and applied to the PID algorithm.
The TF bit is set by the PID algorithm if the loop update time specified cannot
be achieved by the controller due to scan time limitations.
If this bit is set, correct the problem by updating your PID loop at a slower rate or
move the PID instruction to an STI interrupt routine. Reset and rate gains will be
in error if the instruction operates with this bit set.
When set (1), the derivative (rate) action (DA) bit causes the derivative (rate)
calculation to be evaluated on the error instead of the process variable (PV).
When clear (0), this bit allows the derivative (rate) calculation to be evaluated
where the derivative is performed on the PV.
The control variable upper limit alarm bit is set when the calculated CV output
exceeds the upper CV limit.
The control variable lower limit alarm bit is set (1) when the calculated CV
output is less than the lower CV limit.
The process variable out of range bit is set (1) when the unscaled process variable
• exceeds 16,383, or
• is less than zero.
Done (DN)
Tuning Parameter Address Data Format Range Type User Program
Descriptions Access
DN - Done PD10:0/DN binary (bit) 0 or 1 status read only
The PID done bit is set (1) for one scan when the PID algorithm is computed. It
resets (0) whenever the instruction is scanned and the PID algorithm was not
computed (applies to timed mode only).
PD10:0.19Enable (EN)
Tuning Parameter Address Data Format Range Type User Program
Descriptions Access
EN - Enable PD10:0/EN binary (bit) 0 or 1 status read only
The PID enabled bit is set (1) whenever the PID instruction is enabled. It follows
the rung state.
K
This is the result of the integration ------c- ∫ E ( dt ) .
TI
This long word is used internally to track the change in the process variable
within the loop update time.
Runtime Errors Error code 0036 appears in the status file when a PID instruction runtime error
occurs. Code 0036 covers the following PID error conditions, each of which has
been assigned a unique single byte code value that appears in the MSB of the
second word of the control block. The error code is also displayed on the PID
Setup Screen in RSLogix 500/RSLogix Micro.
If you are not using setpoint scaling and If you are not using setpoint scaling, then change
0 > setpoint SP > 16383, the setpoint SP to 0 < SP < 16383.
then during the initial execution of the PID loop, this error occurs
and bit 11 of word 0 of the control block is set. However, during
subsequent execution of the PID loop if an invalid loop setpoint
is entered, the PID loop continues to execute using the old
setpoint, and bit 11 of word 0 of the control block is set.
41H Scaling Selected Scaling Deselected Scaling Selected Scaling Deselected
1. Deadband < 0, or 1. Deadband < 0, or Change deadband to Change deadband to
0 < deadband < 0 < deadband < 16383
2. Deadband > 2. Deadband > 16383 (MaxS - MinS) < 16383
(MaxS – MinS)
51H 1. Output high limit < 0, or Change output high limit to
2. Output high limit > 100 0 < output high limit < 100
52H 1. Output low limit < 0, or Change output low limit to
2. Output low limit > 100 0 < output low limit < output high limit < 100
53H Output low limit > output high limit Change output low limit to
0 < output low limit < output high limit < 100
Analog I/O Scaling To configure an analog input for use in a PID instruction, the analog data must be
scaled to match the PID instruction parameters. In the MicroLogix 1400, the
process variable (PV) in the PID instruction is designed to work with a data range
of 0…16,383. The 1762 expansion I/O analog modules ((1762-IF4, 1762-OF4,
1762-IF2OF2, 1762-IT4 and 1762-IR4)) are capable of on-board scaling. Scaling
data is required to match the range of the analog input to the input range of the
PID instruction. The ability to perform scaling in the I/O modules reduces the
amount of programming required in the system and makes PID setup much
easier.
The example shows a 1762-IF4 module. The IF4 has 4 inputs, which are
individually configurable. In this example, analog input 0 is configured for
-10…10V and is scaled in engineering units. Channel 0 is not being used in a PID
instruction. Input 1 (channel 1) is configured for 4…20 mA operation with
scaling configured for a PID instruction. This configures the analog data for the
PID instruction.
The configuration for the analog output is virtually identical. Simply address the
PID control variable (CV) to the analog output address and configure the analog
output to “Scaled for PID” behavior.
ATTENTION: Do not alter the state of any PID control block value
unless you fully understand its function and how it will affect your
process. Unexpected operation could result with possible equipment
damage and/or personal injury.
Input/Output Ranges
The input module measuring the process variable (PV) must have a full scale
binary range of 0…16383. If this value is less than 0 (bit 15 set), then a value of
zero is used for PV and the “Process var out of range” bit is set (bit 12 of word 0 in
the control block). If the process variable is greater than 16383 (bit 14 set), then a
value of 16383 is used for PV and the “Process var out of range” bit is set.
The Control Variable, calculated by the PID instruction, has the same range of
0…16383. The Control Output (word 16 of the control block) has the range of
0…100%. You can set lower and upper limits for the instruction’s calculated
output values (where an upper limit of 100% corresponds to a Control Variable
limit of 16383).
Scaling lets you enter the setpoint and zero-crossing deadband values in
engineering units, and display the process variable and error values in the same
engineering units. Remember, the process variable PV must still be within the
range 0…16383. The PV is displayed in engineering units, however.
1. Enter the maximum and minimum scaling values MaxS and MinS in the
PID control block. The MinS value corresponds to an analog value of zero
for the lowest reading of the process variable. MaxS corresponds to an
analog value of 16383 for the highest reading. These values reflect the
process limits. Setpoint scaling is selected by entering a non-zero value for
one or both parameters. If you enter the same value for both parameters,
setpoint scaling is disabled.
2. Enter the setpoint (word 2) and deadband (word 9) in the same scaled
engineering units. Read the scaled process variable and scaled error in these
units as well. The control output percentage (word 16) is displayed as a
percentage of the 0…16383 CV range. The actual value transferred to the
CV output is always between 0 and 16383.
When you select scaling, the instruction scales the setpoint, deadband, process
variable, and error. You must consider the effect on all these variables when you
change scaling.
Zero-Crossing Deadband DB
The adjustable deadband lets you select an error range above and below the
setpoint where the output does not change as long as the error remains within this
range. This lets you control how closely the process variable matches the setpoint
without changing the output.
+DB
SP Error range
-DB
Time
Zero-crossing is deadband control that lets the instruction use the error for
computational purposes as the process variable crosses into the deadband until it
crosses the setpoint. Once it crosses the setpoint (error crosses zero and changes
sign) and as long as it remains in the deadband, the instruction considers the error
value zero for computational purposes.
Select deadband by entering a value in the deadband storage word (word 9) in the
control block. The deadband extends above and below the setpoint by the value
you enter. A value of zero inhibits this feature. The deadband has the same scaled
units as the setpoint if you choose scaling.
Output Alarms
You may set an output alarm on the control variable at a selected value above and/
or below a selected output percent. When the instruction detects that the control
variable has exceeded either value, it sets an alarm bit (bit LL for lower limit, bit
UL for upper limit) in the PID instruction. Alarm bits are reset by the instruction
when the control variable comes back inside the limits. The instruction does not
prevent the control variable from exceeding the alarm values unless you select
output limiting.
Select upper and lower output alarms by entering a value for the upper alarm
(CVH) and lower alarm (CVL). Alarm values are specified as a percentage of the
output. If you do not want alarms, enter zero and 100% respectively for lower and
upper alarm values and ignore the alarm bits.
You may set an output limit (percent of output) on the control variable. When
the instruction detects that the control variable has exceeded a limit, it sets an
alarm bit (bit LL for lower limit, bit UL for upper limit), and prevents the control
variable from exceeding either limit value. The instruction limits the control
variable to 0 and 100% if you choose not to limit.
Select upper and lower output limits by setting the limit enable bit (bit OL), and
entering an upper limit (CVH) and lower limit (CVL). Limit values are a
percentage (0…100%) of the control variable.
The difference between selecting output alarms and output limits is that you
must select output limiting to enable limiting. Limit and alarm values are stored
in the same words. Entering these values enables the alarms, but not limiting.
Entering these values and setting the limit enable bit enables limiting and alarms.
Anti-reset windup is a feature that prevents the integral term from becoming
excessive when the control variable reaches a limit. When the sum of the PID and
bias terms in the control variable reaches the limit, the instruction stops
calculating the integral sum until the control variable comes back in range. The
integral sum is contained in element, IS.
In the MANUAL mode, the programmer allows you to enter a new CV value
from 0…100%. This value is converted into a number from 0…16383 and written
to the Control Variable address. If your ladder program sets the manual output
level, design your ladder program to write to the CV address when in the
MANUAL mode. Remember that the new CV value is in the range of 0…16383,
not 0…100. Writing to the CV percent (CVP) with your ladder program has no
effect in the MANUAL mode.
If the PID rung is false, the integral sum (IS) is cleared and CV remains in its last
state.
Applications involving transport lags may require that a bias be added to the CV
output in anticipation of a disturbance. This bias can be accomplished using the
processor by writing a value to the Feed Forward Bias element (word FF). (See
page 292.) The value you write is added to the output, allowing a feed forward
action to take place. You may add a bias by writing a value between -16383 and
+16383 to word 6 with your programming terminal or ladder program.
There are a number of techniques that can be used to tune a PID loop. The
following PID tuning method is general and limited in terms of handling load
disturbances. When tuning, we recommend that changes be made in the
MANUAL mode, followed by a return to AUTO. Output limiting is applied in
the MANUAL mode.
Procedure
1. Create your ladder program. Make certain that you have properly scaled
your analog input to the range of the process variable PV and that you have
properly scaled your control variable CV to your analog output.
TIP If you want to verify the scaling of your continuous system and/or
determine the initial loop update time of your system, go to the
procedure on page 305.
Set the PID mode to STI or Timed, per your ladder diagram. If STI is
selected, ensure that the loop update time equals the STI time interval.
Enter the optional settings that apply (output limiting, output alarm,
MaxS - MinS scaling, feed forward).
4. Get prepared to chart the CV, PV, analog input, or analog output as it
varies with time with respect to the setpoint SP value.
5. Place the PID instruction in the MANUAL mode, then place the
processor in the RUN mode.
6. While monitoring the PID display, adjust the process manually by writing
to the CO percent value.
7. When you feel that you have the process under control manually, place the
PID instruction in the AUTO mode.
8. Adjust the gain while observing the relationship of the output to the
setpoint over time.
9. When you notice that the process is oscillating above and below the
setpoint in an even manner, record the time of 1 cycle. That is, obtain the
natural period of the process.
Record the gain value. Return to the MANUAL mode (stop the process if
necessary).
10. Set the loop update time (and STI time interval if applicable) to a value of
5 to 10 times faster than the natural period.
For example, if the cycle time is 20 seconds, and you choose to set the loop
update time to 10 times faster than the natural rate, set the loop update
time to 200, which would result in a 2-second rate.
11. Set the gain Kc value to 1/2 the gain needed to obtain the natural period of
the process. For example, if the gain value recorded in step 9 was 80, set the
gain to 40.
12. Set the reset term Ti to approximate the natural period. If the natural
period is 20 seconds, as in our example, you would set the reset term to 3
(0.3 minutes per repeat approximates 20 seconds).
13. Now set the rate Td equal to a value 1/8 that of the reset term. For our
example, the value 4 is used to provide a rate term of 0.04 minutes per
repeat.
14. Place the process in the AUTO mode. If you have an ideal process, the PID
tuning is complete.
15. To make adjustments from this point, place the PID instruction in the
MANUAL mode, enter the adjustment, then place the PID instruction
back in the AUTO mode.
To ensure that your process is linear, and that your equipment is properly
connected and scaled, do the following:
If the values you recorded are not offset by the same amount:
• Either your scaling is incorrect, or
• the process is not linear, or
• your equipment is not properly connected and/or configured.
Therefore, the value 120 would be entered as the loop update time.
(120 x 10 ms = 1.2 seconds)
7. Enter the following values: the initial setpoint SP value, a reset Ti of 0, a
rate Td of 0, a gain Kc of 1, and the loop update time determined in step 17.
Set the PID mode to STI or Timed, per your ladder diagram. If STI is
selected, ensure that the loop update time equals the STI time interval.
Enter the optional settings that apply (output limiting, output alarm,
MaxS - MinS scaling, feed forward).
8. Return to page 304 and complete the tuning procedure starting with
step 4.
ASCII Instructions
This chapter contains general information about the ASCII instructions and
explains how they function in your control program. This chapter is arranged
into the following sections:
ASCII Instructions The ASCII instructions are arranged so that the Write instructions precede the
Read instructions.
Instruction Types and There are two types of ASCII instructions, ASCII string control and ASCII port
control. The string control instruction type is used for manipulating data and
Operation executes immediately. The port control instruction type is used for transmitting
data and makes use of the ASCII queue. More details are provided below.
These instructions are used to manipulate string data. When a string control
instruction is encountered in a ladder logic program, it executes immediately. It is
never sent to the ASCII queue to wait for execution. The following table lists the
ASCII string control instructions used by the MicroLogix 1400 controllers:
MicroLogix 1400
ACI (String to Integer) AIC (Integer to String)
ACN (String Concatenate) ASC (String Search)
AEX (String Extract) ASR (ASCII String Compare)
MicroLogix 1400
ABL (Test Buffer for Line) ARD (ASCII Read Characters)
ACB (Number of Characters in Buffer) ARL (ASCII Read Line)
ACL (ASCII Clear Buffer) AWA (ASCII Write with Append)
AHL (ASCII Handshake Lines) AWT (ASCII Write)
When the ACL (ASCII Clear Buffer) instruction is encountered in a ladder logic
program, it executes immediately and causes all instructions to be removed from
the ASCII queue, including stopping execution of the ASCII instruction
currently executing. The ER (error) bit is set for each instruction that is removed
from the ASCII queue.
When any of the other port control instructions are encountered in a ladder logic
program, it may or may not execute immediately depending on the contents of
the ASCII queue. The ASCII queue is a FIFO (first-in, first-out) queue which
can contain up to 16 instructions. The ASCII queue operates as follows:
• When the instruction is encountered on a rung and the ASCII queue is
empty, the instruction executes immediately. It may take several program
scans for the instruction to complete.
IMPORTANT If ASCII write instructions execute continuously, you may not be able to
re-establish communications with RSLogix 500/RSLogix Micro when
the controller is placed into the RUN mode.
The AWA and AWT instructions may still be used with the following serial
channel drivers to send strings out of the serial port even though the channel is
not configured for ASCII (which is useful for sending ASCII dial-up strings to
an attached phone modem):
• DF1 Full-Duplex
• DF1 Half-Duplex Master
• Modbus RTU Master
• DNP3 Slave
The serial channel driver packets take precedence over ASCII strings, so if an
AWA or AWT instruction is triggered while a driver packet is being transmitted,
the ASCII instruction will error out with an error code of 5.
If the serial channel is configured for any of the following drivers, and an AWA or
AWT instruction is triggered, the ASCII instruction will immediately error out
with an error code of 9:
• DH-485
• DF1 Half-Duplex Slave
• DF1 Radio Modem
• Modbus RTU Slave
The string data file is used by the ASCII instructions to store ASCII character
data. The ASCII data can be accessed by the source and destination operands in
the ASCII instructions. The string data file can also be used by the copy (COP)
and move (MOV, MVM) instructions.
String files consist of 42-word elements. One string file element is shown below.
You can have up to 256 of these elements in the string file.
The addressing scheme for the string data file is shown below.
(2) EU = Queue Bit - when set, indicates that an ASCII instruction was placed in the ASCII queue. This action is
delayed if the queue is already filled.
(3) DN = Asynchronous Done Bit - is set when an instruction successfully completes its operation.
(6) UL = Unload Bit - when this bit is set by the user, the instruction does not execute. If the instruction is already
executing, operation ceases. If this bit is set while an instruction is executing, any data already processed is
sent to the destination and any remaining data is not processed. Setting this bit will not cause instructions to
be removed from the ASCII queue. This bit is only examined when the instruction is ready to start executing.
(7) RN = Running Bit - when set, indicates that the queued instruction is
executing. NOTE: The RN bit is not addressable via
the Control (R) file.
(8) FD = Found Bit - when set, indicates that the instruction has found the end-of-line or termination character in
the buffer. (only used by the ABL and ACB instructions)
The addressing scheme for the control data file is shown below.
The ACL instruction clears the Receive and/or Transmit buffer(s). This
instruction also removes instructions from ASCII queue.
TIP For MicroLogix 1400, the ACL instruction can also be used to clear the DF1
communication buffers when the channel is configured for any of the DF1
communication drivers.
Select 0 for the channel number that is configured for DF1 and Yes for both
the Receive and Transmit Buffers. When the ACL instruction is executed,
any pending outgoing DF1 replies, any pending incoming DF1 commands
and any pending outgoing DF1 commands are flushed. Any MSG
instructions in progress on that channel will error out with an error code of
0x0C. However, this functionality is not applied if DCOMM (Default
communication setting) is selected.
This instruction executes immediately upon the rung transitioning to a true state.
Any ASCII transmissions in progress are terminated when the ACL instruction
executes.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
ST
EII
N
O
A
S
L
I
Channel • •
Receive Buffer • •
Transmit Buffer • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
When Clear Receive Buffer and Clear Transmit Buffer are both set to Yes, all
Receive and Transmit instructions (ARL, ARD, AWA, and AWT) are removed
from the ASCII queue.
When instructions are removed from the ASCII queue, the following bits are set:
ER = 1, RN = 0, EU = 0, and ERR = 0x0E.
The AIC instruction converts an integer or long word value (source) to an ASCII
string (destination). The source can be a constant or an address. The source data
range is from -2,147,483,648…2,147,483,647.
Address
Data Files Function Files Address Level
Mode
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Source • • • • • • • • • • •
Destination • • •
Use the AWA instruction to write characters from a source string to an external
device. This instruction adds the two appended characters that you configure on
the Channel Configuration screen. The default is a carriage return and line feed
appended to the end of the string.
This instruction will execute on either a false or true rung. However, if you want
to repeat this instruction, the rung must go from false-to-true.
When using this instruction you can also perform in-line indirection. See page
Using In-line Indirection on page 334 for more information.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Channel • •
Source • • •
Control • • •
(1) The Control data file is the only valid file type for the Control Element.
Example
I:1 AWA
EN
[
[ ASCII WRITE APPEND
10 Channel 0
DN
Source ST37:42
Control R6:23
If input slot 1, bit 10 is set, read 25 characters from
String Length 25 ER
ST37:42 and write it to the display device. Then
Characters Sent 0
write a carriage return and line feed (default). Error 00
In this example, when the rung goes from false-to-true, the control element
Enable (EN) bit is set. When the instruction is placed in the ASCII queue, the
Queue bit (EU) is set. The Running bit (RN) is set when the instruction is
executing. The DN bit is set on completion of the instruction.
The controller sends 25 characters from the start of string ST37:42 to the display
device and then sends user-configured append characters. The Done bit (DN) is
set and a value of 27 is present in .POS word of the ASCII control data file.
When an error is detected, the error code is written to the Error Code Byte and
the Error Bit (ER) is set. See ASCII Instruction Error Codes on page 335 for a
list of the error codes and recommended action to take.
TIP For information on the timing of this instruction, see the timing
diagram on page 334.
Use the AWT instruction to write characters from a source string to an external
device.
This instruction executes on a true rung. Once started, if the rung goes false, the
instruction continues to completion. If you want to repeat this instruction, the
rung must transition from false-to-true.
When using this instruction you can also perform in-line indirection. See page
334 for more information.
Entering Parameters
• String Length (.LEN) is the number of characters you want to write from
the source string (0…82). If you enter a 0, the entire string is written. This is
word 1 in the control data file.
• Characters Sent (.POS) is the number of characters that the controller
sends to an external device. This is word 2 in the control data file.
Characters Sent (.POS) is updated after all characters have been
transmitted.
The valid range for .POS is from 0…82. The number of characters sent to
the destination may be smaller or greater than the specified String Length
(.LEN) as described below:
– Characters Sent (.POS) may be smaller than String Length (.LEN) if
the length of the string sent is less than what was specified in the String
Length (.LEN) field.
– Characters Sent (.POS) can be greater than the String Length (.LEN) if
inserted values from in-line indirection are used. If the String Length
(.LEN) is greater than 82, the string written to the destination is
truncated to 82 characters.
• Error displays the hexadecimal error code that indicates why the ER bit
was set in the control data file. See page 335 for error code descriptions.
Address
Data Files(1) Function Files
Mode
Address Level
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Channel • •
Source • • •
Control • • •
(1) The Control data file is the only valid file type for the Control Element.
Example
I:1 AWT
[
[ ASCII WRITE EN
10 Channel 0
Source ST37:20 DN
Control R6:23
If input slot 1, bit 10 is set, write 40 characters from String Length 40
ER
ST37:20 to the display device. Characters Sent 0
Error 0
In this example, when the rung goes from false-to-true, the control element
Enable (EN) bit is set. When the instruction is placed in the ASCII queue, the
Queue bit (EU) is set. The Running bit (RN) is set when the instruction is
executing. The DN bit is set on completion of the instruction.
Forty characters from string ST37:40 are sent through channel 0. The Done bit
(DN) is set and a value of 40 is present in the POS word of the ASCII control
data file.
When an error is detected, the error code is written to the Error Code Byte and
the Error Bit (ER) is set. See ASCII Instruction Error Codes on page 335 for a
list of the error codes and recommended action to take.
TIP For information on the timing of this instruction, see the timing
diagram on page 334.
The ABL instruction is used to determine the number of characters in the receive
buffer of the specified communication channel, up to and including the
end-of-line characters (termination). This instruction looks for the two
termination characters that you configure via the channel configuration screen.
On a false-to-true transition, the controller reports the number of characters in
the POS field of the control data file. The channel configuration must be set to
ASCII.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Channel • •
Control • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
When the rung goes from false-to-true, the Enable bit (EN) is set. The
instruction is put in the ASCII instruction queue, the Queue bit (EU) is set, and
program scan continues. The instruction is then executed outside of the program
scan. However, if the queue is empty the instruction executes immediately. Upon
execution, the Run bit (RN) is set.
The controller determines the number of characters (up to and including the
termination characters) and puts this value in the POS field of the control data
file. The Done bit (DN) is then set. If a zero appears in the POS field, no
termination characters were found. The Found bit (FD) is set if the POS field is
set to a non-zero value.
Use the ACB instruction to determine the number of characters in the buffer. On
a false-to-true transition, the controller determines the total number of characters
and records it in the POS field of the control data file. The channel configuration
must be set to ASCII.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Channel • •
Control • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
When the rung goes from false-to-true, the Enable bit (EN) is set. When the
instruction is placed in the ASCII queue, the Queue bit (EU) is set. The Running
bit (RN) is set when the instruction is executing. The Done bit (DN) is set on
completion of the instruction.
The controller determines the number of characters in the buffer and puts this
value in the POS field of the control data file. The Done bit (DN) is then set. If a
zero appears in the POS field, no characters were found. The Found bit (FD) is
set when the POS filed is set to a non-zero value
Use the ACI instruction to convert a numeric ASCII string to an integer (word
or long word) value.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Source • • •
Destination • • • • • • • • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
The controller searches the source (file type ST) for the first character between 0
and 9. All numeric characters are extracted until a non-numeric character or the
end of the string is reached. Action is taken only if numeric characters are found.
The string length is limited to 82 characters. Commas and signs (+, -) are allowed
in the string. However, only the minus sign is displayed in the data table.
This instruction sets the following math flags in the controller status file:
The ACN instruction combines two ASCII strings. The second string is
appended to the first and the result stored in the destination.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
ST
EII
N
O
A
S
L
I
Source A • • •
Source B • • •
Destination • • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
The AEX instruction creates a new string by taking a portion of an existing string
and storing it in a new string.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
ST
EII
N
O
A
S
L
I
Source • • • •
Index • • • • • • • • •
Number • • • • • • • •
Destination • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
The following conditions cause the controller to set the ASCII String
Manipulation Error bit (S:5/15):
• Source string length is less than 1 or greater than 82
• Index value is less than 1 or greater than 82
• Number value is less than 1 or greater than 82
• Index value greater than the length of the Source string
The Destination string is not changed in any of the above error conditions. When
the ASCII String Manipulation Error bit (S:5/15) is set, the Invalid String
Length Error (1F39H) is written to the Major Error Fault Code word (S:6).
TIP Make sure the automatic modem control used by the port does not
conflict with this instruction.
Entering Parameters
Channel 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0
Status Bit 5 4 3 2 1 0
Handshake Reserved -- -- RT CT
Control Line S S
Setting
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
Channel 0 0 1 F
Status
Word 2 of the Control Element = 001F
• Error displays the hexadecimal error code that indicates why the ER bit
was set in the control data file. See page 335 for error code descriptions.
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Channel • •
AND Mask • • • • • • • • • •
OR Mask • • • • • • • • • •
Control • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
Parameter CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Channel • •
Destination • • •
Control • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
When the rung goes from false-to-true, the Enable bit (EN) is set. When the
instruction is placed in the ASCII queue, the Queue bit (EU) is set. The Running
bit (RN) is set when the instruction is executing. The DN bit is set on
completion of the instruction.
Once the requested number of characters are in the buffer, the characters are
moved to the destination string. The number of characters moved is put in the
POS field of the control data file. The number in the POS field is continuously
updated and the Done bit (DN) is not set until all of the characters are read.
TIP For information on the timing of this instruction, see the timing
diagram on page 334.
Use the ARL instruction to read characters from the buffer, up to and including
the Termination characters, and store them in a string. The Termination
characters are specified via the Channel Configuration screen.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
DLS - Data Log
PTOX, PWMX
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
ST
EII
N
O
A
S
L
I
Channel • •
Destination • • •
Control • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
When the rung goes from false-to-true, the control element Enable (EN) bit is
set. When the instruction is placed in the ASCII queue, the Queue bit (EU) is
set. The Running bit (RN) is set when the instruction is executing. The DN bit is
set on completion of the instruction.
Once the requested number of characters are in the buffer, all characters
(including the Termination characters) are moved to the destination string. The
number of characters moved is stored in the POS word of the control data file.
The number in the Characters Read field is continuously updated and the Done
bit (DN) is not set until all of the characters have been read. Exception: If the
controller finds termination characters before done reading, the Done bit (DN)
is set and the number of characters found is stored in the POS word of the control
data file.
TIP For information on the timing of this instruction, see the timing
diagram on page 334.
Use the ASC instruction to search an existing string for an occurrence of the
source string. This instruction executes on a true rung.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
LCD
RTC
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Source • • • • • • • •
Index • • • • •
Search • • •
Result • • • • • • • • •
(1) The Control data file is the only valid file type for the Control Element.
Example
I:1 ASC
ASC
String Search
10 Source ST38:40
Index 35
If input slot 1, bit 10 is set, search the string String Search ST52:80
in ST52:80 starting at the 36th character, for Result N10:0
the string found in ST38:40. In this example,
the position result is stored in N10:0.
Error Conditions
The following conditions cause the controller to set the ASCII Error bit (S:5/
15).
• Source string length is less than 1 or greater than 82.
• Index value is less than 1 or greater than 82.
• Index value is greater than Source string length.
The destination is not changed in any of the above conditions. When the ASCII
String Manipulation Error bit (S:5/15) is set, the Invalid String Length Error
(1F39H) is written to the Major Error Fault Code word (S:6).
Use the ASR instruction to compare two ASCII strings. The controller looks for
a match in length and upper/lower case characters. If two strings are identical, the
rung is true; if there are any differences, the rung is false.
Entering Parameters
Address
Data Files(1) Function Files
Mode
Address Level
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
A
S
L
I
Source A • • •
Source B • • •
(1) The Control data file is the only valid file type for the Control Element.
Instruction Operation
Done Bit
Error Bit ON
(DN or ER) OFF
1 2 6 3 4 5 1 5 2 6 3 4
NOTE: The RN bit is not addressable via 1 - rung goes true
the Control (R) file. 2 - instruction successfully queued
3 - instruction execution complete
4 - instruction scanned for the first time after execution is complete
5 - rung goes false
6 - instruction execution starts
Using In-line Indirection This allows you to insert integer and long word values into ASCII strings. The
Running bit (RN) must be set before the string value can be used.
Examples
N7:1 = -37
L9:0 = 508000
L9:1 = 5
ASCII Instruction Error The following error codes indicate why the Error bit (ER) is set in the control
data file.
Codes
ASCII Character Set The table below lists the decimal, hexadecimal, octal, and ASCII conversions.
The standard ASCII character set includes values up to 127 decimal (7F hex).
The MicroLogix 1400 Controller also supports an extended character set
(decimal 128…255). However, the extended character set may display different
characters depending on the platform you are using.
Communications Instructions
This chapter contains information about the Message (MSG) and Service
Communications (SVC) communication instructions. This chapter provides
information on:
• Messaging Overview on page 337
• SVC - Service Communications on page 339
• MSG - Message on page 341
• The Message Element on page 342
• Timing Diagram for the MSG Instruction on page 348
• MSG Instruction Ladder Logic on page 353
• Local Messages on page 355
• Configuring a Local Message on page 357
• Local Messaging Examples on page 365
• Remote Messages on page 379
• Configuring a Remote Message on page 382
• Configuring a Multi-hop Remote Message on EtherNet/IP
Communication Channel on page 385
• Configuring a MicroLogix 1400 CIP Generic Message via Ethernet on
page 400
• MSG Instruction Error Codes on page 404
• Special Function with MSG instruction on page 407
When scanned, the message and the data defined within the message (if it is a
write message) are placed in a communication buffer. The controller continues to
scan the remaining user program. The message is processed and sent out of the
controller via the communications port after the ladder logic completes, during
the Service Communications part of the operating cycle, unless an SVC is
executed.
When a buffer is available, the message and its associated data are placed in the
buffer immediately. If all four buffers for the channel are full when the next (fifth)
message is processed, the message request, not the data, is placed in the channel’s
communications queue. The queue is a message storage area that keeps track of
messages that have not been allocated a buffer. The queue operates as a first-in
first-out (FIFO) storage area. The first message request stored in the queue is the
message that is allocated a buffer as soon as a buffer becomes available. The queue
can accommodate all MSG instructions in a ladder program.
When a message request in a buffer is completed, the buffer is released back to the
system. If a message is in the queue, that message is then allocated a buffer. At that
time, the data associated with the message is read from within the controller.
TIP If a message instruction was in the queue, the data that is actually
sent out of the controller may be different than what was present
when the message instruction was first processed.
The buffer and queue mechanisms are completely automatic. Buffers are allocated
and released as the need arises, and message queuing occurs if buffers are full.
Simply place the SVC instruction on a rung within the control program. When
the rung is scanned, the controller services any communications that need to take
place. You can place the SVC instruction on a rung without any preceding logic,
or you can condition the rung with a number of communications status bits. The
table on page 340 shows the available status file bits.
For best results, place the SVC instruction in the middle of the control program.
You may not place an SVC instruction in a Fault, DII, STI, or I/O Event
subroutine.
Channel Select
When using the SVC instruction, you must select the channel to be serviced. The
channel select variable is a one-word bit pattern that determines which channel is
serviced. Each bit corresponds to a specific channel. For example, bit 0 equals
channel 0. When any bit is set (1), the corresponding channel is serviced.
Application Example
CS0:4 SVC
0000 Service Communications
MCP Channel Select 0001h
You can place this rung after a message write instruction. CS0:4/MCP is set
when the message instruction is enabled and put in the communications queue.
When CS0:4/MCP is set (1), the SVC instruction is evaluated as true and the
program scan is interrupted to execute the service communication’s portion of the
operating scan. The scan then resumes at the instruction following the SVC
instruction.
The example rung shows a conditional SVC, which is processed only when an
outgoing message is in the communications queue.
TIP You may program the SVC instruction unconditionally across the
rungs. This is the normal programming technique for the SVC
instruction.
Any preceding logic on the message rung must be solved true before the message
instruction can be processed. The example below shows a message instruction.
B3:0 MSG
B3:0
0000 Read/Write Message EN
0 MSG File MG11:0 DN
0
Setup Screen ER
If B3:0 is on (1), the MSG rung is true, and MG11:0 is not already processing a
message; then MG11:0 is processed. If one of the four buffers is available, the
message and its associated data are processed immediately.
TIP How quickly the message is actually sent to the destination device
depends on a number of issues, including the selected channel’s
communication protocol, the baud rate of the communications port,
the number of retries needed (if any), and the destination device's
readiness to receive the message.
The Message Element The MSG instruction built into the controller uses a MG data file to process the
message instruction. The MG data file, shown at left, is accessed using the MG
prefix. Each message instruction utilizes an element within a MG data file. For
example, MG11:0 is the first element in message data file 11.
Each MSG instruction must use a unique Element in a MSG File. The MSG
element for each MSG instruction holds all of the parameters and status
information for that particular MSG instruction.
(2) User access refers to user program access (MSG File word or bit used as an operand for an instruction in a ladder program) or access via Comms while in any mode other
than download (via Programming Software or Memory Module).
The Target file information contained in Sub-Elements 12…15 of the MSG File
Element depend upon the message type, as shown in the tables below.
The Control Bits, Sub-Element 16, of the MSG File Element are defined below:
The Status Bits, Sub-Element 17, of the MSG File Element are defined below.
The Timed Out Bit (TO) can be set in your application to remove an active
message instruction from processor control. You can create your own timeout
routine by monitoring the EW and ST bits to start a timer. When the timer times
out, you can set the TO bit, which removes the message from the system. The
controller resets the TO bit the next time the associated MSG rung goes from
false to true.
An easier method is to use the message timeout variable described on page 363,
because it simplifies the user program. This built-in timeout control is in effect
whenever the message timeout is non-zero. It defaults to 5 seconds for channel 0,
so unless you change it, the internal timeout control is automatically enabled.
When the internal timeout is used and communications are interrupted, the
MSG instruction will timeout and error after the set period of time expires. This
allows the control program to retry the same message or take other action, if
desired.
To disable the internal timeout control, enter zero for the MSG instruction
timeout parameter. If communications are interrupted, the processor waits
indefinitely for a reply. If an acknowledge (ACK) is received, indicated by the ST
bit being set, but the reply is not received, the MSG instruction appears to be
locked up, although it is actually waiting for a reply from the target device.
Enable (EN)
Address Data Format Range Type User Program Access
MG11:0/EN Binary On or Off Control Read / Write
The Enable Bit (EN) is set when rung conditions go true and the MSG is
enabled. The MSG is enabled when the command packet is built and put into
one of the MSG buffers, or the request is put in the MSG queue. It remains set
until the message transmission is completed and the rung goes false. You may
clear this bit when either the ER or DN bit is set in order to re-trigger a MSG
instruction with true rung conditions on the next scan.
The Enabled and Waiting Bit (EW) is set after the enable bit is set and the
message is in the buffer (not in the queue) and waiting to be sent. The EW bit is
cleared after the message has been sent and the processor receives
acknowledgement (ACK) from the target device. This is before the target device
has processed the message and sent a reply.
Error (ER)
Address Data Format Range Type User Program Access
MG11:0/ER Binary On or Off Status Read Only
The Error Bit (ER) is set when message transmission has failed. An error code is
written to the MSG File. The ER bit and the error code are cleared the next time
the associated rung goes from false to true.
Done (DN)
Address Data Format Range Type User Program Access
MG11:0/DN Binary On or Off Status Read Only
The Done Bit (DN) is set when the message is transmitted successfully. The DN
bit is cleared the next time the associated rung goes from false to true.
Start (ST)
Address Data Format Range Type User Program Access
MG11:0/ST Binary On or Off Status Read Only
The Start Bit (ST) is set when the processor receives acknowledgment (ACK)
from the target device. The ST bit is cleared when the DN, ER, or TO bit is set.
The DF1 Radio Modem and Modbus RTU Master protocols do not have
acknowledgements. When the channel that the MSG instruction is being
initiated on is configured for either of these two drivers, the Start Bit (ST) is set
when the message has been successfully transmitted.
UnConnected(UC)
Address Data Format Range Type User Program Access
MG11:0/UC Binary On or Off Control Read / Write
When the BreaK bit is set, the Ethernet TCP connection will be closed after the
MSG instruction has completed. If cleared to 0, the Ethernet TCP connection
will remain connected after the MSG instruction has completed. If set to 0 value,
the Ethernet/IP connection will remain even if the MSG instruction sent
successfully.
Timing Diagram for the The following section describes the timing diagram for a message instruction.
MSG Instruction
1
EN 0
1
EW 0
1
ST 0
1
DN 0
1
ER 0
1
TO 0
1. If there is room in any of the four active message buffers when the MSG
rung becomes true and the MSG is scanned, the EN and EW bits for this
message are set. If this is a MSG write instruction, the source data is
transferred to the message buffer at this time.
(Not shown in the diagram.) If the four message buffers are in use, the
message request is put in the message queue and only the EN bit is set. The
message queue works on a first-in, first-out basis that allows the controller
to remember the order in which the message instructions were enabled.
When a buffer becomes available, the first message in the queue is placed
into the buffer and the EW bit is set (1).
TIP The control program does not have access to the
message buffers or the communications queue.
Once the EN bit is set (1), it remains set until the entire message process is
complete and either the DN, ER, or TO bit is set (1). The MSG Timeout
period begins timing when the EN bit is set (1). If the timeout period
expires before the MSG instruction completes its function, the ER bit is set
(1), and an error code (37H) is placed in the MG File to inform you of the
timeout error.
The controller then exits the end of scan, REF, or SVC portion of the scan.
The controller’s background communication function sends the messages
to the target nodes specified in the message instruction. Depending on the
state of the CSS and MSS bits, you can service up to four active message
instructions per channel at any given time.
3. If the target node successfully receives the message, it sends back an
acknowledge (ACK). The ACK causes the processor to clear (0) the EW
bit and set (1) the ST bit. The target node has not yet examined the packet
to see if it understands your request.
Once the ST bit is set (1), the controller waits for a reply from the target
node. The target node is not required to respond within any given time
frame.
TIP If the Target Node faults or power cycles during the message
transaction, you will never receive a reply. This is why you should use
a Message Timeout value in your MSG instruction.
4. Step 4 is not shown in the timing diagram. If you do not receive an ACK,
step 3 does not occur. Instead, either no response or a negative
acknowledge (NAK) is received. When this happens, the ST bit remains
clear (0).
When a NAK occurs, the EW bit is cleared (0), and the ER bit is set (1),
indicating that the message instruction failed.
5. Following the successful receipt of the packet, the target node sends a reply
packet. The reply packet contains one of the following responses:
• successful write request.
• successful read request with data
• failure with error code
At the next end of scan, REF, or SVC instruction, following the target
node’s reply, the controller examines the message from the target device. If
the reply is successful, the DN bit is set (1), and the ST bit is cleared (0). If
it is a successful read request, the data is written to the data table. The
message instruction function is complete.
If the reply is a failure with an error code, the ER bit is set (1), and the ST
bit is cleared (0). The message instruction function is complete.
6. If the DN or ER bit is set (1) and the MSG rung is false, the EN bit is
cleared (0) the next time the message instruction is scanned.
See MSG Instruction Ladder Logic on page 353 for examples using the message
instruction.
Communication Servicing The following screen shows the channel configuration window for
Communication Servicing Selection and Message Servicing Selection.
Selection and Message
Servicing
Selection
Use the check box to enhance communication capability. If the check box is
unchecked, communication throughput (and scan time) will increase.
Use this check box to enhance communication capability. If this is checked and
the Communication Servicing Selection check box is not checked the MSG
functionality throughput (and scan time) will increase.
• When this check box is checked, the controller services one outgoing
channel MSG instruction at the next Service Communications (SVC)
instruction, I/O Refresh (REF) instruction, or when it performs
Communications Servicing. When this check box is clear (unchecked), the
controller services all outgoing channel MSG instructions at the next
Service Communications (SVC) instruction, I/O Refresh (REF)
instruction, or when it performs Communications Servicing.
• The Message Servicing Selection (channel) bit is applied by the controller
when the Communications Servicing Selection (channel) bit is clear
(unchecked).
MSG Instruction Ladder Enabling the MSG Instruction for Continuous Operation
Logic
The message instruction is enabled during the initial processor program scan and
each time the message completes. For example, when the DN or ER bit is set.
ER
0003 END
I:1/0 is set and message MG11:0 is not enabled, the message instruction on rung
0001 is enabled.
44583
Local Messages The controller is capable of communicating using local or remote messages. With
a local message, all devices are accessible without a separate device acting as a
bridge. Different types of electrical interfaces may be required to connect to the
network, but the network is still classified as a local network. Remote messages
use a remote network, where devices are accessible only by passing or routing
through a device to another network. Remote networks are discussed on
page 379.
Local Networks
COM
SHLD
A
COM
SHLD
A-B PanelView
CHS GND CHS GND
TX TX TX TX
TX PWR TX PWR
DC SOURCE DC SOURCE
CABLE CABLE
EXTERNAL EXTERNAL
SLC 5/04
PanelView 550
DH-485 Network
A A
Personal
A
B B
B
COM COM
COM
SHLD SHLD
SHLD
TX TX TX TX
TX TX
TX PWR
DC SOURCE
CABLE
EXTERNAL
TX PWR
DC SOURCE
CABLE
EXTERNAL
TX PWR
DC SOURCE
CABLE
Computer
EXTERNAL
DANGER DANGER
Master
DeviceNet Network
Computer
RS-232
(DF1 Half-Duplex Protocol)
Modem
MicroLogix MicroLogix MicroLogix SLC 5/04 (Slave) SLC 5/03 with 1747-KE
1000 (Slave) 1400 (Slave) 1500 (Slave) Interface Module (Slave)
44586
B3:0 MSG
MSG
0000 Read/Write Message EN
0 MSG File MG11:0 DN
Setup Screen ER
The RSLogix Message Setup Screen is shown below. This screen is used to setup
“This Controller”, “Target Device”, and “Control Bits”. Descriptions of each of
the elements follow.
Channel
The MicroLogix 1400 supports messaging on all three channels. Channel 0 is the
RS-232/RS-485 port, Channel 1 is the Ethernet port and Channel 2 is the
RS-232 port.
Communication Command
IMPORTANT The Common Interface File (CIF) in the MicroLogix 1100, 1200, 1400,
1500, and SLC 500 processors is File 9. The CIF in the MicroLogix
1000 controller is Integer File 7.
Modbus Command
The controller supports eight Modbus commands. If the target device supports
any of these Modbus command types, the controller should be capable of
exchanging data with the device. Supported Modbus commands include:
This variable defines the starting address in the local controller. Valid file types for
the Data Table Address are shown below:
TIP Only Bit (B) and Integer (N) file types are valid for Modbus Command
messages. Modbus bit commands require a starting bit address for
the Data Table Address.
Floating Point (F) and Long (L) file types are valid for Modbus
Command messages for Holding Registers (commands 03, 06 and 16)
when Data is configured for 32 bit.
Size in Elements
This variable defines the amount of data (in elements) to exchange with the target
device.
The maximum amount of data that can be transferred via a MSG instruction is
103 words (120 words for Modbus commands) and is determined by the
destination data type. The destination data type is defined by the type of message:
read or write.
• For Read Messages: When a read message is used, the destination file is the
data file in the local or originating processor.
TIP Input, output, string, and RTC file types are not valid for read
messages.
• For Write Messages: When a write message is used, the destination file is
the data file in the target processor.
The maximum number of elements that can be transmitted or received are shown
in the following table. You cannot cross file types when sending messages. For
example, you cannot read a timer into an integer file and you cannot write
counters to a timer file. The only exceptions to this rule are that:
• long integer data can be read from or written to bit or integer files, and
TIP The table below is not intended to illustrate file compatibility, only the
maximum number of elements that can be exchanged in each case.
Message Timeout
This value defines how long, in seconds, the message instruction has to complete
its operation once it has started. Timing begins when the false-to-true rung
transition occurs, enabling the message. If the timeout period expires, the message
errors out. The default value is 5 seconds (2 seconds for Modbus commands).
The maximum timeout value is 255 seconds.
Message Timeout for any MicroLogix 1400 channel 1 MSG can not be modified
in the Ethernet Message Setup dialog box. It is assigned by the processor and is
determined by adding the Channel 1 MSG Connection Timeout to the MSG
Reply Timeout, then adding 15 seconds. This value can be modified by changing
one or both of the timeout values in the channel configuration screen for channel
1. The modified message timeout applies to all Ethernet MSG instructions.
If the message timeout is set to zero, the message instruction will never timeout.
Set the Time Out bit (TO = 1) to flush a message instruction from its buffer if
the destination device does not respond to the communications request.
This variable defines the starting address in the target controller. The data table
address is used for a 500CPU and PLC5 type messages. A valid address is any
valid, configured data file within the target device whose file type is recognized by
the controller. Valid combinations are shown below:
The data table offset is used for 485CIF type messages. A valid offset is any value
in the range 0…255 and indicates the word or byte offset into the target's
Common Interface File (CIF). The type of device determines whether it is a
word or byte offset. MicroLogix controllers and SLC processors use word offset;
PLC-5 and Logix processors use byte offset.
Modbus addressing is limited to 16 bits per memory group, each with a range of
1…65,536. There are four memory groups, one for each function:
• coils (generally addressed as 0xxxx)
• contacts (1xxxx)
• input registers (3xxxx)
• holding registers (4xxxx)
Coils and contacts are addressed at the bit level. Coils are outputs and can be read
and written. Contacts are inputs and are read-only.
Input registers and holding registers are addressed at the word level. Input
registers are generally used for internally storing input values. They are read-only.
Holding registers are general purpose and can be both read and written.
The most significant digit of the address is considered a prefix, and does not get
entered into the MB Data Address field when configuring the message
instruction.
When the message is sent, the address is decremented by 1 and converted into a
4-character hex number to be transmitted via the network (with a range of
0-FFFFh); the slave increments the address by 1, and selects the appropriate
memory group based on the Modbus function.
This is the destination device's node number if the devices are on a DH-485,
DeviceNet (using 1761-NET-DNI), DF1, or Modbus network.
Local/Remote
This variable defines the type of communications that is used. Always use local
when you need point-to-point communications via DF1 Full-Duplex or network
communications such as Ethernet/IP, DeviceNet (using 1761-NET-DNI), DF1
Half-Duplex, or DF1 Radio Modem. For DH-485, use local if the target node is
on the same DH-485 network as this controller, or remote if the path to the
target node goes through one or more communication bridges.
Local Messaging Examples Five examples of local messaging are shown in this section:
• 500CPU message type
• 485CIF message type
• PLC5 message type
• Modbus RTU Message type
• EtherNet/IP Message type
• Write Message type with ST data file
MB Data Address Specifies the Modbus address in the target device. Valid range is from 1…65,536.
Local Slave Node Address Specifies the node number of the device that is receiving the message. Valid range is 0…31 for DH-485
protocol, 0…254 for DF1 protocol, 0…63 for DeviceNet, or 0…247 for Modbus.
Local/Remote Specifies whether the message is local or remote. (Modbus messages are local only.)
In this example, the controller reads 10 elements from the target’s (Local Node 2)
N7 file, starting at word N7:50. The 10 words are placed in the controller’s
integer file starting at word N7:0. If five seconds elapse before the message
completes, error bit MG11:0/ER is set, indicating that the message timed out.
Valid transfers between file types are shown below for MicroLogix messaging:
Local Data Types Communication Type Target Data Types
O(1), I(1), B, N, L <---> read/write O, I, S, B, N, L
In this example, the controller reads five elements (words) from the target device’s
(Local Node 2) CIF file, starting at word 20 (or byte 20 for non-SLC 500
devices). The five elements are placed in the controller’s integer file starting at
word N7:0. If 15 seconds elapse before the message completes, error bit MG11:0/
ER is set, indicating that the message timed out.
Valid transfers between file types are shown below for MicroLogix messaging:
In this example, the controller reads 10 elements from the target device’s (Local
Node 2) N7 file, starting at word N7:50. The 10 words are placed in the
controller’s integer file starting at word N7:0. If five seconds elapse before the
message completes, error bit MG11:0/ER is set, indicating that the message
timed out.
Valid transfers between file types are shown below for MicroLogix messaging:
This section describes how to configure a local message using the Modbus
communication commands. Since configuration options are dependent on which
channel is selected, the programming software has been designed to only show
the options available for the selected channel.
Before configuring the MSG instruction, open the Channel Configuration screen
and set the Driver to Modbus RTU Master. For more information on Channel
Configuration, see Modbus RTU Master Configuration on page 556.
If a Channel configured for Modbus Master is selected in the Channel field of the
Message Setup Screen, the following Modbus Command options will become
available:
• 01 Read Coil Status (0xxxx)
• 02 Read Input Status (1xxxx)
• 03 Read Holding Registers (4xxxx)
• 04 Read Input Registers (3xxxx)
• 05 Write Single Coil (0xxxx)
• 06 Write Single Register (4xxxx)
• 15 Write Multiple Coils (0xxxx)
• 16 Write Multiple Registers (4xxxx)
Data Table Address
Local file types must be Binary (B) or Integer (N) for Modbus commands.
Starting data table address for coil/input bit commands (1, 2, 5 and 15) require a
bit address. Starting data table addresses for register commands (3, 4, 6 and 16)
require a word address.
Size in Elements
Size in elements defaults to “1”. For coil/input commands (1, 2, 5 and 15),
elements are in bits. For register commands (3, 4, 6 and 10), elements are in
words.
Target Device
Message Timeout
Message timeout is specified in seconds. If the target does not respond within this
time period, the message instruction will generate a specific error (see MSG
Instruction Error Codes on page 404). The amount of time that is acceptable
should be based on application requirements and network capacity/loading. A
2-second message timeout is generally sufficient, as long as only one message is
triggered at a time.
Modbus Data Address (decimal)
The default Slave Node Address is 1. The Range is 0…247. Zero is the Modbus
broadcast address and is only valid for Modbus write commands (5, 6, 15 and 16).
This section describes how to configure a local message when you are use
Ethernet communication channel 1 of the MicroLogix 1400.
You must select Channel 1 (Integral) to use Ethernet pathways for messaging.
Communication Command
Message Timeout for any MicroLogix 1400 channel 1 MSG cannot be modified
in the Ethernet Message Setup dialog box. It is assigned by the processor and is
determined by adding the Channel 1 MSG Connection Timeout to the MSG
Reply Timeout, then adding 15 seconds. This value can be modified by changing
one or both of the timeout values in the channel configuration screen for channel
1. The modified message timeout applies to all Ethernet MSG instructions.
Routing Information File
The Routing Information (RI) File stores the path for reaching the destination
node. Each RI File Element consists of Sub-Elements 0 through 19 as shown in
the following table.
Channel 1 Ethernet
In each MSG instruction setup screen, enter in RIx:y for the Routing
Information FIle, where x is an existing RI file number or an unused file number,
and y is an unused RI element number. Each Channel 1 Ethernet MSG
Instruction must have its own RIx:y. If the RIx:y entered in the MSG setup screen
does not yet exist, then the programming software will automatically create it
when the rung is verified.
In this example, the controller reads 10 elements from the target's N7 file, starting
at word N7:50 using 500CPU Read command. The 10 words are placed in the
controller's integer file starting at word N7:0. If 33 seconds elapse before the
message completes, error bit MG11:0/ER is set, indicating that the message
timed out.
The following message setup screen is used to send local PLC5 write to the
1756-L1 via 1756-ENBT module. A message read will also work.
The “rcv_string” tag on the ControlLogix controller is created as a string type and
mapped PLC/SLC mapping table to allow the controller to accept those
messages.
Remote Messages The controller is also capable of remote or off-link messaging. Remote messaging
is the ability to exchange information with a device that is not connected to the
local network. This type of connection requires a device on the local network to
act as a bridge or gateway to the other network.
Remote Networks
The illustration below shows two networks, a DH-485 and a DH+ network. The
SLC 5/04 processor at DH-485 node 17 is configured for passthru operation.
Devices that are capable of remote messaging and are connected on either
network can initiate read or write data exchanges with devices on the other
network, based on each device's capabilities. In this example, node 12 on DH-485
is a MicroLogix 1400. The MicroLogix 1400 can respond to remote message
requests from nodes 40 or 51 on the DH+ network and it can initiate a message
to any node on the DH+ network.
TERM
A
COM
SHLD
CHS GND
A
COM
SHLD
A-B PanelView
CHS GND
TX TX
TX TX
TX PWR
TX PWR
DC SOURCE
CABLE
DC SOURCE
CABLE
EXTERNAL
EXTERNAL
AIC+ AIC+
SLC 5/04
PanelView 550
DH-485 Network
A A A
B B B
TX TX TX TX TX TX
Node 51 Node 40
44587
COM
SHLD
A
COM
SHLD
A-B PanelView
CHS GND CHS GND
TX TX TX TX
TX PWR TX PWR
DC SOURCE DC SOURCE
CABLE CABLE
EXTERNAL EXTERNAL
SLC 5/03
PanelView 550
DeviceNet Network
DNI DNI DNI DNI
TERM TERM TERM TERM
A A A A
B B B B
TX TX TX TX TX TX TX TX
Ethernet Network
Configuring a Remote Remote capability is configured through the RSLogix 500/RSLogix Micro
Message Setup screen.
Message
The message configuration shown below is for the MicroLogix 1400 at node 12
on the DH-485 network. This message reads five elements of data from the SLC
5/04 (node 51 on the DH+ network) starting at address N:50:0. The SLC 5/04
at Node 23 of the DH+ network is configured for passthru operation.
TERM
A
COM
SHLD
CHS GND
A
COM
SHLD
A-B PanelView
CHS GND
TX TX
TX TX
TX PWR
TX PWR
DC SOURCE
CABLE
DC SOURCE
CABLE
EXTERNAL
EXTERNAL
AIC+ AIC+
SLC 5/03
PanelView 550
DH-485 Network Node 5 Node 22
Link ID = 1
Node 10 AIC+ Node 11 AIC+ Node 12 AIC+ Node 17
TERM TERM TERM
A A A
B B B
TX TX TX TX TX TX
Message Timeout
This variable defines the bridge address on the local network. In the example,
DH-485 node 12 (MicroLogix 1400 on Link ID 1) is writing data to node 51
(SLC 5/04 on Link ID 100). The SLC 5/04 at node 17 is the bridge device.
This variable defines the remote node address of the bridge device. In this
example, the remote bridge address is set to zero, because the target device, SLC
5/04 at node 63 (octal) is a remote-capable device. If the target device is
remote-capable, the remote bridge address is not required. If the target device is
not remote-capable (SLC 500, SLC 5/01, SLC 5/02, and MicroLogix 1000
Series A, B and C), the remote bridge address is required.
This variable is the final destination address of the message instruction. In this
example, integer file 50 elements 0…4 of the SLC 5/04 on Link ID 100 at node
63 (octal) receives data from the MicroLogix 1400 controller at node 12 on Link
ID 1.
Network Link ID
Set the Network Link ID in the General tab on the Channel Configuration
screen. The Link ID value is a user-defined number between 1 and 65,535. All
devices that can initiate remote messages and are connected to the local network
must have the same number for this variable.
Configuring a Multi-hop A user can configure a multi-hop remote message in the RSLogix500 Message
Setup screen.
Remote Message on
EtherNet/IP Communication Three examples of EtherNet/IP messaging are shown in this section:
Channel • MicroLogix 1400 Ethernet to SLC5/04 DH+ via ENET & DHRIO.
• MicroLogix 1400 Ethernet to SLC 5/03 DH485 via ENET, DHRIO and
1785-KA5 bridge device
• MicroLogix 1400 Unsolicited Write Message to RSLinx via Ethernet
The following illustrates the MicroLogix 1400 (CH1 Ethernet) sending a remote
message to a SLC5/04 processor (DH+ Node 51). The remote message will s an
ENET module, a ControlLogix chassis (Gateway) and a DHRIO module. In
order for the message to pass through the network, a MultiHop MSG must be
setup and a DHRIO Routing table must exist.
MicroLogix 1400
Ethernet Hub
100.100.115.1
DHRIO Link ID 24
Belden 9463 "Blue Hose" cable is used to connect the DH+ devices on the
network. Ethernet cable and an Ethernet hub are used to connect the ENET
module and the MicroLogix 1400 CH1 Ethernet ports together.
Select a driver that will allow you to see and connect up to the DHRIO module.
Right Click your mouse on top of the DHRIO module and a drop down box will
open.
Select DHRIO Routing Table tab. If no routing table has been created the
following should appear.
Right click on the Backplane and left click on Edit Module. Make sure that the
Back plane Link ID is set to 20.
Right click on the 1756-DHRIO module and left click on Edit Module. Make
sure that CH A's Link ID is set for 7 and CH B's Link ID is set for 2. Select OK.
Channel B is actually not necessary.
Right click on the Backplane and left click on Add Module. Left click on
1756-ENET.
Enter the correct slot number 2 and Link ID 16 for the ENET module.
Right click on the 1756-ENET Link ID and left click on Add Module. Left click
on AB PLC.
Enter the IP address (100.100.115.1) for the destination Ethernet processor and
its Link ID (24).
The following is the logic necessary for the MicroLogix 1400 processor.
A MSG route must be configured in the MultiHop tab of the MSG Setup Screen.
Click on the ControlLogix Backplane to highlight it and press the Insert key on
your computer’s keyboard to add another hop.
Double click on the From Device under the ControlLogix Backplane and select
the 1756-DHRIO.
Make sure that the From Port for the DHRIO module is set for Channel A.
Enter in the destination node address (DH+ octal address of target processor)
under the To Address.
Note: Make sure that the Target Device Data Table Address exists in the target
device.
MicroLogix 1400 Ethernet to SLC 5/03 DH485 via ENET, DHRIO and
1785-KA5 bridge device
The following illustrates the MicroLogix 1400 (CH1 Ethernet) sending a remote
message to a SLC5/03 processor (DH+ Node 51). The remote message will
passthru an ENET module, a ControlLogix chassis (Gateway), a DHRIO
module and a 1785-KA5 bridge device. In order for the message to pass through
the network, a multiHop MSG must be set up and a DHRIO Routing table must
exist. It must route to a DHRIO module onto DH+ thru a 1785-KA5 bridge to
DH485. Follow the example below for the configuration steps.
Ethernet Hub
DF1 51
100.100.115.1
DHRIO Link ID 24
A
B
100.100.115.7
44590
Link ID 27 7
You can now browse through the KA5 module from RSWho.
The following is the message setup screen for the MicroLogix 1400 controller.
A MSG route must be configured in the MultiHop tab of the MSG Setup Screen.
Click on the MultiHop tab.
Enter in the destination Link ID (DH+ address of target processor) under the To
Address. Press the Insert key to add another hop. Double click on the From
Device and select Remote(DH/DH+/DH-485). Enter in the destination node
address (DH+ octal address of target processor) under the To Address.
Note: Make sure that the Target Device Data Table Address exists in the target
device.
The MicroLogix 1400 can send remote ethernet messages using EtherNet/IP
messages. The local version of EtherNet/IP messages use the 0x4B Execute
PCCC service code, whereas the remote version needs to use the 0x4C Execute
DH+ service code.
The remote Ethernet message setup screen works the same as for a remote
DH-485 message. Selecting remote in the selectable local/remote field shows
two new fields: Remote Station Address and Remote Bridge Link ID
Also, following set up is needed in RSLinx side for MicroLogix 1400 unsolicited
MSG communication with OPC client.
• Remote Bridge Link ID 15 (dec)
• Remote Station Address 63 (dec)
• Chan 1 Network Link ID 0
• Source Station Address 0 (always)
There are four steps required to send unsolicited message to RSLinx DDE/OPC
client applications via EtherNet/IP
• Configure a new DDE/OPC topic in RSLinx for unsolicited data.
• Configure Remote Routing Configuration.
• Configure the DDE topic and Item in RSLinx.
• Configure the ML1400 MSG instruction
Trigger MSG instruction. It should complete done, and OPC Test Client
should display the N7:0 data, as well as “Good” Sub Quality:
Configuring a MicroLogix The MicroLogix 1400 supports CIP Generic messages over ethernet port. This
section describes how to configure a CIP Generic message when you are use
1400 CIP Generic Message Ethernet communication channel 1 of the MicroLogix 1400. The Network
via Ethernet Configuration is shown below.
ML 1400
Ethernet Hub
10.121.29.144
DHRIO Link ID 24
A
B
10.121.29.199
445941
Link ID 16
The RSLogix Message Setup Screen is shown below. This screen is used to setup
“This Controller”, “Target Device”, and “Control Bits”. Descriptions of each of
the elements follow.
You must select CIP Generic in Communication Command field. Also the size of
bytes(receive or send) is the length of service data to be sent or received in the
message.
The table below indicates the service (for example, Get Attribute Single or Set
Attribute Single) that you want to perform. Available services depend on the class
and instance that you are using. When the user clicks on the pull-down button on
the right of the Service Type box, then a pull-down list window with Custom as
the default will appear for the user to select one of these service types. Depending
on which Service Type is selected, user must fill the Class, Instance, and Attribute
field that is represented as ‘?’ mark with an appropriate Hex value.
The Service Code is the code for the requested EtherNet/IP service. This value
changes based on the Service type that has been selected. When user select a
Service type other than Custom, this is a read-only box. If user select “Custom” in
the Service type box, then user need to specify a service code in this box. Note
that only the Service Code is filled in for the user. The Class, Instance, and
Attribute must be filled in by the user just as the table below indicates with
question marks in their corresponding columns.
Note 1: Everywhere there is a question mark, this box is filled in by the user.
Note 2: Everywhere there is a value, that box also has user edits disabled.
Note 3: All other fields not mentioned here are unaffected by the Service Type.
In this example, a Get Attribute Single message reads a single attribute value. The
Class Code 0xF5 indicates TCP/IP Interface Object. The TCP/IP Interface
Object provides an attribute that identifies the link-specific object for the
associated physical communications interface. Each device shall support exactly
one instance of the TCP/IP Interface Object for each TCP/IP capable
communications interface on the module. A request to access instance 1 of the
TCP/IP Interface Object shall always refer to the instance associated with the
interface over which the request was received.
The controller reads 30 elements for a single attribute value from the
ControlLogix controller. The 30 bytes are placed in the controller's integer file
starting at word N7:0
MSG Instruction Error When the processor detects an error during the transfer of message data, the
processor sets the ER bit and enters an error code that you can monitor from your
Codes programming software.
TIP For 1770-6.5.16 DF1 Protocol and Command Set Reference Manual
users: The MSG error code reflects the STS field of the reply to
your MSG instruction.
· Codes E0 to EF represent EXT STS codes 0 to F.
· Codes F0 to FC represent EXT STS codes 10 to 1C.
Special Function with MSG MicroLogix 1400 supports the configuration of IP Address, Subnet Mask,
Gateway Address, Default Domain Name, Primary Name Server, and Secondary
instruction Name Server in the Ethernet Channel Configuration File via Ethernet MSG
instruction.
MicroLogix 1400 also supports SMTP Email. Using the SMTP Configuration in
the Channel Configuration and MSG instruction, the MicroLogix 1400 can send
SMTP messages to an Email Server. MicroLogix 1400 Series B controllers
support the configuration of the SMTP Configuration File via the Ethernet
MSG instruction.
These features are enabled by sending the 485CIF write Write message to the
local IP Address with ST data file type.
You can use a MSG instruction to change the Ethernet Channel Configuration.
The maximum string size in SMTP configuration file is 62 bytes. MSG returns an
error if the string size exceeds 62bytes.
For the change of the Email Server, once an email is triggered, a TCP connection
between Email Server and the controller is kept. In this case, although Email
Server in the SMTP configuration file was changed by MSGs, SMTP subsystem
does not disconnect the TCP connection. So, newly configured Email Server is
not applied immediately. In this case, you can use BK bit in the MSG instruction
that triggers email so that the TCP connection is closed immediately after the
completion of the SMTP message.
For example, if you need two consecutive MSG instructions for sending emails
after each MSG for changes to TO address offset 0, you might write ladder
programs as below.
In this case, rung 0 and 2 are executed almost at the same time. And rung 1 may
not be started or completed, since it needs several transactions between the Email
Server and the controller to completely send a single email.
The MSG in rung 1 may send the email to the second address [email protected]. To
avoid this situation, the MSG instruction in rung 2 must not be executed before
the completion of the MSG in rung 1. The MSG in rung 2 must see the
completion (DN bit set) of the MSG in rung 1. The following ladder program are
more correct.
Email Functionality
This section describes how to configure a SMTP email message when you use
Ethernet communication channel 1 of the MicroLogix 1400.
HOSTNAME>
<IPADDR>
<HOSTNAME>?port=<xxx>
<IPADDR>?port=<xxx>
For example:
These parameters are non-editable in RUN mode. You can change them in
offline or online PROGRAM mode. Maximum character length for the string
parameters is 62 bytes. LEN (=Length) fields in the SMTP Configuration File
are not editable. If String Text is entered, RSLogix500 updates the Length fields
automatically.
Configure MSG Setup The picture below provides an example of how the MSG Instruction would be
configured to be used to send SMTP message.
Screen to send SMTP
General MSG Setup Screen for SMTP messaging
message
The picture below shows MultiHop setup screen and configured E-mail Subject
and Body using an ST file.
MultiHop Setup Screen for SMTP messaging
When the SMTP subsystem cannot send an email, the error code is shown via
MSG instruction. Error Code 0xDD is stored in Word 18 of the MG file
(MGx:y.ERR). Internal Fail Code is stored in Word 22 of MG file (MGx:y.22).
When messaging through SMTP communication and the low byte is 0xDD, the
high byte of this sub-element contains detailed Fail Code returned by the SMTP
subsystem.
For E-mail subject and body, Inline Indirection functionality can be used. In the
previous General MSG setup screen, E-mail subject is ST70:0 and body is
ST70:1. If "SMTP BODY 0 [N7:0]" is written in the String File, "[N7:0]" is
replaced by a String of the value N7:0.
When the controller mode is changed to User Fault mode, the user fault routine
must be defined in the word 29 (Fault Routine S2:29) of System Status File
before e-mails can be sent. The SMTP MSG instruction must be used in the
configured Fault Routine as well.
Configuration for sending email in UFR
Notes:
Modbus TCP
With the Modbus TCP feature, you can use a MicroLogix 1400 controller to
communicate via Modbus TCP protocol.
Modbus TCP Architecture MicroLogix 1400 Series B controllers support both the TCP Server and Client
features. Modbus TCP Client takes over Modbus Master features and Modbus
TCP Server takes over Modbus Slave features on the Ethernet.
Both Modbus TCP Server and Client are enabled through Channel
Configuration. For Modbus TCP Client, a MSG instruction is used to send or
receive the Modbus TCP packets.
Channel Configuration for The default communication protocol for the Ethernet Channel 1 in the
MicroLogix 1400 is Ethernet/IP. To communicate with Modbus TCP protocol
Modbus TCP in the MicroLogix 1400 Series B controller, the channel must be configured for
Modbus TCP protocol.
To enable Modbus TCP protocol, select Modbus TCP Enable in the Channel 1
configuration.
Unlike serial port configuration, you must cycle power to the controller after
downloading the Ethernet port configuration to enable Modbus TCP.
Modbus TCP Server configuration can be done in the Chan. 1 - Modbus tab.
This configuration is for the Modbus TCP Server subsystem in MicroLogix 1400
controllers. The parameter Modbus TCP Enable is configured in the Channel 1
tab and other parameters are configured in the Chan. 1 - Modbus tab.
The valid selections are Enabled (Checked) and Disabled (Unchecked). Default
value is Disabled (Unchecked). A power cycle is required for changes to take
effect.
The parameters File Numbers for Coils, Contacts, Input Registers and Holding
Registers are configurable, with B or N files only. Valid range is 0, 3, 7, 9…255.
Default value is 0.
See Modbus Slave Memory Map on page 561 for more details.
The valid selections are Enabled (Checked) and Disabled (Unchecked). Default
value is Disabled (Unchecked).
When the selection is Disabled (Unchecked), a single file is allocated for the
Holding Registers that are configured.
When the selection is Enabled(Checked), multiple files are allocated for the
Holding Registers that are configured successively.
See Modbus RTU Slave Configuration on page 559 for more details.
The valid selections are Enabled (Checked) and Disabled (Unchecked). Default
value is Disabled (Unchecked).
When the selection is Enabled (Checked), MicroLogix 1400 accepts the requests
only from the Modbus TCP Client IP Address which is configured in the
parameters Client IP Address0 to Client IP Address4. The maximum number of
Client IP Address for Access Control is 5.
This value is used for validation of the Client IP address when the Enable Access
Control for IP Addresses is Enabled (Checked). This value is only valid when the
Enable Access Control for IP Addresses is Enabled (Checked).
This value is used to configure Local TCP Port Number, which is used for TCP
socket listening.
The diagnostic file number is used to store the diagnostics for troubleshooting
the Modbus TCP Ethernet subsystem. The status of Modbus TCP Server and
Client subsystem is stored in this data file.
The value of this parameter is N file only. Valid range is 0, 7, 9…255. Default
value is 0.
See Diagnostics for Modbus TCP on page 430 for troubleshooting information.
The valid selections are Enabled (Checked) and Disabled (Unchecked). Default
value is Disabled (Unchecked). A power cycle is required for changes to take
effect.
The diagnostic file number is used to store the diagnostics for the
troubleshooting of Modbus TCP Ethernet subsystem. The status of Modbus
TCP Server and Client subsystem is stores to this data file.
The value of this parameter is N file only. Valid range is 0, 7, 9…255. Default
value is 0.
See Diagnostics for Modbus TCP on page 430 for troubleshooting information
Messaging for Modbus TCP In MicroLogix 1400 controller ladder programs, use a MSG instruction to
request or receive a Modbus TCP packet.
Client
You can see configurable parameters that are similar to the ones for Modbus
Master MSG instruction over Serial communication. These parameters are
described in the following table.
Modbus TCP MSG Parameter
Modbus TCP MSG Description
Parameter
Message Timeout The default value is 2 seconds. However, once this MSG instruction is
activated, it is changed to 33 seconds by the controller.
Unit Identifier This is used in the identification of a remote slave that is connected on a
serial line or on other buses. Default value is 255. Use this default value if
the target device is not a gateway.
Routing Information Specify an RI file.
File (RI)
Ethernet (IP) Address Enter the IP Address of the target device.
Port Enter the TCP Port Number of the target device. Default value is 502.
Control Bits (TO, BK, TO bit: If this bit is set, the MSG instruction will cause message timeout and
EN) set error bit.
BK bit: If this bit is set, the TCP connection is closed after the Modbus TCP
message is sent out to the Target Device.
EN bit: If this bit is set, the MSG instruction will be triggered.
Error Code (Hex) Error Codes as described for Ethernet/IP messaging. See MSG Instruction
Error Codes on page 453.
Error Description Error Code descriptions as described for Ethernet/IP messaging. See MSG
Instruction Error Codes on page 453.
The MSG timeout is determined by adding the Msg Connection Timeout, Msg
Reply Timeout and Default addition time (15 seconds).
In the RSLogix 500/RSLogix Micro ladder program, you can also set the
MGx:y.TO bit for any outstanding Modbus TCP MSG instructions. This causes
the MSG instruction to timeout and set the MGx:y.ER bit.
Diagnostics for Modbus Diagnostic Counters and Errors in the Modbus TCP subsystem for the Ethernet
channel are logged in the N Data File. The data file is configured with the
TCP parameter Diagnostic File Number. The following table shows the 80 words of
the data file for troubleshooting.
Range of Error codes for Modbus TCP Server and TCP Client
Word offsets 7 and 47 reflect the Error Codes in sessions for Modbus TCP Server
and TCP Client respectively. The possible Error Codes are listed in the following
table. Others that are not defined here are reserved.
The Channel 1 - Modbus TCP tab of the Channel Status dialog allows you to see
status and errors for Server Link Layer, Server Application, Client Link Layer and
Client Application Layer.
Overview The socket interface allows you use a MicroLogix controller to communicate, via
the Ethernet Subsystem, with Ethernet devices that do not support the EtherNet/
IP application protocol, such as bar code scanners, RFID readers, or other
standard Ethernet devices.
Before you use the socket interface, you should be familiar with the following:
• basic TCP/IP, UDP, and socket programming concepts.
• how to write socket programs in a programming language, such as C or
Visual Basic.
• how to use diagnostic tools, such as a network sniffer.
• the application protocols of the devices and applications with which the
MicroLogix controller will communicate.
• how to write ladder logic for a MicroLogix controller.
Socket Interface The socket interface is implemented via the Socket Object in the Ethernet
Subsystem. MicroLogix controller programs communicate with the Socket
Architecture Object via MSG instructions. MSG requests to the Socket Object are similar to
socket API calls in most computer operating systems. The Socket Object services
let you open connections, accept incoming connections, send data, and receive
data.
To communicate with another device, you must understand the other device's
application protocol. The Ethernet Subsystem has no application protocol
knowledge — it simply makes the socket services available to programs in
MicroLogix controllers.
You can create as many as 8 socket instances. Each socket instance can be one of
these socket types:
• UDP socket (to send/receive UDP datagrams)
• TCP client socket (RSLogix500 initiates the connection)
• TCP server socket (another device initiates the connection to
RSLogix500)
You can partition the 8 available socket instances between UDP and TCP sockets
by:
• Using all 8 instances for client TCP connections.
• Using all 8 instances to listen for incoming TCP connections and then
accept 8 connections from other device.
• Performing both TCP client and server operations.
• Performing both TCP and UDP operations.
When you use the socket instance as a TCP server type, you don't need to make a
listen socket. Even if you would like to listen for incoming TCP connections to
the same port, you should create a new socket instance. No listen socket instance
is supported.
Once you open a connection on a client socket instance, you cannot use the same
socket instance to accept incoming connections. Similarly, if you accept
connections on a socket instance, you cannot then use the instance to open
outgoing connections. This behavior is consistent with standard socket API
behavior.
Here, the MicroLogix controller sends data to a device and then the device sends
a response. This is a typical sequence of transactions. Depending on the
application protocol, the device could initiate sending data to the MicroLogix
controller once the connection is open.
CreateSocket Response
Instance=102
OpenConnection
“10.10.10.11?Port=49200”
OpenConnection Response
Write
Data = abc
Read
Timeout = 10000 ms
Send Data
Data = xyz
Read Response
Data = xyz
The exact sequence of sending and receiving data depends on the application
protocol.
Typical Sequence of Transactions for a TCP Server
MSG in Ladder Ethernet Subsystem Remote Ethernet
Program 10.10.10.10 Device
10.10.10.11
CreateSocket
Port=49100
CreateSocket
Response
Instance=102
AcceptConnection
Timeout = 10000 ms
(ListenTCP
Connection)
Open TCP
Connection
Port=49100
(Accept TCP
Connection)
AcceptConnection
Response
Send Data
Data = abc
Data = abc
Read
Timeout = 10000 ms
Read Response
Data = abc
Write
Data = xyz
The example below shows the MicroLogix controller sending data to a device and
then the device sending a response. This is a typical sequence of transactions.
Depending on the application protocol, the device could instead initiate sending
data to the MicroLogix controller. Additionally, each Write does not require an
application response or acknowledgement. The application protocol determines
the exact sequence of application transactions.
Typical Sequence of Transactions for UDP Without OpenConnection
MSG in Ladder Ethernet Subsystem Remote Ethernet
Program 10.10.10.10 Device
10.10.10.11
CreateSocket
Port=49100
CreateSocket
Response
Instance=102
Write
10.10.10.11?Port=4920
0
Data = abc
Write Response
The response is returned
to the controller as soon
as the data is sent
Data = xyz
Read Response
10.10.10.11?Port=49200
Data = xyz
The exact sequence of sending and receiving data depends on the application
protocol.
Typical Sequence of Transactions for UDP With OpenConnection
MSG in Ladder Ethernet Remote Ethernet
Program Subsystem Device
10.10.10.10 10.10.10.11
CreateSocket
Port=49100
CreateSocket
Response
Instance=102
OpenConnection
10.10.10.11?Port=49200
OpenConnection
Response
Write
Data = abc
Write Response
The response is returned
to the controller as soon
as the data is sent
Data = xyz
Read Response
10.10.10.11?Port=49200
Data = xyz
Communicate With the In MicroLogix controller programs, you can use a CIP Generic MSG instruction
to request socket services.
Socket Object Via a MSG
Instruction
Message Parameters
CIP Generic Msg Parameter Description
Channel Select 1 (Integral)
Communication Command Select CIP Generic
Service Select Custom
Message Parameters
CIP Generic Msg Parameter Description
Service Code Each socket service has a unique service code:
·CreateSocket : 4B (hexadecimal)
·OpenConnection : 4C (hexadecimal)
·AcceptConnection : 50 (hexadecimal)
·Read : 4D (hexadecimal)
·Write : 4E (hexadecimal)
·DeleteSocket : 4F (hexadecimal)
·DeleteAllSockets : 51 (hexadecimal).
Class Specify 342 (hexadecimal) for the Socket Object.
Instance Specify:
·0 for CreateSocket and DeleteAllSockets
services
·Instance number returned by
CreateSocket for other services
Use a relay ladder instruction to move the
returned instance number from a CreateSocket
service into the MGx:y.TFN element of a MSG
instruction.
Attribute Specify the attribute value only when getting or
setting an attribute, not when using other
services.
Data Table Address (Send) Specify N file.
Contains the request parameters for the socket
service. Create a user defined type for the
request parameters for each service.
Size in Bytes (Send) Specify the length of the Send Element.
Data Table Address (Receive) Specify N file.
Contains the response data returned by the
service.
Create a user defined type for the response data
for each service.
Size in Bytes (Receive) Specify the length of the Receive Element.
Extended Routing Info File(RIX) Specify RIX file.
Control Bits(TO, BK, EN) TO bit: If this bit is set, the MSG instruction will
cause message timeout and set error bit.
BK bit: Specify 0. This bit is not used for this
Socket Object and is ignored.
EN bit: If this bit is set, the MSG instruction will
be triggered.
Error Code(Hex) See Possible Error Codes for Socket Services on
page 463.
Error Description See Possible Error Codes for Socket Services on
page 463.
Message Parameters
CIP Generic Msg Parameter Description
To Address in MultiHop tab Always specify “127.0.0.1”. The "To Address"
must point to the controller's Local IP Address.
Data in Send Data tab This tab shows the Send Data table in CIP byte
order. Some parameters in Socket Interface
services require ASCII string format.
Use this tab to enter the ASCII string with ASCII
Radix. See OpenConnection on page 450.
Data in Receive Data tab This tab shows the Receive Data table in CIP
byte order.
For details on specific services, see Socket Object Services on page 447.
The maximum amount of application data you can send or receive depends on
whether you configure the MSG instruction as connected or unconnected. The
size of the application data does not include the parameters in the Read and Write
services.
For Read/Write service from/to TCP sockets, if the application data is larger
than the maximum size, you can issue multiple Reads or Writes to receive or send
the entire application message.
For Read service from UDP sockets, if the application data is larger than the
maximum size, you can issue multiple Reads to receive the entire application
message.
For Write service to UDP sockets, the size application data cannot exceed the
maximums listed for Read and Write services.
Service Timeouts
You must specify a Timeout parameter (in milliseconds) for any service that
might not complete immediately (OpenConnection, AcceptConnection, Read,
and Write). The timeout tells the Socket Object the maximum amount of time it
should wait when attempting to complete the service. While waiting for the
service to complete, the MSG instruction is enabled.
If the requested service does not complete before the Timeout period expires, the
Socket Object returns a response to the service request. See the service
descriptions for the content of the response.
IMPORTANT Make the value of the service Timeout parameter shorter than the
MSG instruction timeout, otherwise application data could be lost.
The MSG timeout is determined by adding the Msg Connection Timeout, Msg
Reply Timeout and Default addition time (15 seconds).
If you put the controller in Program mode before existing socket instances time
out, the controller will disconnect all the connections and delete all the socket
instances.
IMPORTANT Make sure the Inactivity Timeout is longer than the longest interval
between socket operations. If the Inactivity Timeout is too short,
socket instances may time out, resulting in MSG instruction errors.
Your application program should detect the loss of TCP connections and handle
those events appropriately. You can detect connection loss when a:
• Read service returns with an error
• Write service returns with an error. See Possible Error Codes for Socket
Services on page 463.
If you want to re-establish communications with the other device, you must:
• delete the socket instance for the lost connection
• if the connection is a client connection, create a new socket instance and
issue an OpenConnection service to the target device
• if the connection is a server connection, issue an AcceptConnection
service to wait for another connection from the remote device.
Executing mode includes Run, Remote Run, Test Continuous Scan, and Test
Single Scan modes. Any others are Non-Executing modes.
In RSLogix500, you can also set the MGx:y.TO bit for any outstanding
socket-related MSG instruction. This causes the MSG instruction to timeout and
set the MGx:y.ER bit.
Partial Reads
It is possible for a Read service to return a BufLen that is less than the requested
amount of data. For example, your program may request 100 bytes of data.
Because TCP is a byte stream and not a datagram protocol, you can receive less
than 100 bytes when the Read service returns.
Depending on the application protocol, you can issue additional Read requests to
receive all the data. If the application protocol dictates that all messages are 100
bytes, then you must issue additional Reads until you receive 100 bytes. If the
application protocol uses variable size messages, your program needs additional
logic to handle variable message sizes as defined by the application protocol.
When issuing multiple Read services, be careful to adjust the destination data
table that receives the data so that data is not overwritten. This fragment of
Structured Text logic shows an example of handling a partial Read service.
/* copy the message we just read */
CPW ( ReadResponse.Buf[0], ReadBuf[CurrentLen], ReadResponse.BufLen );
CurrentLen := CurrentLen + ReadResponse.BufLen;
IMPORTANT If you do not issue consecutive Read services, the rest of the
application data will be lost. For example, if the application data
size is 100 bytes and you issued a Read service with 50 bytes, you
should read the rest of data 50 bytes with consecutive Read service.
If you issued a Write service without consecutive Read service, the
rest of data 50 bytes will be lost.
Partial Writes
Your program may need to handle the situation, although uncommon, where the
Write service is unable to send all the specified bytes. Such a situation can occur if
the Write service is called multiple times before the target application can receive
the data.
If the Write service is not able to send all of the requested data, your program
should issue subsequent Writes to send the remaining data. Your program should
also adjust the source data table, so that old data is not sent.
Socket Object Services The Socket Object supports the following services.
Socket Service
CreateSocket
OpenConnection
AcceptConnection
Read
Write
DeleteSocket
DeleteAllSockets
The MicroLogix controller assumes that the outgoing data is in CIP byte order
except the application data(data in Buf ). The application data is sent out as it is.
The MicroLogix controller assumes that the incoming data is in CIP byte order
except the application data. For example, if you issue a Write service with 2 bytes
integer, that integer is sent over a TCP connection or in a UDP datagram in CIP
byte order. If you issue a Read service and your destination data table (for the
response) contains an integer, the MicroLogix controller assumes the incoming
data is in CIP byte order.
Depending on the native byte order of the application you are communicating
with, you may have to convert the byte order in RSLogix500 and/or in the
application.
So, N file should contain the data in CIP byte order as shown below:
27 10 00 00 02 00 64 00 01 02 03 04 06 00 00 00 41 42 43 44 45 46
So, N file will contain the data in CIP byte order as shown below:
06 00 00 00
CreateSocket
The CreateSocket service creates an instance of the Socket object. The service
returns an instance number that you use in the subsequent socket operations.
To call this service, click "Setup Screen" in the MSG instruction and enter the
values displayed below.
• SocketType : Specify 1 for TCP, 2 for UDP. 0 or all others are reserved.
• Reserved : Specify 0.
• Structure of SocketAddr :
• Family : Specify the address family. Must be 2.
• Port : Specify a local port number, or set to 0 (the local port number
will be chosen by Ethernet subsystem). For TCP client operations,
specify 0 unless you want a specific local port number. For TCP server
communications, specify the port number on which to accept incoming
connection requests. For UDP, to receive datagrams on a specific port,
you must specify a local port number.
• IPAddr : Specify an IP address. Typically, set to 0 (any address).
OpenConnection
AcceptConnection
Parameter Value
Service Type AcceptConnection
Service Code 50 (hexadecimal)
Class 342 (hexadecimal)
Instance 0. Use a relay ladder instruction to move the returned instance
number from a CreateSocket service into the MGx:y.TFN
element of a MSG instruction
Attribute 0
To call this service, click "Setup Screen" in the MSG instruction and enter the
values displayed below.
• SockInstance : Contains the instance for this service. Use this Instance on
subsequent Read and Write services for this connection.
• Reserved : Specify 0.
• Structure of FromAddr :
• Family : Contains the address family. Must be 2.
• Port : Contains a remote port number.
• Addr : Contains an remote IP address.
Read
The Read service reads data on a socket. You can specify a number of bytes to
receive. The Read service returns the number of bytes received.
For TCP, the Read service returns when any data is received, up to the requested
number of bytes. The Read service can return fewer bytes than were requested.
Your application might need to issue multiple Read requests to receive an entire
application message.
Parameter Value
Service Type Read
Service Code 4D (hexadecimal)
Class 342 (hexadecimal)
Instance 0. Use a relay ladder instruction to move the returned instance
number from a CreateSocket service into the MGx:y.TFN
element of a MSG instruction
Attribute 0
To call this service, click "Setup Screen" in the MSG instruction and enter the
values displayed below.
• Structure of FromAddr :
• Family : Contains the address family. Must be 2.
Write
The Write service sends data on a socket. You can specify the number of bytes to
send. The Write service attempts to send the requested number of bytes and
returns the number of bytes sent.
Parameter Value
Service Type Write
Service Code 4E (hexadecimal)
Class 342 (hexadecimal)
Instance 0. Use a relay ladder instruction to move the returned instance
number from a CreateSocket service into the MGx:y.TFN
element of a MSG instruction
Attribute 0
To call this service, click "Setup Screen" in the MSG instruction and enter the
values displayed below.
You can use Inline Indirection functionality for N file in Write service.
If "SEND N7:2 = [N7:2]" is written in the Buf field of the N file, "[N7:2]" is
replaced to a string of the value of N7:2. For example, if N7:2 contains a data 39,
the string "SEND N7:2 = 39" is sent out. If "SEND L9:3 = [L9:3]" is written in
the Buf field of the N file, "[L9:3]" is replaced to a string of the value of L9:3. For
example, if L9:3 contains a data 3456789, the string "SEND L9:3 = 3456789" is
sent out.
The number of replaced characters may be smaller or larger than the number of
Inline Indirection characters. If the number of replaced characters is smaller than
the number of Inline Indirection characters, NULL will be filled in at the end of
the buffer, as many as the difference between the numbers. If the number of
replaced characters is larger than the number of Inline Indirection characters, the
transmitted data is trimmed by as many characters as the difference between the
numbers.
DeleteSocket
The DeleteSocket service deletes a socket instance. For a TCP connection, the
DeleteSocket service also closes the connection prior to deleting the instance.
Parameter Value
Service Type Read
Service Code 4F (hexadecimal)
Parameter Value
Class 342 (hexadecimal)
Instance 0. Use a relay ladder instruction to move the returned instance
number from a CreateSocket service into the MGx:y.TFN
element of a MSG instruction
Attribute 0
To call this service, click "Setup Screen" in the MSG instruction and enter the
values displayed below.
DeleteAllSockets
The DeleteAllSockets service deletes all currently created socket instances. For
TCP, the DeleteAllSockets service also closes all connections prior to deleting the
instances.
Parameter Value
Service Type DeleteAllSockets
Service Code 51 (hexadecimal)
Class 342 (hexadecimal)
Instance 0
Attribute 0
To call this service, click "Setup Screen" in the MSG instruction and enter the
values displayed below.
Possible Error Codes for If the Socket Object encounters an error with a service request, or while
processing the service request:
Socket Services
• The Socket Object returns an error code.
• The MSG instruction sets the MGx:y/ER bit.
• The MSG instruction sets error codes in Word 18(MGx:y.ERR) of MG
file. Low byte is error code 0xDE (Object Specific General Error) and high
byte is 0.
• The MSG instruction sets internal fail code in Word 22(MGx:y.22) of
MG file. Low byte is error code 0xDE (Object Specific General Error) and
high byte of this sub-element contains detailed extended error code.
This chapter describes how to use the Recipe and Data Logging functions.
The RCP file allows you to save custom lists of data associated with a recipe.
Using these files along with the RCP instruction lets you transfer a data set
between the recipe database and a set of user-specified locations in the controller
file system.
The following reasons may help you choose which type of memory to use:
• All the recipe data is stored into the controller’s memory module. Because
the recipe data is stored in Data Log Queue memory, it does not consume
user program space.
• If you are not using the data logging function, it allows you more memory
(up to 64K bytes) for RCP files. You can use the Data Log Queue for data
logging and recipe data, but the total cannot exceed 128K bytes.
See step 2, “Create a RCP File” on page 467 for the recipe file procedure.
• Recipe File Number - this is the file number that identifies the custom list
of addresses associated with a recipe.
• Recipe Number - specifies the number of the recipe to use. If the recipe
number is invalid, a user fault (code 0042) is generated.
• File Operation - identifies whether the operation is a Load from the
database or a Store to the database.
When executed on a True rung, the RCP instruction transfers data between the
recipe database and the specified data locations.
Addressing Modes and File Types are shown in the following table:
Address
Floating Point
PTOX, PWMX
Parameter
CS - Comms
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
RI/RIX
Direct
T, C, R
Word
MMI
HSC
DAT
RTC
BHI
STI
TPI
Bit
EII
ST
N
O
B
S
L
I
Recipe
•
Number
File • • • • • • • • • • • •
• File - This is the number identifying the RCP file. It is the Recipe File
Number used in the RCP instruction in your ladder program and identifies
the recipe database.
• Number of Recipes - This is the number of recipes contained in the RCP
file. This can never be more than 256. This is the Recipe Number used in
the RCP instruction in your ladder program.
• Name - This is a descriptive name for the RCP file. Do not exceed 20
characters.
• Description - This is the file description (optional).
• Location where recipe data is stored (applies to all recipe files) - This
allows you to designate a memory location for your RCP files.
IMPORTANT All the recipe data is stored into the controller’s memory
module (1766-MM1).
3. Enter the RCP file parameters as shown below. When finished click on
OK.
4. A new window will appear. In this window, enter the values as shown
below.
When B3:0/0 is energized and B3:0/1 and B3:0/2 are de-energized, Recipe File
0:Recipe number 0 is executed loading the following values to create Yellow
paint.
• N7:0 = 500
• N7:1 = 500
• N7:2 = 0
• T4:0.PRE = 500
When B3:0/1 is energized and B3:0/0 and B3:0/2 are de-energized, Recipe File
0:Recipe number 1 is executed loading the following values to create Purple
paint.
• N7:0 = 500
• N7:1 = 0
• N7:2 = 500
• T4:0.PRE = 500
When B3:0/2 is energized and B3:0/0 and B3:0/1 are de-energized, Recipe File
0:Recipe number 2 is executed loading the following values to create White paint.
• N7:0 = 333
• N7:1 = 333
• N7:2 = 333
• T4:0.PRE = 1000
Monitor the N7 data file. Notice the values change after each bit is toggled.
This example describes loading values from a RCP file to data table addresses.
However, note that by changing the RCP file operation from Load to Store,
values can be loaded by ladder logic into the recipe database for each Recipe
number.
= 10 * 3 (bytes)
= 30 bytes
Data Logging Data Logging allows you to capture (store) application data as a record for
retrieval at a later time. Each record is stored in a user-configured queue in battery
backed memory (B-Ram). Records are retrieved from the MicroLogix 1400
processor via communications. This chapter explains how Data Logging is
configured and used.
Queues and Records The MicroLogix 1400 processor has 128K bytes (128 x 1024) of additional
memory for data logging purposes. Within this memory, you can define up to
256 (0…255) data logging queues. Each queue is configurable by size (maximum
number of records stored), and by length (each record is 1…109 characters). The
length and the maximum number of records determine how much memory is
used by the queue. You can choose to have one large queue or multiple small
queues.
The memory used for data logging is independent of the rest of the processor
memory and cannot be accessed by the User Program. Each record is stored as the
instruction is executed and is non-volatile (battery-backed) to prevent loss during
power-down.
Program Files Data Files Function Files Specialty Files
HSC
2 0 PTOX Q0
3 1 PWMX Q1
4 2 STI Q2
5 3 EII Q3
6 to 255 4 to 255 RTC Q4 to 255
Example Queue 0
This queue is used to show how to calculate the string length of each record and
maximum number of records.
Queue 0 (Date = ✔, Time = ✔, Delimiter = ,)
Date Time N7:11 L14:0 T4:5.ACC I1:3.0 B3:2
Record 0 01/10/2000 , 20:00:00 , 2315 , 103457 , 200 , 8190 , 4465
Record 1 01/10/2000 , 20:30:00 , 2400 , 103456 , 250 , 8210 , 4375
Record 2 01/10/2000 , 21:00:00 , 2275 , 103455 , 225 , 8150 , 4335
Record 3 01/10/2000 , 21:30:00 , 2380 , 103455 , 223 , 8195 , 4360
Record 4 01/10/2000 , 22:00:00 , 2293 , 103456 , 218 , 8390 , 4375
Record 5 01/10/2000 , 22:30:00 , 2301 , 103455 , 231 , 8400 , 4405
Record 6 01/10/2000 , 23:00:00 , 2308 , 103456 , 215 , 8100 , 4395
Record 7 01/10/2000 , 23:30:00 , 2350 , 103457 , 208 , 8120 , 4415
Record 8 01/11/2000 , 00:00:00 , 2295 , 103457 , 209 , 8145 , 4505
Record 9 01/11/2000 , 00:30:00 , 2395 , 103456 , 211 , 8190 , 4305
Record 10 01/11/2000 , 01:00:00 , 2310 , 103455 , 224 , 8195 , 4455
Record 11 01/11/2000 , 01:30:00 , 2295 , 103456 , 233 , 8190 , 4495
The size of a record is limited so that the length of the maximum formatted string
does not exceed 109 characters. The following table can be used to determine the
formatted string length.
Number of Records
In this example, each record consumes 18 bytes. So if one queue was configured,
the maximum number of records that could be stored would be 7281. The
maximum number of records is calculated by:
Example Queue 5
Queue 5 (Time = ✔, Delimiter = TAB)
Time N7:11 I1:3.0 I1:2.1
Record 0 20:00:00 TAB 2315 TAB 8190 TAB 4465
Record 1 20:30:00 TAB 2400 TAB 8210 TAB 4375
Record 2 21:00:00 TAB 2275 TAB 8150 TAB 4335
Record 3 21:30:00 TAB 2380 TAB 8195 TAB 4360
Record 4 22:00:00 TAB 2293 TAB 8390 TAB 4375
Record 5 22:30:00 TAB 2301 TAB 8400 TAB 4405
Record 6 23:00:00 TAB 2308 TAB 8100 TAB 4395
The size of a record is limited so that the length of the maximum formatted string
does not exceed 109 characters. The following table can be used to determine the
formatted string length.
Number of Records
Each record consumes 10 bytes. So if only one queue was configured, the
maximum number of records that could be stored would be 13107. The
maximum number of records is calculated by:
The size of a record is limited so that the length of the maximum formatted string
does not exceed 109 characters. The following table can be used to determine the
formatted string length.
Number of Records
Each record consumes 90 bytes. So if only one queue was configured, the
maximum number of records that could be stored would be 1456. The maximum
number of records is calculated by:
Configuring Data Log Data Logging is configured using RSLogix 500/RSLogix Micro programming
software version V8.10.00 or later.
Queues
1. Open a MicroLogix 1400 application. The first step in using Data Logging
is to configure the data log queue(s). Access to this function is provided via
the RSLogix 500/RSLogix Micro Project tree:
Double-click
Configuration to
access Data Log
Configuration.
Appearance of Data
Log Que Configuration
window before
creating a queue.
3. The Data Log Que dialog box appears as shown below. Use this dialog box
to enter the queue information.
4. After entering all the information for the data log queue, click on OK. The
queue is added to the Data Log Que window with a corresponding queue
number. This is the queue number to use in the DLG instruction.
IMPORTANT You must configure a data log queue before programming a DLG
instruction into your ladder program.
The DLG instruction triggers the saving of a record. The DLG instruction has
one operand:
The DLG instruction only captures data on a false-to-true rung transition. The
DLG rung must be reset (scanned false) before it will capture data again. Never
place the DLG instruction alone on a rung. It should always have preceding logic,
as shown below:
Data Log Status File There is a Data Log Status (DLS) file element for each Data Log Queue. The
DLS file does not exist until a data log queue has been configured.
The Data Log Status file has 3-word elements. Word 0 is addressable by bit only
through ladder logic. Words 1 and 2 are addressable by word and/or bit through
ladder logic.
The number of DLS file elements depends upon the number of queues specified
in the application. The status bits and words are described below.
When the DLG instruction rung is true, the Data Logging Enable (EN) is set (1)
and the DLG instruction records the defined data set. To address this bit in
ladder logic, use the format: DLS0:Q/EN, where Q is the queue number.
The Data Logging Done (DN) bit is used to indicate when the associated queue
is full. This bit is set (1) by the DLG instruction when the queue becomes full.
This bit is cleared when a record is retrieved from the queue. To address this bit in
ladder logic, use the format: DLS0:Q/DN, were Q is the queue number.
The Data Logging Overflow (OV) bit is used to indicate when a record gets
overwritten in the associated queue. This bit is set (1) by the DLG instruction
when a record is overwritten. Once set, the OV bit remains set until you clear (0)
it. To address this bit in ladder logic, use the format: DLS0:Q/OV, where Q is the
queue number.
The Data Logging ClearQueue(CQ) bit is used to clear the associated queue.
This bit is set (1) by the user. This bit is cleared when all of the records in
associated queue are cleared from memory. To address this bit in ladder logic, use
the format DLS0:Q/CQ, where Q is the queue number.
File Size (FSZ) shows the number of records that are allocated for this queue. The
number of records is set when the data log queue is configured. FSZ can be used
with RST to determine how full the queue is. To address this word in ladder
logic, use the format: DLS0:Q.FSZ, where Q is the queue number.
Records Stored (RST) specifies how many data sets are in the queue. RST is
decremented when a record is read from a communications device. To address
this word in ladder logic, use the format: DLS0:Q.RST, where Q is the queue
number.
TIP If a queue is full and another record is saved, the oldest record is
over-written. Queue behavior is the same as a FIFO stack—first in,
first out. If a queue is full and an additional record is saved, the “first”
record is deleted.
Instruction Types
Instruction Type Operand
Relay (Bit) Destination Output Bit
Compare Source A
Source B
Low Limit (LIM instruction)
Test (LIM instruction)
High Limit (LIM instruction)
Source (MEQ instruction)
Mask (MEQ instruction)
Compare (MEQ instruction)
Math Source A
Source B
Input (SCP instruction)
Logical Source A
Source B
Move Source
Retrieving (Reading) Data is retrieved from a data logging queue by sending a logical read command
that addresses the Data Log retrieval file. The oldest record is retrieved first and
Records then, deleted. The record is deleted as soon as it is queued for transmission. If
there is a power failure before the transmission is complete, the record is lost.
TIP For easy use with Microsoft Excel, use the TAB character as the
separator character.
Accessing the Retrieval You can use a dedicated retrieval tool or create your own application.
File
Retrieval Tools
You can download a free Data Logging Tool for Windows-based PCs from http:/
/www.ab.com/programmablecontrol/plc/micrologix/downloads.html.
Application Fields
Field Function Description
DST Destination Node
SRC Source Node
CMD Command Code
STS Status Code Set to zero (0)
TNS Transaction Number Always 2 bytes
FNC Function Code
Application Fields
Field Function Description
Byte Size Number of bytes to be read Formatted string length (see equation below)
File Number Always set to zero (0)
File Type Must be A5 (hex)
Element Number Queue number Determines the queue to be read (0…255)
Sub/Element Number Always set to zero (0)
Equation
Record Field 1 + Record + Record Field 3 … + Record Field 7 = Formatted
Field 2 String Length
TIP The formatted string length cannot exceed 109 bytes in length.
TIP The last byte will be a zero value representing the terminator
character.
Reply Structure
SRC DST CMD 4f STS TNS DATA EXT STS
If the data integrity check fails, the record is deleted and an error is sent with STS
of 0xF0 and ext STS of 0x0E.
Notes:
LCD Overview Through the embedded LCD, your MicroLogix 1400 lets you monitor bit,
integer and long integer data within the controller, and optionally modify that
data, to interact with your control program. Similarly to the optional 1764-DAT
for the MicroLogix 1500 controllers, the embedded MicroLogix 1400 LCD
allows users access to 256 bits, 256 integers and 256 long integers, each of which
can be individually protected. If you need to know the speed of a conveyor, the
status of a remote sensor, or how close your process is running relative to its
optimal temperature, you can just monitor your LCD.
Making use of the new MicroLogix 1400 “LCD Instruction”, your controller can
directly interface with a local operator using your ladder logic. The LCD
Instruction executes under two modes of operation, the first mode being ladder
logic output to the display only (hereafter called “Display Only mode”). In this
Display Only mode, up to three lines of data, with up to 16 characters per line,
can be sent to the display from the ladder logic running in the controller. Think
of this as messaging to the LCD. These lines can consist of combinations of Bits,
Integers, Long Integers, Floating and String characters. So now the control
program can send alert/alarm messages, I/O data values, simple text messages, or
combinations of these messages to the operator. These messages can be triggered
by events (input sensors, timer “done bits”, message from another controller, etc.),
or based on a scheduled action (using the embedded real time clock, or free
running timers).
The second mode of operation again allows for output from the ladder logic to
the display, but adds input from the operator back to the controller (hereafter
called “Display With Input mode”). Up to two lines of up to 16 characters each
can still be sent to the LCD for display, but the third line, in this mode, is used to
obtain numeric input from the user. Bit, integer, or long integer file types can be
used to provide this input.
The user can select “User Display” from the LCD menu. The User Display screen
will show the specified output data when the LCD Instruction is energized.
If “DISPLAY WITH INPUT” is set to “YES”, the user can enter input using the
LCD keypad to enter Bit, Integer, or Long Integer data.
LCD Function File Within the RSLogix 500/RSLogix Micro Function File Folder, you see a LCD
Function File. This file provides access to LCD and Trimpot configuration data,
and also allows the control program access to all information pertaining to LCD
screen, keypad, Trimpot.
TIP If the controller is in the run mode, TUF, TMIN, TMAX may not
be changing, those values can be available for changing only
when program is downloaded.
The LCD Function File contains status information and control configurations
for LCD, Trimpot, and keypad, such as:
• Information about whether to use a customized display at power-up
• Keypad key-in mode and timeout settings
• Bit, Integer and Long Integer data files to monitor
• Current Trimpot values and Trimpot value range settings
LCD Function File LCD function file is comprised of 15 sub-elements. These sub-elements are
either bit, word structures that are used to provide control over LCD, Keypad,
Sub-Elements Summary Trimpot. A summary of the sub-element is provided in the following table.
LCD Function File Customized Boot Logo ASCII File Address Offset (CBL)
Sub-Elements Feature Address Data Format Type User Program
Access
CBL - Customized Boot Logo LCD:0.CBL word (INT) control read/write
ASCII File Address Offset
Customized Boot Logo ASCII File Address Offset (CBL) defines which ASCII
file number is used for boot image. When the imported BMP file exists in an
ASCII data file and a valid ASCII file is set, the controller checks the file type and
file size in the BMP header. If there is a proper image in a ASCII file, the
controller displays the BMP image in the whole window screen. If an ASCII file
does not have enough space to display an image, or a data value is not valid, the
controller displays the default logo image.
Data Input Timeout of LCD instruction (TO) specifies timeout period for data
input when key inputs are obtained from the user using the LCD instruction in
the ladder program. When this word is set to zero (0), it means no timeout is
used. When set to a positive value, the LCD exits U-DISP mode and continues to
the upper menu if there is no keypad input for more than the specified timeout
period (in seconds).
LCD Instruction Job Done (DN) is set (1) when an LCD instruction is
completed. If the Display With Input bit of the LCD instruction is clear (0, No),
DN bit is set (1) immediately after its execution result is displayed on the LCD. If
the Display With Input bit is set (0, Yes), DN bit is set (1) when the OK or ESC
key is pressed.
LCD Display Operation Error Bit (ERR) bit indicates whether there is a Trimpot
range error at each program download. Whenever a program is downloaded, the
controller compares the old Trimpot values (POT0 and POT1) with the new
Trimpot range (TMIN to TMAX) and sets (1) ERR bit if an error is found and
resets (0) if no error is found.
For example, if old POT0 =100, new TMIN=200 and TMAX=50, controller
sets (1) ERR bit. This means a Trimpot range error has occurred at program
download.
For more information about Trimpot functionality, refer to Using Trim Pots
described in the MicroLogix 1400 Programmable Controllers User Manual,
publication 1766-UM001.
LCD Module Operation Error Number (ERN) shows the error code when an
error occurs in LCD configurations and operation.
Target User Defined File Number (TUF) specifies the data file number to
monitor on the LCD. If the data type to display is not System Status, Bit, Integer,
Long Integer or Floating, the controller displays the "Not S/B/N/L/F" message.
For more information, refer to Using Trim Pots described in the MicroLogix 1400
Programmable Controllers User Manual, publication 1766-UM001.
Jog data update Mode set ( JOG) determines how the value changes are applied
when you press the Up and Down keys to change the data value for a trim pot.
When this bit is set (1), the changes are applied immediately whenever you press
the Up and Down keys. When it is clear (0), the changes are applied only when
you press the OK key after you have changed the value using the Up and Down
keys.
The Data resident in POT0 represents the position of trim pot 0. The Data
resident in POT1 corresponds to the position of trim pot 1. Those valid data
range for both is from TMIN to TMAX. POT0 and POT1 value is evaluated on
valid value when a new program is downloaded. If the previous Trimpot value is
out of the new Trimpot range, Trimpot value is changed to the nearest bound. For
example, old POT0 =1000, new TMIN=0 and TMAX=250, controller changes
the POT0 from 1000 to 250 after downloading program. You can check the ERR
and ERN to see if the POT value is modified or not. The POT0 operation
described above is identical to POT1.
WND is set when LCD menu is in U-DISP. The controller also notifies this
status to LCD screen as U-DISP status.
OK is set when OK key is pressed. This bit should be cleared so as to get the next
key input. Because once OK key is pressed, this bit is set and latched until it is
cleared by manually. This OK bit is very useful for LCD instruction. You can use
this bit as any input of ladder logic when you program with several LCD
instructions.
ESC is set when ESC key is pressed. This bit should be cleared so as to get the
next key input. Because once ESC key is pressed, this bit is set and latched until it
is cleared by manually. This ESC bit is very useful for LCD instruction. You can
use this bit as any input of ladder logic when you program with several LCD
instruction.
TIP ESC bit is presented for handy interface to LCD instruction and
keypad, so it is just updated in U-DISP screen.
LCD Backlight Time (BACKTIME) specifies the backlight timer period. When
this bit is set to zero (0), the default backlight timer period of 30 seconds applies.
When set to (1), the backlight is always on.
LCD contrast (CNST) sets the contrast of the LCD, with a range of 15…35. If
the entered data is out of range, the contrast value is changed to the nearest bound
value of range. When set to a positive value, the LCD continues to apply the
specified contrast value.
The LCD instruction is used to display string or number, get value with keypad.
display area on the LCD
Addressing Modes and File Types can be used as shown in the following table:
Address
Data Files Function Files Address Level
Mode
CS - Comms
Parameter
Long Word
Immediate
IOS - I/O
Element
Indirect
MG, PD
Direct
T, C, R
Word
MMI
HSC
RTC
LCD
PLS
BHI
STI
Bit
EII
ST
N
O
B
S
L
I
Line 2 Source A • • • • • • • • • • •
Line 2 Source B • • • • • • • • • • •
Line 3 Source A • • • • • • • • • • •
Line 3 Source B • • • • • • • • • • •
(1) L4 Source A "B, N, L" Data File is only available when Display With Input is set to 1.
(2) L4 Source B operand is not available when Display With Input is set to 1.
Default Values:
• L2 Source A, L2 Source B, L3 Source A, L3 Source B,
L4 Source A, L4 Source B: 0 (Zero means Address not assigned.)
• Display With Input: 0 (Zero means Display Only mode.)
On a true rung status, the LCD instruction operation depends on how to set the
Display With Input operand value. If Display With Input operand is clear (0),
LCD instruction mode is set to String or (and) number display. If Display With
Input operand is set (1), LCD instruction mode is set to String or (and) number
display and value input. User can use two operands per line message to display the
two different data. If Bit or Integer or Long Integer or Floating data file is
assigned to any operands (except the Display With Input operand), the number
converted to signed range string automatically. If the value is less than zero, minus
sign (“-”) is attached to the head of converted string.
If you need to get long range data (-2,147,483,648 ~ +2,147,483,647) from the
keypad, use the L data file.
The largest string size of each line is 16 characters. If there are more than 16
characters in the string file, the remaining characters except the first sixteen are
ignored. Special characters such as carriage return and new line are invalid and
have no effect on the next line.
Your application program can get value from user’s keypad inputs if Display With
Input bit is set (1) in LCD instructions. User inputs can be obtained with arrow,
ESC, and OK keys. In this case, Line 4 is used for user input. L4 Source A is used
to specify the target file or element to store user input and the L4 Source B is not
used. Where, the data value range for different file types are as follows:
• Integer file (word): -32,768…+32,767
• Bit file: 0 or 1
• Long file (double word): -2,147,483,648…+2,147,483,647
When rung conditions go true, the LCD instruction displays Line 2 and Line 3
strings and positions the cursor at Line 4. Then, the user can input a desired value
using the LCD keypad. User input is applied when the OK key is pressed. If the
ESC key is pressed, user input is cancelled and no operation is followed. During
user’s input with the LCD keypad, Line 2 and Line 3 displays are not updated.
With the LCD instruction, the LCD screen can display the characters of A to Z,
a to z, 0 to 9, and special characters in the range of ASCII 0x00…0x7F. If an Input
character is in the range of ASCII 0x80…0xFF, a question mark (?) is displayed on
the LCD.
Be careful that some special characters are substituted with the corresponding
embedded characters in the LCD. The table below shows the available character
set on the LCD. For information on how to manipulate a string file for display of
special characters, refer to your RSLogix 500/RSLogix Micro Online Help.
LCD Font
Standard character
ASCII Code (Hex)
Notes:
Programming Instructions The tables below lists the execution times and memory usage for the
programming instructions. These values depend on whether you are using word
Memory usage and or long word as the data format.
Execution Time
MicroLogix 1400 Controllers -
Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction Word Long Word
Mnemonic
Execution Time in µs Memory Execution Time in µs Memory
Usage in Usage in
True False Words True False Words
ASCII Test Buffer for Line ABL 21.5621 1.8710 1.14 None None None
Absolute Value ABS 1.4410 0.3750 1.14 1.5390 0.3730 None
ASCII Number of Characters in ACB 22.6154 3.5250 1.14 None None None
Buffer
ASCII String to Integer ACI 6.5719 0.2142 1.14 7.1146 0.1978 None
ASCII Clear Buffer ACL (both) 26.5540 0.4500 1.57 None None None
ASCII Clear Buffer ACL 7.8820 0.3848 1.57 None None None
(receive)
ASCII Clear Buffer ACL 5.8590 0.3706 1.57 None None None
(transmit)
ASCII String Concatenate ACN 9.4852 0.1982 1.57 None None None
Arc Cosine ACS 18.0150 0.3750 1.14 18.3070 0.4150 None
Add ADD 1.8868 0.3540 1.57 1.7807 0.3546 None
ASCII String Extract AEX 10.0290 0.1850 2.00 None None None
ASCII Handshake Lines AHL 26.5267 2.9480 2.00 None None None
ASCII Integer to String AIC 8.3032 0.2591 1.14 9.8913 0.2155 None
And AND 1.7894 0.3781 1.57 1.8185 0.3967 None
ASCII Read Characters ARD 9.3760 7.7770 1.57 None None None
ASCII Read Line ARL 33.9910 8.5690 1.57 None None None
ASCII String Search ASC 8.0844 0.1984 2.00 None None None
The following sections describe how indirect addressing affects the execution
time of instructions in the MicroLogix 1400 processor. The timing for an indirect
address is affected by the form of the indirect address.
For the address forms in the following table, you can interchange the following
file types:
• Input (I) and Output (O)
• Bit (B), Integer (N)
• Timer (T), Counter (C), and Control (R)
• String(ST)
MicroLogix 1400 The following is an example of how to calculate a typical scan time for a ladder
program. In this example, a program scan time of 15.0 ms is assumed. The
Scan Time Calculation program scan time includes the system overhead time.
When any of the channels are active, the following typical overheads should be
taken into account:
• Channel 0 overhead: 0.8 ms
• Channel 1 overhead: 0.4 ms
• Channel 2 overhead: 0.7 ms
If Channel 1 is active and the other two channels are inactive, total program scan
time is:
Notes:
The status file lets you monitor how your controller works and lets you direct
how you want it to work. This is done by using the status file to set up control bits
and monitor both hardware and programming device faults and other status
information.
IMPORTANT Do not write to reserved words in the status file. If you intend
writing to status file data, it is imperative that you first
understand the function fully.
Status File Overview The status file (S:) contains the following words:
Carry Flag
Address Data Format Range Type User Program Access
S:0/0 binary 0 or 1 status read/write
This bit is set (1) if a mathematical carry or borrow is generated. Otherwise the
bit remains cleared (0). When a STI, High-Speed Counter, Event Interrupt, or
User Fault Routine interrupts normal execution of your program, the original
value of S:0/0 is restored when execution resumes.
OverFlow Flag
Address Data Format Range Type User Program Access
S:0/1 binary 0 or 1 status read/write
This bit is set (1) when the result of a mathematical operation does not fit in the
destination. Otherwise the bit remains cleared (0). Whenever this bit is set (1),
the overflow trap bit S:5/0 is also set (1). When an STI, High-Speed Counter,
Event Interrupt, or User Fault Routine interrupts normal execution of your
program, the original value of S:0/1 is restored when execution resumes.
Zero Flag
Address Data Format Range Type User Program Access
S:0/2 binary 0 or 1 status read/write
This bit is set (1) when the result of a mathematical operation or data handling
instruction is zero. Otherwise the bit remains cleared (0). When an STI,
High-Speed Counter, Event Interrupt, or User Fault Routine interrupts normal
execution of your program, the original value of S:0/2 is restored when execution
resumes.
Sign Flag
Address Data Format Range Type User Program Access
S:0/3 binary 0 or 1 status read/write
This bit is set (1) when the result of a mathematical operation or data handling
instruction is negative. Otherwise the bit remains cleared (0). When a STI,
High-Speed Counter, Event Interrupt, or User Fault Routine interrupts normal
execution of your program, the original value of S:0/3 is restored when execution
resumes.
Controller Mode
(1) Valid modes are indicated by the (•) symbol. N/A indicates an invalid mode for that controller.
Forces Enabled
Address Data Format Range Type User Program Access
S:1/5 binary 1 control read only
When user sets (1) this bit, I/O forcing is enabled. When the bit is reset (0), I/O
forcing is disabled. Enabling I/O force means user can force I/O by writing I/O
force files. When I/O force is disabled, whatever is written in the I/O force file
does not affect physical output or input data file.
TIP This bit is can only be modified in offline mode. User must set/reset this
bit first and then download the program in order for the change to take
effect.
Forces Installed
Address Data Format Range Type User Program Access
S:1/6 binary 0 or 1 status read only
This bit is set (1) by the controller to indicate that 1 or more inputs or outputs are
forced. When this bit is clear, a force condition is not present within the
controller.
When set (1), causes the controller to clear the Major Error Halted bit (S:1/13)
at power-up. The power-up mode is determined by the controller mode switch
and the Power-Up Mode Behavior Selection bit (S:1/12).
When set (1) and the controller powers up in the RUN or REM RUN mode, the
controller executes the User Fault Routine prior to the execution of the first scan
of your program. You have the option of clearing the Major Error Halted bit (S:1/
13) to resume operation. If the User Fault Routine does not clear bit S:1/13, the
controller faults and does not enter an executing mode. Program the User Fault
Routine logic accordingly.
TIP When executing the startup protection fault routine, S:6 (major
error fault code) contains the value 0016H.
For this option to work, you must set (1) this bit in the control program before
downloading the program to a memory module. When this bit it set in the
memory module and power is applied, the controller downloads the memory
module program when the control program is corrupt or a default program exists
in the controller.
TIP If you clear the controller memory, the controller loads the
default program.
The mode of the controller after the transfer takes place is determined by the
controller mode switch and the Power-Up Mode Behavior Selection bit (S:1/12).
For this option to work, you must set (1) this bit in the control program before
downloading the program to a memory module. When this bit is set in the
memory module and power is applied, the controller downloads the memory
module program.
The mode of the controller after the transfer takes place is determined by the
controller mode switch and the Power-Up Mode Behavior Selection bit (S:1/12).
IMPORTANT If you want the controller to power-up and enter the Run mode,
regardless of any previous fault conditions, you must also set the Fault
Override bit (S:1/8) so that the Major Error Halted flag is cleared
before determining the power up mode.
The following table shows the Power-Up Mode under various conditions
MicroLogix 1400 - Mode Major Error Power-Up Mode Mode at Last Power-Down Power-Up Mode
Switch Position at Halted Behavior
Power-Up
Program False Don’t Care Don’t Care Program
True Program w/Fault
Remote False Last State REM Download, Download, REM Program, REM Program
Program or Any Test mode
REM Suspend or Suspend REM Suspend
REM Run or Run REM Run
Run Don’t Care REM Run
True Don’t Care Don’t Care REM Program w/Fault
Run False Last State REM Suspend or Suspend Suspend
Any Mode except REM Suspend or Suspend Run
Run Don’t Care Run
True Don’t Care Don’t Care Run w/Fault(1)
(1) Run w/Fault is a fault condition, just as if the controller were in the Program /w Fault mode (outputs are reset and the controller program is not being executed). However,
the controller enters Run mode as soon as the Major Error Halted flag is cleared.
The controller sets (1) this bit when a major error is encountered. The controller
enters a fault condition and word S:6 contains the Fault Code that can be used to
diagnose the condition. Any time bit S:1/13 is set, the controller:
• turns all outputs off and flashes the FAULT LED,
• or, enters the User Fault Routine allowing the control program to attempt
recovery from the fault condition. If the User Fault Routine is able to clear
S:1/13 and the fault condition, the controller continues to execute the
control program. If the fault cannot be cleared, the outputs are cleared and
the controller exits its executing mode and the FAULT LED flashes.
ATTENTION: If you clear the Major Error Halted bit (S:1/13) when
the controller mode switch is in the RUN position, the controller
immediately enters the RUN mode.
When this bit is set (1), it indicates that the programming device must have an
exact copy of the controller program.
See Allow Future Access Setting (OEM Lock) on page 32 for more information.
When the controller sets (1) this bit, it indicates that the first scan of the user
program is in progress (following entry into an executing mode). The controller
clears this bit after the first scan.
TIP The First Scan bit (S:1/15) is set during execution of the start-up
protection fault routine. Refer to S:1/9 for more information.
STI Mode
STI Pending
Address(1) Data Format Range Type User Program Access
S:2/0 binary 0 or 1 status read only
(1) This bit can only be accessed via ladder logic. It cannot be accessed via communications (such as a Message
instruction from another device).
STI Enabled
Address(1) Data Format Range Type User Program Access
S:2/1 binary 0 or 1 control read/write
(1) This bit can only be accessed via ladder logic. It cannot be accessed via communications (such as a Message
instruction from another device).
STI Executing
Address(1) Data Format Range Type User Program Access
S:2/2 binary 0 or 1 control read only
(1) This bit can only be accessed via ladder logic. It cannot be accessed via communications (such as a Message
instruction from another device).
When this bit is set (1) in the controller, its user program and the memory
module user program must match for the controller to enter an executing mode.
If the user program does not match the memory module program, or if the
memory module is not present, the controller faults with error code 0017H on
any attempt to enter an executing mode.
Set (1) this bit when you intend to use 32-bit addition and subtraction. When
S:2/14 is set, and the result of an ADD, SUB, MUL, or DIV instruction cannot
be represented in the destination address (underflow or overflow),
• the overflow bit S:0/1 is set,
• the overflow trap bit S:5/0 is set,
• and the destination address contains the unsigned truncated least
significant 16 or 32 bits of the result.
The default condition of S:2/14 is cleared (0). When S:2/14 is cleared (0), and
the result of an ADD, SUB, MUL, or DIV instruction cannot be represented in
the destination address (underflow or overflow),
• the overflow bit S:0/1 is set,
• the overflow trap bit S:5/0 is set,
• the destination address contains +32,767 (word) or +2,147,483,647 (long
word) if the result is positive; or -32,768 (word) or -2,147,483,648 (long
word) if the result is negative.
This byte value contains the number of 10 ms intervals allowed to occur during a
program cycle. The timing accuracy is from -10 ms to +0 ms. This means that a
value of 2 results in a timeout between 10 and 20 ms.
If the program scan time value equals the watchdog value, a watchdog major error
is generated (code 0022H).
This register contains a free running counter. This word is cleared (0) upon
entering an executing mode.
Bits in status word 4 can be monitored by the user program. The bits turn on and
off at a particular rate (cycle time). The On/Off times are identical, and are added
together to determine the cycle time.
S:4 Free Running Clock Comparison for SLC 500 and MicroLogix Controllers
The Free Running Clocks in the SLC 500 and MicroLogix controllers function
the same, but have different resolutions. The resolution of the Free Running
Clock depends upon which controller you are using.
• SLC 500 and MicroLogix 1000: 10 ms/bit (0.010 seconds/bit)
• MicroLogix 1100, MicroLogix 1200, MicroLogix 1400 and MicroLogix
1500: 100 μs/bit (0.0001 seconds/bit)
The following table illustrates the differences.
For example, if bit S:4/7 is monitored in an SLC 500, then that bit will be on for
1.28 seconds and off for 1.28 seconds for a total cycle time of 2.56 seconds. If bit
S:4/7 is monitored in a MicroLogix 1400, then that bit will be on for 0.0128
seconds and off for 0.0128 seconds for a total cycle time of 0.0256 seconds.
If this bit is ever set (1) upon execution of the END or TND instruction, a major
error (0020H) is generated. To avoid this type of major error from occurring,
examine the state of this bit following a math instruction (ADD, SUB, MUL,
DIV, NEG, SCL, TOD, or FRD), take appropriate action, and then clear bit S:5/
0 using an OTU instruction with S:5/0.
The LFU, LFL, FFU, FFL, BSL, BSR, SQO, SQC, and SQL instructions are
capable of generating this error. When bit S:5/2 is set (1), it indicates that the
error bit of a control word used by the instruction has been set.
If this bit is ever set upon execution of the END or TND instruction, major error
(0020H) is generated. To avoid this type of major error from occurring, examine
the state of this bit following a control register instruction, take appropriate
action, and then clear bit S:5/2 using an OTU instruction with S:5/2.
When set (1), the major error code (S:6) represents the major error that occurred
while processing the User Fault Routine due to another major error.
When this bit is set (1) by the controller, it indicates that a memory module
program has been transferred due to S:1/10 (Load Memory Module on Error or
Default Program) or S:1/11 (Load Memory Module Always) being set in an
attached memory module user program. This bit is not cleared (0) by the
controller.
Your program can examine the state of this bit on the first scan (using bit S:1/15)
on entry into an Executing mode to determine if the memory module user
program has been transferred after a power-up occurred. This information is
useful when you have an application that contains retentive data and a memory
module has bit S:1/10 or bit S:1/11 set.
At power-up, if Load Always is set, and the controller and memory module
passwords do not match, the Memory Module Password Mismatch bit is set (1).
STI Lost
Address(1) Data Format Range Type User Program Access
S:5/10 binary 0 or 1 status read/write
(1) This bit can only be accessed via ladder logic. It cannot be accessed via communications (such as a Message
instruction from another device).
This bit is set (1) whenever the discrete input filter selection in the control
program is not compatible with the hardware.
This bit is set (1) whenever an invalid string length occurs. When S:5/15 is set,
the Invalid String Length Error (1F39H) is written to the Major Error Fault
Code word (S:6).
This register displays a value which can be used to determine what caused a fault
to occur. See Identifying Controller Faults on page 525 to learn more about
troubleshooting faults.
Suspend Code
Address Data Format Range Type User Program
Access
S:7 word -32,768…+32,767 status read/write
When the controller executes an Suspend (SUS) instruction, the SUS code is
written to this location, S:7. This pinpoints the conditions in the application that
caused the Suspend mode. The controller does not clear this value.
Suspend File
Address Data Format Range Type User Program Access
S:8 word 0…255 status read/write
When the controller executes an Suspend (SUS) instruction, the SUS file is
written to this location, S:8. This pinpoints the conditions in the application that
caused the Suspend mode. The controller does not clear this value.
Math Register
Address Data Format Range Type User Program
Access
S:13 word -32,768…+32,76 status read/write
(low byte) 7
S:14 word -32,768…+32,76 status read/write
(high byte) 7
These two words are used in conjunction with the MUL, DIV, FRD, and TOD
math instructions. The math register value is assessed upon execution of the
instruction and remains valid until the next MUL, DIV, FRD, or TOD
instruction is executed in the user program.
Node Address
Address(1) Data Format Range Type User Program Access
S:15 (low byte) byte 0…255 status read only
(1) This byte can only be accessed via ladder logic. It cannot be accessed via communications (such as a
Message instruction from another device).
Baud Rate
Address(1) Data Format Range Type User Program Access
S:15 (high byte) byte 0…255 status read only
(1) This byte can only be accessed via ladder logic. It cannot be accessed via communications (such as a
Message instruction from another device).
The controller compares each scan value to the value contained in S:22. If a scan
value is larger than the previous, the larger value is stored in S:22.
This value indicates, in 100 us increments, the time elapsed in the longest
program cycle of the controller. Resolution is -100 μs to +0 μs. For example, the
value 9 indicates that 800 to 900 us was observed as the longest program cycle.
This register is used to control which subroutine executes when a User Fault is
generated.
Channel 0 Communications
Communications Active
Address(1) Data Format Range Type User Program Access
S:33/4 binary 0 or 1 status read only
(1) This bit can only be accessed via ladder logic. It cannot be accessed via communications (such as a Message
instruction from another device).
The controller changes the status of this bit at the end of each scan. It is reset
upon entry into an executing mode.
This register indicates the elapsed time for the last program cycle of the controller
(in 100 μs increments).
When clear (0), this bit indicates that at the time of the last program transfer to
the controller, protected data files in the controller were not overwritten, or there
were no protected data files in the program being downloaded.
When set (1), this bit indicates that data has been overwritten. See User Program
Transfer Requirements on page 27 for more information.
RTC Year
Address(1) Data Format Range Type User Program Access
S:37 word 1998…2097 status read only
(1) This bit can only be accessed via ladder logic. It cannot be accessed via communications (such as a Message
instruction from another device).
RTC Month
Address(1) Data Format Range Type User Program Access
S:38 word 1…12 status read only
(1) This bit can only be accessed via ladder logic. It cannot be accessed via communications (such as a
Message instruction from another device).
value will not update while viewing online in RSLogix 500/RSLogix Micro.
Monitor address in function file to see online values.
RTC Hours
Address(1) Data Format Range Type User Program Access
S:40 word 0…23 status read only
(1) This word can only be accessed via ladder logic. It cannot be accessed via communications (such as a
Message instruction from another device).
RTC Minutes
Address(1) Data Format Range Type User Program Access
S:41 word 0…59 status read only
(1) This word can only be accessed via ladder logic. It cannot be accessed via communications (such as a
Message instruction from another device).
RTC Seconds
Address(1) Data Format Range Type User Program Access
S:42 word 0…59 status read only
(1) This word can only be accessed via ladder logic. It cannot be accessed via communications (such as a
Message instruction from another device).
OS Catalog Number
Address Data Format Range Type User Program Access
S:57 word 0…32,767 status read only
This register identifies the Catalog Number for the Operating System in the
controller.
OS Series
Address Data Format Range Type User Program Access
S:58 ASCII A…Z status read only
This register identifies the Series letter for the Operating System in the controller.
OS FRN
Address Data Format Range Type User Program Access
S:59 word 0…32,767 status read only
This register identifies the FRN of the Operating System in the controller.
Processor Series
Address Data Format Range Type User Program Access
S:61 ASCII A…Z status read only
Processor Revision
Address Data Format Range Type User Program Access
S:62 word 0…32,767 status read only
This register identifies the level of functionality of the user program in the
controller.
This register identifies the Build Number of the compiler which created the
program in the controller.
This register identifies the Release of the compiler which created the program in
the controller.
Notes:
Identifying Controller Faults While a program is executing, a fault may occur within the operating system or
your program. When a fault occurs, you have various options to determine what
the fault is and how to correct it. This section describes how to clear faults and
provides a list of possible advisory messages with recommended corrective
actions.
You can automatically clear a fault by cycling power to the controller when the
Fault Override at Power-Up bit (S:1/8) is set in the status file.
You can also configure the controller to clear faults and go to RUN every time the
controller is power cycled. This is a feature that OEMs can build into their
equipment to allow end users to reset the controller. If the controller faults, it can
be reset by simply cycling power to the machine. To accomplish this, set the
following bits in the status file:
• S2:1/8 - Fault Override at Power-up
• S2:1/12 - Mode Behavior
If the fault condition still exists after cycling power, the controller re-enters the
fault mode. For more information on status bits, see System Status File on page
503.
The occurrence of recoverable or non-recoverable user faults can cause the user
fault subroutine to be executed. If the fault is recoverable, the subroutine can be
used to correct the problem and clear the fault bit S:1/13. The controller then
continues in the Run or test mode.
The subroutine does not execute for non-user faults. See User Fault Routine on
page 265 for information on creating a user fault subroutine.
Fault Messages
This section contains fault messages that can occur during operation of the
MicroLogix 1400 programmable controller. Each table lists the error code
description, the probable cause, and the recommended corrective action.
Error Codes
Error Advisory Message Description Fault Recommended Action
Code Classification
(Hex)
0001 NVRAM ERROR The default program is loaded to the Non-User • Re-download or transfer the program.
controller memory. This occurs:
• Verify battery is connected.
• if a power down occurred during
program download or transfer • Contact your local Rockwell Automation
from the memory module. representative if the error persists.
Error Codes
Error Advisory Message Description Fault Recommended Action
Code Classification
(Hex)
0006 MEMORY MODULE The memory module hardware Non-User • Upgrade the OS to be compatible with
HARDWARE FAULT faulted or the memory module is memory module.
incompatible with OS.
• Obtain a new memory module.
0007 MEMORY MODULE Failure during memory module Non-User Re-attempt the transfer. If the error persists,
TRANSFER ERROR transfer. replace the memory module.
0008 FATAL INTERNAL An unexpected software error Non-User • Cycle power on your unit. Then,
SOFTWARE ERROR occurred. re-download your program and re-initialize
any necessary data.
• Start up your system.
• Refer to proper grounding guidelines and
using surge suppressors in your controller’s
User Manual.
• Contact your local Rockwell Automation
representative if the error persists.
0009 FATAL INTERNAL An unexpected hardware error Non-User • Cycle power on your unit. Then,
HARDWARE ERROR occurred. re-download your program and re-initialize
any necessary data.
• Start up your system.
• Refer to proper grounding guidelines and
using surge suppressors in your controller’s
User Manual.
• Contact your local Rockwell Automation
representative if the error persists.
000A OS MISSING OR The operating system required for Non-User • Download a new OS using ControlFlash.
CORRUPT the user program is corrupt
or missing. • Contact your local Rockwell Automation
representative for more information about
available operating systems your controller.
000B BASE HARDWARE The base hardware faulted or is Non-User • Upgrade the OS using ControlFlash.
FAULT incompatible with the OS.
• Replace the Controller (MicroLogix 1100,
MicroLogix 1200, MicroLogix 1400).
• Replace the Base Unit (MicroLogix 1500
only).
• Contact your local Rockwell Automation
representative for more information about
available operating systems your controller.
0011 EXECUTABLE FILE 2 IS Ladder File 2 is missing from the Non-User • Re-compile and reload the program.
MISSING program.
Error Codes
Error Advisory Message Description Fault Recommended Action
Code Classification
(Hex)
0012 LADDER PROGRAM The ladder program has a memory Non-User • Reload the program or re-compile and
ERROR integrity problem. reload the program. If the error persists, be
sure to use RSI programming software to
develop and load the program.
• Refer to proper grounding guidelines and
using surge suppressors in your controller’s
User Manual.
0015 I/O CONFIGURATION The user program I/O configuration Non-User Re-compile and reload the program, and enter
FILE ERROR is invalid. the Run mode. If the error persists, be sure to
use RSI programming software to develop
and load the program.
0016 STARTUP The user fault routine was executed Recoverable • Either reset bit S:1/9 if this is consistent
PROTECTION FAULT at power-up, prior to the main ladder with the application requirements, and
program. Bit S:1/13 (Major Error change the mode back to RUN, or
Halted) was not cleared at the end of
the User Fault Routine. The User • clear S:1/13, the Major Error Halted bit,
Fault Routine ran because bit S:1/9 before the end of the User Fault Routine.
was set at power-up.
0017 NVRAM/MEMORY Bit S:2/9 is set in the controller and Non-Recoverable Transfer the memory module program to the
MODULE USER the memory module user program controller and then change to Run mode.
PROGRAM does not match the controller user
MISMATCH program.
0018 MEMORY MODULE The user program in the memory Non-User • Upgrade the OS using ControlFlash to be
USER PROGRAM module is incompatible with the OS. compatible with the memory module.
INCOMPATIBLE WITH
OS • Obtain a new memory module.
• Contact your local Rockwell Automation
representative for more information about
available operating systems your controller.
001A USER PROGRAM The user program is incompatible Non-User • Upgrade the OS using ControlFlash.
INCOMPATIBLE WITH with the OS.
OS AT POWER-UP • Contact your local Rockwell Automation
representative for more information about
available operating systems your controller.
0020 MINOR ERROR AT A minor fault bit (bits 0-7) in S:5 was Recoverable • Correct the instruction logic causing the
END-OF-SCAN set at the end of scan. error.
DETECTED
• Enter the status file display in your
programming software and clear the fault.
• Enter the Run mode.
0021 Reserved N/A N/A
0022 WATCHDOG TIMER The program scan time exceeded the Non-Recoverable • Determine if the program is caught in a
EXPIRED, SEE S:3 watchdog timeout value (S:3H). loop and correct the problem.
• Increase the watchdog timeout value in the
status file.
0023 STI ERROR An error occurred in the STI Recoverable See the Error Code in the STI Function File for
configuration. the specific error.
Error Codes
Error Advisory Message Description Fault Recommended Action
Code Classification
(Hex)
0028 INVALID OR • A fault routine number was Non-User • Either clear the fault routine file number
NONEXISTENT USER entered in the status file, number (S:29) in the status file, or
FAULT ROUTINE (S:29), but either the fault routine
VALUE • create a fault routine for the file number
was not physically created, or
reference in the status file (S:29). The file
• the fault routine number was less number must be greater than 2 and less
than 3 or greater than 255. than 256.
0029 INSTRUCTION An indirect address reference in the Recoverable Correct the program to ensure that there are
INDIRECTION ladder program is outside of the no indirect references outside data file space.
OUTSIDE OF DATA entire data file space. Re-compile, reload the program and enter the
SPACE Run mode.
002E EII ERROR An error occurred in the EII Recoverable See the Error Code in the EII Function File for
configuration. the specific error.
0030 SUBROUTINE The JSR instruction nesting level Non-User Correct the user program to reduce the
NESTING EXCEEDS exceeded the controller memory nesting levels used and to meet the
LIMIT space. restrictions for the JSR instruction. Then
reload the program and Run.
0031 UNSUPPORTED The program contains an Non-User • Modify the program so that all instructions
INSTRUCTION instruction(s) that is not supported are supported by the controller.
DETECTED by the controller.
• Re-compile and reload the program and
enter the Run mode.
0032 SQO/SQC/SQL A sequencer instruction length/ Recoverable • Correct the program to ensure that the
OUTSIDE OF DATA position parameter references length and position parameters do not
FILE SPACE outside of the entire data file space. point outside data file space.
• Re-compile, reload the program and enter
the Run mode.
0033 BSL/BSR/FFL/FFU/LFL/ The length/position parameter of a Recoverable • Correct the program to ensure that the
LFU CROSSED DATA BSL, BSR, FFL, FFU, LFL, or LFU length and position parameters do not
FILE SPACE instruction references outside of the point outside of the data space.
entire data file space.
• Re-compile, reload the program and enter
the Run mode.
0034 NEGATIVE VALUE IN A negative value was loaded to a Recoverable • If the program is moving values to the
TIMER PRESET OR timer preset or accumulator. accumulated or preset word of a timer,
ACCUMULATOR make certain these values are not negative.
• Reload the program and enter the Run
mode.
0035 ILLEGAL The program contains a Temporary Non-Recoverable • Correct the program.
INSTRUCTION IN End (TND), Refresh (REF), or Service
INTERRUPT FILE Communication instruction in an • Re-compile, reload the program and enter
interrupt subroutine (STI, EII, HSC) or the Run mode.
user fault routine.
0036 INVALID PID An invalid value is being used for a Recoverable See page 281, Process Control Instruction for
PARAMETER PID instruction parameter. more information about the PID instruction.
0037 HSC ERROR An error occurred in the HSC Recoverable See the Error Code in the HSC Function File
configuration. for the specific error.
003B PTOX ERROR An error occurred in the PTOX Recoverable or See the Error Code in the PTOX Function File
instruction configuration. Non-User for the specific error.
Error Codes
Error Advisory Message Description Fault Recommended Action
Code Classification
(Hex)
003C PWMX ERROR An error occurred in the PWMX Recoverable or See the Error Code in the PWMX Function File
instruction configuration. Non-User for the specific error.
003D INVALID SEQUENCER A sequencer instruction (SQO, SQC, Recoverable Correct the user program, then re-compile,
LENGTH/POSITION SQL) length/position parameter is reload the program and enter the Run mode.
greater than 255.
003E INVALID BIT SHIFT OR A BSR or BSL instruction length Recoverable Correct the user program or allocate more
LIFO/FIFO parameter is greater than 2048 or an data file space using the memory map, then
PARAMETER FFU, FFL, LFU, LFL instruction length reload and Run.
parameter is greater than 128 (word
file) or greater than 64 (double word
file)
003F COP/CPW/FLL A COP, CPW or FLL instruction length Recoverable • Correct the program to ensure that the
OUTSIDE OF DATA parameter references outside of the length and parameter do not point outside
FILE SPACE entire data space. of the data file space.
• Re-compile, reload the program and enter
the Run mode.
0042 INVALID RECIPE Number of Recipes specified is Recoverable • Correct the value for Number of Recipes.
NUMBER greater than 256.
• Re-compile, reload the program and enter
the Run mode.
0044 INVALID WRITE TO Write attempt to RTC function file Recoverable • Correct the invalid data.
RTC FUNCTION FILE failed. This only occurs when
attempting to write invalid data to • Re-compile, reload the program and enter
the RTC function file. Examples of the Run mode.
invalid data are: setting the Day of
Week to zero, or setting the Date to
February 30th.
0050 CONTROLLER TYPE A particular controller type was Non-User • Connect to the hardware that is specified
MISMATCH selected in the user program in the user program, or
configuration, but did not match the
actual controller type. • Reconfigure the program to match the
attached hardware.
0051 BASE TYPE A particular hardware type (AWA, Non-User • Connect to the hardware that is specified
MISMATCH BWA, BXB, AWAA, BWAA, BXBA) in the user program, or
was selected in the user program
configuration, but did no match the • Reconfigure the program to match the
actual base. attached hardware.
0052 MINIMUM SERIES The hardware minimum series Non-User • Connect to the hardware that is specified
ERROR selected in the user program in the user program, or
configuration was greater than the
series on the actual hardware. • Reconfigure the program to match the
attached hardware.
xx71(1) EXPANSION I/O The controller cannot communicate Non-Recoverable • Check connections.
HARDWARE ERROR with an expansion I/O module.
• Check for a noise problem and be sure
proper grounding practices are used.
• Replace the module.
• Cycle power.
Error Codes
Error Advisory Message Description Fault Recommended Action
Code Classification
(Hex)
xx79(1) EXPANSION I/O An expansion I/O module generated Non-Recoverable • Refer to the I/O Module Status (IOS) file.
MODULE ERROR an error.
• Consult the documentation for your specific
I/O module to determine possible causes of
a module error.
xx81(1) EXPANSION I/O The controller cannot communicate Non-User • Check connections.
HARDWARE ERROR with an expansion I/O module.
• Check for a noise problem and be sure
proper grounding practices are used.
• Replace the module.
• Cycle power.
0083 MAX I/O CABLES The maximum number of expansion Non-User • Reconfigure the expansion I/O system so
EXCEEDED I/O cables allowed was exceeded. that it has an allowable number of cables.
• Cycle power.
0084 MAX I/O POWER The maximum number of expansion Non-User • Reconfigure the expansion I/O system so
SUPPLIES EXCEEDED I/O power supplies allowed was that it has the correct number of power
exceeded. supplies.
0085 MAX I/O MODULES The maximum number of expansion Non-User • Reconfigure the expansion I/O system so
EXCEEDED I/O modules allowed was exceeded. that it has an allowable number of
modules.
• Cycle power.
xx86(1) EXPANSION I/O An expansion I/O module could not Non-User • Change the baud rate in the user program I/
MODULE BAUD RATE communicate at the baud rate O configuration, and
ERROR specified in the user program I/O
configuration. • Re-compile, reload the program and enter
the Run mode, or
• Replace the module.
• Cycle power.
xx87(1) I/O CONFIGURATION • The expansion I/O configuration in Non-User • Either correct the user program I/O
MISMATCH the user program did not match configuration to match the actual
the actual configuration, or configuration, or
• The expansion I/O configuration in • With power off, correct the actual I/O
the user program specified a configuration to match the user program
module, but one was not found, or configuration.
• The expansion I/O module
configuration data size for a
module was greater than what the
module is capable of holding.
xx88(1) EXPANSION I/O The number of input or output image Non-User • Correct the user program I/O configuration
MODULE words configured in the user to reduce the number of input or output
CONFIGURATION program exceeds the image size in words, and
ERROR the expansion I/O module.
• Re-compile, reload the program and enter
the Run mode.
Error Codes
Error Advisory Message Description Fault Recommended Action
Code Classification
(Hex)
xx89(1)(2) EXPANSION I/O An expansion I/O module generated Non-User • Refer to the I/O status file.
MODULE ERROR an error.
• Consult the documentation for your specific
I/O module to determine possible causes of
a module error.
xx8A(1)(2) EXPANSION I/O • Either an expansion I/O cable is Non-User • Correct the user program to eliminate a
CABLE configured in the user program, cable that is not present
CONFIGURATION but no cable is present, or
MISMATCH ERROR • Re-compile, reload the program and enter
• an expansion I/O cable is the Run mode, or
configured in the user program
• Add the missing cable.
and a cable is physically present,
but the types do not match. • Cycle power.
(1)(2)
xx8B EXPANSION I/O • Either an expansion I/O power Non-User • Correct the user program to eliminate a
POWER SUPPLY supply is configured in the user power supply that is not present
CONFIGURATION program, but no power supply is
MISMATCH ERROR • Re-compile, reload the program and enter
present, or
the Run mode, or
• an expansion I/O power supply is
• With power removed, add the missing
configured in the user program
power supply.
and a power supply is physically
present, but the types do not
match.
xx8C(1)(2) EXPANSION I/O An expansion I/O object (i.e. cable, Non-User • Correct the user program I/O configuration
OBJECT TYPE power supply, or module) in the user so that the object types match the actual
MISMATCH program I/O configuration is not the configuration, and
same object type as is physically
present. • Re-compile, reload the program and enter
the Run mode. Or
• Correct the actual configuration to match
the user program I/O configuration.
• Cycle power.
0x1F39 INVALID STRING The first word of string data contains Recoverable Check the first word of the string data
LENGTH a negative, zero, or value greater element for invalid values and correct the
than 82. data.
(1) xx indicates module number. If xx = 0, problem cannot be traced to a specific module.
(2) The xx in this error code means that the error occurs at the location of the last properly configured Expansion I/O module +1. You should use this information in conjunction
with the specific error code to determine the source of the problem.
Contacting Rockwell If you need to contact Rockwell Automation or local distributor for assistance, it
is helpful to obtain the following information ready:
Automation for Assistance
• controller type, series letter, and revision letter of the base unit
• series letter, revision letter, and firmware (FRN) number of the processor
(on bottom side of processor unit)
TIP You can also check the FRN by looking at word S:59 (Operating
System FRN) in the Status File.
Rockwell Automation phone numbers are listed on the back cover of this manual.
Notes:
Protocol Configuration
See your controller’s User Manual, 1766-UM001 for information about required
network devices and accessories.
DH-485 Communication The information in this section describes the DH-485 network functions,
network architecture, and performance characteristics. It also helps you plan and
Protocol operate the controller on a DH-485 network.
The DH-485 protocol defines the communication between multiple devices that
coexist on a single pair of wires. DH-485 protocol uses RS-485 Half-Duplex as its
physical interface. (RS-485 is a definition of electrical characteristics; it is not a
protocol.) RS-485 uses devices that are capable of co-existing on a common data
circuit, thus allowing data to be easily shared between devices.
The DH-485 protocol supports two classes of devices: initiators and responders.
All initiators on the network get a chance to initiate message transfers. To
determine which initiator has the right to transmit, a token passing algorithm is
used.
The following section describes the protocol used to control message transfers on
the DH-485 network.
A node holding the token can send a message onto the network. Each node is
allowed a fixed number of transmissions (based on the Token Hold Factor) each
time it receives the token. After a node sends a message, it passes the token to the
next device.
The allowable range of node addresses is 0…31. There must be at least one
initiator on the network (such as a MicroLogix controller, or an SLC 5/02 or
higher processor).
The major software issues you need to resolve before installing a network are
discussed in the following sections.
Software Considerations
Number of Nodes
The number of nodes on the network directly affects the data transfer time
between nodes. Unnecessary nodes (such as a second programming terminal that
is not being used) slow the data transfer rate. The maximum number of nodes on
the network is 32.
The best network performance occurs when node addresses are assigned in
sequential order. Initiators, such as personal computers, should be assigned the
lowest numbered addresses to minimize the time required to initialize the
network. The valid range for the MicroLogix controllers is 1…31 (controllers
cannot be node 0). The default setting is 1. The node address is stored in the
controller Communications Status file (CS0:5/0…CS0:5/7). Configure the node
address via Channel Configuration using RSLogix 500/RSLogix Micro. Select
the Channel 0 tab.
The best network performance occurs at the highest baud rate, which is 19200.
This is the default baud rate for a MicroLogix devices on the DH-485 network.
All devices must be at the same baud rate. This rate is stored in the controller
Communications Status file (CS0:5/8…CS0:5/15). Configure the baud rate via
Channel Configuration using RSLogix 500/RSLogix Micro. Select the Channel 0
tab.
Once you have an established network set up, and are confident that you will not
be adding more devices, you may enhance performance by adjusting the
maximum node address of your controllers. It should be set to the highest node
address being used.
IMPORTANT All devices should be set to the same maximum node address.
These controllers can respond and initiate with device’s communications (or
commands) that do not originate on the local DH-485 network. This is useful in
installations where communication is needed between the DH-485 and DH+
networks.
DF1 Full-Duplex Protocol DF1 Full-Duplex protocol provides a point-to-point connection between two
devices. DF1 Full-Duplex protocol combines data transparency (American
National Standards Institute ANSI - X3.28-1976 specification subcategory D1)
and 2-way simultaneous transmission with embedded responses (subcategory
F1).
The MicroLogix controllers support the DF1 Full-Duplex protocol via RS-232
connection to external devices, such as computers, or other controllers that
support DF1 Full-Duplex.
DF1 is an open protocol. Refer to DF1 Protocol and Command Set Reference
Manual, Allen-Bradley publication 1770-6.5.16, for more information.
When the system driver is DF1 Full-Duplex, the following parameters can be
changed:
DF1 Half-Duplex Protocol DF1 Half-Duplex protocol provides a multi-drop single master/multiple slave
network. In contrast to the DF1 Full-Duplex protocol, communication takes
place in one direction at a time. You can use the RS-232 port on the MicroLogix
controller as both a Half-Duplex programming port, and a Half-Duplex
peer-to-peer messaging port.
DF1 Half-Duplex supports up to 255 devices (addresses 0…254, with address 255
reserved for master broadcasts). Note: When configuring a message instruction, set
the target node address to -1 for broadcast messages.
between the master and all the slave stations, or for systems where slave
station-initiated messages are going to be used.
With Message-Based polling mode, the only time a master station communicates
with a slave station is when a message (MSG) instruction in ladder logic is
triggered to that particular slave station’s address. This polling mode gives the user
complete control (through ladder logic) over when and how often to
communicate with each slave station.
If the Message-based selection is “don’t allow slaves to initiate messages,” then even
if a slave station triggers and queues up a MSG instruction in its ladder logic, the
master station will not process it.
Standard polling mode is strongly recommended for larger systems that require
time critical communication between the master and all the slave stations, or for
any system where slave station-initiated messages are going to be used (this
includes slave programming over the network, since this uses the same
mechanism that slave-to-slave messaging uses). The Active Node Table
“automatically” keeps track of which slaves are (and are not) communicating.
Standard polling mode should not be used in cases where the user needs to be able
to limit when and how often the master station communicates with each slave
station.
Standard polling mode causes the master station to continuously send one or
more 4-byte poll packets to each slave station address configured by the user in
the poll list(s) in round robin fashion – as soon as the end of the polling list is
reached, the master station immediately goes back and starts polling slave stations
from the top of the polling list over again. This is independent and asynchronous
to any MSG instructions that might be triggered in the master station ladder
logic. In fact, this polling continues even while the master station is in program
mode!
When a MSG instruction is triggered while the master station is in run mode, the
master station will transmit the message packet just after it finishes polling the
current slave station in the poll list and before it starts polling the next slave
station in the poll list (no matter where it currently is in the poll list). If multiple
MSG instructions have been triggered “simultaneously,” at least four message
packets may be sent out between two slave station polls. Each of these messages
will have an opportunity to complete when the master polls the slave station that
was addressed in the message packet as it comes to it in the poll list.
When a slave station receives a poll packet from the master station, if it has one or
more message packets queued up to transmit (either replies to a command
received earlier or MSG commands triggered locally in ladder logic), the slave
station will transmit the first message packet in the transmit queue.
If the standard mode selection is “single message per poll scan,” then the master
station will then go to the next station in the poll list. If the standard mode
selection is “multiple messages per poll scan,” the master station will continue to
poll this slave station until its transmit queue is empty.
The master station “knows” the slave station has no message packets queued up to
transmit when the slave station responds to the master poll packet with a 2-byte
poll response.
Every time a slave station responds or fails to respond to its poll packet, the master
station “automatically” updates its Active Node Table (again, even if it’s in
program mode). In this list, one bit is assigned to each possible slave station
address (0…254). If a slave station does not respond when it is polled, its Active
Node Table bit is cleared. If it does respond when it is polled, its Active Node
Table bit is set. Besides being an excellent online troubleshooting tool, two
common uses of the Active Node Table are to report good/bad communication
status for all slave stations to an operator interface connected to the master station
for monitoring, alarming and logging purposes, and to precondition MSG
instructions to each particular slave.
This second use is based on the supposition that if a slave station did not respond
the last time it was polled, it may not be able to receive and respond to a MSG
instruction now, and so it would most likely process the maximum number of
retries and time-outs before completing in error. This slows down both the poll
scan and any other messaging going on. Using this technique, the minimum time
to message to every responding slave station actually decreases as the number of
slave stations that can’t respond increases.
IMPORTANT In order to remotely monitor and program the slave stations over the
half-duplex network while the master station is configured for
Standard polling mode, the programming computer DF1 slave driver
(typically Rockwell Software RSLinx) station address must be included
in the master station poll list.
Polled report-by-exception lets a slave station initiate data transfer to its master
station, freeing the master station from having to constantly read blocks of data
from each slave station to determine if any slave input or data changes have
occurred. Instead, through user programming, the slave station monitors its own
inputs for a change of state or data, which triggers a block of data to be written to
the master station when the master station polls the slave.
If one slave station has a message to send to another, it simply includes the
destination slave station’s address in the message instruction’s destination field in
place of the master station’s address when responding to a poll. The master station
checks the destination station address in every packet header it receives from any
slave station. If the address does not match the slave’s own station address, the
entire message is forwarded back onto the telemetry network to the appropriate
slave station, without any further processing.
Addressing Tips
Each station on the network, including the master station, must have a unique
address. The address range is 0…254, so you can have a maximum of 255 stations
on a single telemetry network. Station address 255 is the broadcast address, which
you cannot select as a station’s individual address.
With standard polling mode, the master device initiates all communication by
polling each slave address configured in the priority and normal polling ranges.
The slave device may only transmit message packets when it is polled by the
master. Based on a slave’s inclusion in the priority and/or normal poll ranges, the
master polls each slave on a regular and sequential basis to allow slave devices an
opportunity to communicate. During a polling sequence, the master polls a slave
either repeatedly until the slave indicates that it has no more message packets to
transmit (“standard polling mode, multiple messages per scan”) or just one time
per polling sequence (“standard polling mode, single message per scan”),
depending on how the master is configured.
The polling algorithm polls all of the priority slave addresses each poll scan
(priority low to priority high) and a subset of the normal slave address range. The
number of normal slave addresses to poll each poll scan is determined by the
Normal Poll Group Size configuration parameter. In order to poll all of the slave
addresses each poll scan with equal priority, you may define the entire slave
address range in either the Priority Poll Range or the Normal Poll Range, and
leave the other range disabled. The Polling Range is disabled by defining the low
address as 255.
When the system driver is DF1 Half-Duplex Master, the following parameters
can be changed:
To see which slave stations are active when the channel is configured for Standard
Polling Mode (either single or multiple message per scan), view the DF1
Half-Duplex Master Active Node Table. The table is stored in the
Communications Status Function File, words CSx:27…CSx:42, where x is the
channel number (x = 0 for MicroLogix 1400). Each bit in the table represents a
station on the link, from 0…254, starting with CSx:27/0 for address 0 and
CSx:42/14 for address 254. The bit for address 255 (CSx:42/15) is never set,
since it is the broadcast address, which never gets polled.
TIP The bit corresponding to the address configured for the DF1
Master is always cleared because the master address never gets
polled.
If you are using RSLogix 500/RSLogix Micro version 7.00.00 or higher, you can
view the active node table by clicking on “Processor Status” and then selecting the
tab for the DF1 Master channel.
At power-up or after reconfiguration, the master station assumes that all slave
stations are inactive. A station is shown active only after it responds to a poll
packet.
DF1 Radio Modem Protocol This driver implements a protocol, optimized for use with radio modem
networks, that is a hybrid between DF1 Full-Duplex and DF1 Half-Duplex
protocols and is not compatible with either protocol.
The primary advantage of using DF1 Radio Modem protocol for radio modem
networks is in transmission efficiency. Each read/write transaction (command
and reply) requires only one transmission by the initiator (to send the command)
and one transmission by the responder (to return the reply). This minimizes the
number of times the radios need to “key-up” to transmit, which maximizes radio
life and minimizes radio power consumption. It also maximizes communication
throughput. In contrast, DF1 Half-Duplex protocol requires five transmissions
for the DF1 Master to complete a read/write transaction with a DF1 Slave –
three by the master and two by the slave.
IMPORTANT The DF1 Radio Modem driver should only be used among devices that
support and are configured for the DF1 Radio Modem protocol. DF1
Radio Modem protocol is currently supported by SLC 5/03, 5/04 and 5/
05 controllers; MicroLogix 1400, 1200 and 1500 controllers; and Logix
controllers at Version 16.1 firmware or higher.
Like DF1 Full-Duplex protocol, DF1 Radio Modem allows any node to initiate
to any other node at any time (if the radio modem network supports full-duplex
data port buffering and radio transmission collision avoidance). Like DF1
Half-Duplex protocol, up to 255 devices are supported, with unique addresses
from 0…254. A node ignores any packets received that have a destination address
other than its own, with the exception of broadcast packets. A broadcast write
command initiated by any DF1 radio modem node is executed by all of the other
DF1 radio modem nodes that receive it. No acknowledgement or reply is
returned.
Using RSLogix 500/RSLogix Micro version 7.00.00 or higher, the DF1 Radio
Modem driver can be configured as the system mode driver for Channel 0 in
MicroLogix 1400.
When the system driver is DF1 Radio Modem, the following parameters can be
changed for Channel 0.
The DF1 Radio Modem driver can be used in a “pseudo” Master/Slave mode
with any radio modems, as long as the designated “Master” node is the only node
initiating MSG instructions, and as long as only one MSG instruction is triggered
at a time.
For modern serial radio modems that support full-duplex data port buffering and
radio transmission collision avoidance, the DF1 Radio Modem driver can be used
to set up a “Masterless” peer-to-peer radio network, where any node can initiate
communications to any other node at any time, as long as all of the nodes are
within radio range so that they receive each other’s transmissions.
DF1 Radio Modem also supports Store and Forward capability in order to
forward packets between nodes that are outside of radio range of each other. Each
node that is enabled for Store and Forward has a user-configured Store and
Forward Table to indicate which received packets it should re-broadcast, based on
the packet’s source and destination addresses.
The Store and Forward Table can be configured to use any valid binary data table
file (B3, B9…B255) of length 16 words. Each bit in the file corresponds to a DF1
Radio Modem node address. In order to configure a MicroLogix to Store and
Forward message packets between two other nodes, the bits corresponding to the
addresses of those two other nodes must be set. For instance, if node 2 is used to
Store and Forward message packets between nodes 1 and 3, then both bits Bx/1
and Bx/3 (where x is the configured data table file number) would have to be set
in the Store and Forward Table file (see Figure 7). You can set bit 255 to enable
Store and Forward of broadcast packets, as well.
IMPORTANT Once Store and Forward is enabled, duplicate packet detection is also
automatically enabled. Whenever Store and Forward is used within a
radio modem network, every node should have a Store and Forward
Table file configured, even if all of the bits in the file are cleared, so
that duplicate packets will be ignored.
Note 1 – The link layer of Node 1 blocks the re-transmission of a packet that is received with the SRC byte equal to the
receiving node’s station address. Packets received that originate from the receiving node should never be re-transmitted.
Note 2 – To prevent Node 2 from re-transmitting a duplicate packet, the link layer of Node 2 updates the duplicate packet
table with the last 20 packets received.
Note 3 – The link layer of Node 4 blocks the re-transmission of a packet that is received with the SRC byte equal to the
receiving node’s station address. Packets received that originate from the receiving node should never be re-transmitted.
Note 4 – To prevent Node 3 from re-transmitting a duplicate packet, the link layer of Node 3 updates the duplicate packet
table with the last 20 packets received.
If you are using RSLogix 500/RSLogix Micro version 7.00.00 or higher, you can
view the store and forward table by clicking on “Processor Status” and then
selecting the tab for the DF1 Master channel.
SLC 5/03, 5/04 or 5/05 processors must all be at FRN C/6 or higher in
order to be configured with the DF1 Radio Modem driver using RSLogix
500/RSLogix Micro version 5.50 or higher.
Starting with Version 16.1, all Logix controllers can be configured for DF1
Radio Modem protocol.
2. Does each node receive the radio transmissions of every other node, being
both within radio transmission/reception range and on a common
receiving frequency (either via a “Simplex” radio mode or via a single,
common, full-duplex repeater)?
If so, then go to question #3 to see if you can use the DF1 Radio Modem
driver to set up a peer-to-peer radio network. If not, then you may still be
able to use the DF1 Radio Modem driver, by configuring intermediary
nodes as Store and Forward nodes.
3. Do the radio modems handle full-duplex data port buffering and radio
transmission collision avoidance?
If so, and the answer to #2 is yes as well, then you can take full advantage of
the peer-to-peer message initiation capability in every node (i.e., the ladder
logic in any node can trigger a MSG instruction to any other node at any
time). If not, then you may still be able to use the DF1 Radio Modem
driver, but only if you limit MSG instruction initiation to a single “master”
node whose transmission can be received by every other node.
4. Can I take advantage of the SLC 5/03, 5/04 and 5/05 channel-to-channel
passthru to remotely program the other SLC and MicroLogix nodes using
RSLinx and RSLogix 500/RSLogix Micro running on a PC connected to
a local SLC processor via DH+ or Ethernet?
Yes, with certain limitations imposed based on the radio modem network.
Refer to the SLC 500 Instruction Set Reference Manual, publication
1747-RM001, for more passthru details and limitations when using the
DF1 Radio Modem driver.
Modbus RTU Protocol This section shows the configuration parameters for Modbus RTU (Remote
Terminal Unit transmission mode) protocol. For more information about the
Modbus RTU protocol, see the Modbus Protocol Specification (available from
http://www.modbus.org).
The driver can be configured as Modbus RTU Master or Modbus RTU Slave.
The Modbus RTU Slave driver maps the four Modbus data types—coils,
contacts, input registers, and holding registers—into four binary and/or integer
data table files created by the user.
Message instructions are used to transfer information between the data files in the
Modbus RTU Master and the Modbus RTU Slaves. Refer to Chapter 22 for
detailed information about configuring a MSG instruction for Modbus
Communications.
Modbus addressing is limited to 16 bits per memory group, each with a range of
1…65,536. There are four memory groups, one for each function:
• coils (generally addressed as 0xxxx)
• contacts (1xxxx)
• input registers (3xxxx)
• holding registers (4xxxx)
Coils and contacts are addressed at the bit level. Coils are like outputs and can be
read and written to. Contacts are like inputs and are read-only. Input registers and
holding registers are addressed at the word level. Input registers are generally used
for internally storing input values. They are read-only. Holding registers are
general purpose and can be both read and written to.
The most significant digit of the address is considered a prefix, and does not get
entered into the Modbus Data Address field when configuring the message
instruction.
When the message is sent, the address is decremented by 1 and converted into a
4-character hex number to be transmitted via the network (with a range of
0-FFFFh); the slave increments the address by 1, and selects the appropriate
memory group based on the Modbus function.
TIP Modbus protocol may not be consistently implemented in the field. The
Modbus specification calls for the addressing range to start at 1;
however, some devices start addressing at 0.
The Modbus Data Address in the Message Setup Screen may need to be
incremented by one to properly access a Modbus slave’s memory,
depending on that slave’s implementation of memory addressing.
TIP A request to access a group of holding registers that span across two
files is permitted. Note that the maximum number of registers in a
command does not allow for more than two files to be accessed
during a single Modbus command.
Select the Modbus RTU Master from the Channel Configuration menu as
shown below.
When the system driver is Modbus RTU Master, the following communication
port parameters can be changed:
1. To set up Channel 0 and data files for Modbus communication, select the
Channel 0 Configuration tab.
2. Choose “Modbus RTU Slave” driver and assign driver characteristics.
3. Enter Modbus Data Table File Numbers. Select the Expansion check box
to utilize multiple holding register data files.
TIP The controller default is one data file of 256 registers. The
Expansion check box enables an additional five files and
1280 holding registers.
The five additional tables do not need to be individually
defined, but sequentially follow the first integer or bit file.
For example, if the first file is N10 (or B10), then the
additional five files will be N11 (or B11), N12 (or B12), N13
(or B13), N14 (or B14), and N15 (or B15).
4. Enter the data table size and type for each required file. The data table
file(s) (not including the five additional tables if Expanded is checked) will
be created automatically.
When the system driver is Modbus RTU Slave, the following communication
port parameters can be changed:
Modbus Commands
The controller configured for Modbus RTU Slave responds to the Modbus
command function codes listed in below:
(2) If Modbus Command is sent with a valid Broadcast address, then no exception reply will be sent for Error Codes 2…11.
The following table lists the possible error codes and error descriptions for the
Modbus RTU Master MSG Instruction.
Modbus Error Codes in Modbus RTU Master MSG Instruction
Error Error Description Received Exception
Code Code
81 Illegal Function The function code sent by the Master is not supported by the slave or has 1
an incorrect parameter.
82 Illegal Data Address The data address referenced in the Master command does not exist in the 2
slave, or access to that address is not allowed.
83 Illegal Data Value The data value being written is not allowed, either because it is out of 3
range, or it is being written to a read-only address.
84 Slave Device Failure An unrecoverable error occurred while the slave was attempting to 4
perform the requested action.
85 Acknowledge The slave has accepted the request, but a long duration of time will be 5
required to process the request.
86 Slave Device Busy The slave is currently processing a long-duration command. 6
ASCII Driver The ASCII driver provides connection to other ASCII devices, such as bar code
readers, weigh scales, serial printers, and other intelligent devices.
You can use ASCII by configuring the RS-232 port, channel 0 for ASCII driver.
When configured for ASCII, all received data is placed in a buffer. To access the
data, use the ASCII instructions in your ladder program. See ASCII Instructions
on page 309 for information on using the ASCII instructions. You can also send
ASCII string data to most attached devices that accept ASCII data/characters.
When the driver is set to ASCII, the following parameters can be changed:
Ethernet Driver The MicroLogix1400 supports Ethernet communication via the Ethernet
communication channel 1. Ethernet is a local area network that provides
communication between a variety of network devices at 10/100 Mbps.
There are two ways to configure the MicroLogix1400 Ethernet channel 1. The
configuration can be done via a BOOTP or DHCP request at processor power
up, or by manually setting the configuration parameters using RSLogix 500/
RSLogix Micro Programming Software (refer to Example 5 - Configuring an
Ethernet/IP Message on page 420).
Ethernet Configuration Parameters
Parameter Options Programming
Software Default
Driver Ethernet Ethernet
Hardware The processor's Ethernet hardware address. This value cannot be changed. Ethernet Hardware
Address Address
IP Address 1…254 (zero and 255 are reserved for broadcast purposes.) 0.0.0.0
The processor's internet address. You must specify the IP address to enable the processor to connect to the TCP/
IP network. You can specify the address manually, or enable BOOTP or DHCP (located in the Protocol Control
section of this dialog) to provide the address.
Subnet Mask 0…255 in each field. 0.0.0.0
Used by the processor to interpret IP addresses when the Internet is divided into subnets. The subnet mask must
be specified. You can do this either manually or by enabling BOOTP or DHCP.
The processor compares and screens addresses using the mask to identify its own address to see if it should
listen to corresponding messages. The comparison occurs in binary. Any address position for which the mask is
set to a binary 1 will be compared; any address position for which the mask is set to a binary 0 will be ignored.
For example, if the mask is 255.255.255.0 the processor will listen to all addresses whose first three segments
match its own address regardless of the value in the last segment. (255 in decimal equals to 1111 1111 in
binary.)
Gateway 1…254 in each field. 0.0.0.0
Address The IP address of the gateway that provides a connection to another IP network. This field is required when you
communicate with other network devices, not on a local subnet.
Default The default domain name can have the following formats: NULL
Domain Name ’a.b.c’, ’a.b’ or ’a’, where a, b, c must start with a letter, end with a letter or digit, and have as interior characters
only letters, digits or hyphens. Maximum length is 63 characters.
Primary Name This is the IP address of the computer acting as the local Ethernet network Primary Domain Name System (DNS) 0.0.0.0
Server server.
Secondary This is the IP address of the computer acting as the local Ethernet network Secondary Domain Name System 0.0.0.0
Name Server (DNS) server.
Network Link 0…199. 0
ID The Link ID assigned to the MicroLogix 1400 either by an RSLinx OPC topic or by the routing table in a
1756-DHRIO or 1756-DH485 module.
Note: If BOOTP is enabled, you must have the BOOTP server running at all times because the processor requests
its address to the BOOTP server at any time during its power up.
DHCP Enable enabled, disabled. 0 (disabled)
DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses to client stations logging onto a
TCP/IP network. There is no need to manually assign permanent IP parameters. DHCP is only available when
BOOTP is disabled.
SNMP Server enabled, disabled. 1 (enabled)
Enable Check this box to enable SNMP (Simple Network Management Protocol). Disable SNMP to guarantee better
security since it prevents anyone from obtaining information about the processor or network using SNMP.
Any change to this function does not take effect until the system is restarted.
This function can be changed through online modification of the channel configuration or through offline
modification followed by downloading it to the processor. Once changed, the function will be operational in the
processor after the system is restarted.
SMTP Client The SMTP Client service enable switch. When SMTP is enabled, MicroLogix 1400 is capable of transmitting 0 (disabled)
Enable e-mail messages generated by a 485CIF write message with a string element. There must be a SMTP server on
the network capable of processing e-mail service. This provides an extremely versatile mechanism to report
alarms, status, and other data-related functions.
HTTP Server enabled, disabled. 1 (enabled)
Enable Check this box to enable HTTP (Hyper-Text Transfer Protocol). Disable HTTP to guarantee better security since it
prevents access to the processor using a web browser. Note that disabling HTTP will prevent you from viewing
the extended diagnostics available through a web browser.
Any change to this function does not take effect until the system is restarted.
This function can be changed through online modification of the channel configuration or through offline
modification followed by downloading it to the processor. Once changed, the function will be operational in the
processor after the system is restarted.
Auto enabled, disabled. 1 (enabled)
Negotiate Check this box to enable Auto Negotiation. Auto Negotiation allows the processor to negotiate with switches,
routers, and modems for optimal performance. When Auto Negotiation is enabled, the port speed selections will
list the available options. When two settings are shown for port speed, Auto Negotiation will choose the
optimal setting. When one setting is shown, that setting will be used if possible. If the attached device does not
support 100 Mbps full duplex, then the default setting will be 10 Mbps half duplex.
DNP3 over IP enabled, disabled. 0 (disabled)
Enable Check this box to enable DNP3 over IP subsystem.
Any change to this function does not take effect until the system is restarted.This function can be changed
through online modification of the channel configuration or through offline modification followed by
downloading it to the processor. Once changed, the function will be operational in the processor after the
system is restarted.
You cannot enable both DNP3 over IP and Modbus TCP. This field is only available for MicroLogix 1400 OS Series
B controllers
Modbus TCP enabled, disabled. 0 (disabled)
Enable Check this function to enable Modbus TCP client and server subsyste. Any change to this function does not take
effect until the system is restarted. This function can be changed through online modification of the channel
configuration or through offline modification followed by downloading it to the processor. Once changed, the
function will be operational in the processor after the system is restarted.
You cannot enable both DNP3 over IP and Modbus TCP. This field is only available for MicroLogix 1400 OS Series
B controllers
# 17444 Pulse Train Output The PTOX and PWMX functions are only available when using the BXB or
BXBA models of the MicroLogix 1400.
(PTOX) Quick Start
Locate the Function Files under Controller in RSLogix 500/RSLogix Micro
v8.10.00 or later and select the PTOX tab, then click the [+] sign next to
PTOX:0. See screencap below.
Example
By toggling Bit B3/0 the PTOX can be activated. On execution, the PTOX
instruction generates the number of pulses entered into the PTOX:0.TOP long
word and then stop. To restart, toggle B3/0.
Once the EH bit is set the instruction will generate a PTOX error of 1 (hard stop
detected). In order to clear this error the PTOX instruction must be scanned on a
false rung of logic, and the EH bit must be off.
To change the Total Output Pulses Generated in a working program a new value
can be moved into PTOX:0.TOP by using the MOV command.
IMPORTANT Once the PTOX has been initiated and is generating pulses a new TOP
value will not take effect until the PTOX has either completed generating
pulses and has been restarted or has been Hard Stopped using PTOX:0/
EH bit and been restarted.
Example
The following ladder logic will need to be entered into file #2.
Each main high-speed counter has four dedicated inputs and each sub high-speed
counter has two dedicated inputs.
HSC0 utilizes inputs 0…3, HSC1 utilizes inputs 4…7, HSC2 utilizes inputs
8…11, HSC3 utilizes inputs 2 and 3, HSC4 utilizes inputs 6 and 7 and HSC5
utilizes inputs 10 and 11.
Getting Started
Locate the Function Files under Controller in RSLogix 500/RSLogix Micro and
select the HSC tab, then select the [+] sign next to HSC:0 as shown below.
Enter the following parameters for the “Minimum Configuration” required for
the HSC to count pulses.
IMPORTANT There is no additional ladder logic required to enable the High Speed
Counter. In other words there is no HSC instruction needed for the ladder
logic program.
HSC:0.PFN Program File Number defines which subroutine is executed when the HSC:0 accumulated count equals
the High or Low preset or passes through Overflow or Underflow. The Integer number entered must be
a valid sub-routine program file (3…255).
HSC:0/AS Auto-Start defines if the HSC function will automatically start when the MicroLogix controller enters
run or test.
HSC:0/CE Counting Enabled control bit is used to enable or disable the HSC.
HSC:0.HIP High Preset is the upper set point (in counts) that defines when the HSC will generate an interrupt and
execute the PFN sub-routine.
Example
The following example uses the HSC in Mode 0 - “Up Counter”. The “Up
Counter” clears the accumulated value (0) when it reaches the High Preset
(HIP). This mode configures I1:0.0/0 (I:0/0) as the HSC:0 input.
IMPORTANT Each mode for the HSC will configure the inputs for different
functionality.
In this example, the HSC will count input pulses coming into I:0/0, when the
total number of pulses counted equals the High Preset (HIP) the HSC will jump
to subroutine file #3.
The HIP is set for 5000 pulses in this example. Also, once the HIP is reached the
HSC will then reset HSC:0.ACC to zero (0) and start counting again.
IMPORTANT It is assumed that the user has connected a device to I:0/0 to generate
pulses.
IMPORTANT The following ladder logic does not need to be entered into File #2,
however this allows for easy viewing of the accumulated counts from
the HSC:0.ACC.
IMPORTANT Ladder Logic Subroutine file #3 must be created in order for this example
to work. If the subroutine is not created the CPU will fault due to an HSC
Error Code 1 - Invalid File Number for PFN has been entered.
Troubleshooting Problem #1: The input display on the MicroLogix LCD screen turns on and off,
but no counts are seen in the HSC accumulator.
Solution: The input filter frequency may need to be adjusted in order to capture
the input pulses.
Problem #2: The HSC instruction does not accumulate counts and the Error
Code (ER) shows a value of (1).
Solution: A file number was entered into (PFN) but the value entered was less
than (3) or greater then (255) or the file number entered was correct, however the
file does not exist.
Problem #3: Some of my outputs does not turn On or Off when the ladder logic
appears to indicate that they should.
Solution: OMB (Output Mask Bits) - Verify what the OMB has been
configured for in the HSC function file. If an output has been assigned to the
HSC for control, then the output will not be controlled anywhere else in the
ladder program. Only the HSC will have control over these outputs.
The Outgoing queue also supports unlimited queuing. This means that even if a
buffer is not available the MSG will simply wait until one of the outgoing buffers
becomes available and then transmit.
IMPORTANT If a message has been waiting in the queue, at the moment of buffer
availability, the most current data will be sent, not the data that was
available at the time the message instruction was first scanned true.
The MSG instruction in the MicroLogix 1400 controller uses a Data File MG to
process the message instruction. All message elements are accessed using the MG
prefix (example: MSG done bit = MG11:0/DN).
The following example illustrates how, by using the MSG Done (DN) and Error
(ER) bits to unlatch the Enable (EN) bit the MSG instruction can be configured
for continuous execution.
This example uses MG11:0 for the MSG file and will require two MicroLogix
controllers one a ML1400 and the other either a ML1000 or ML1400. The
ML1400 will need to be configured as Node 1 and the other processor as node 4.
The processor at node 1 will contain the ladder logic below and transfer data
from it's N7:0 Integer file to the processor at node 4's N7:0 Integer file. Since
N7:0 is the source file for this example, data must be entered into this register for
node 1. For this example Locate N7:0 in the ML1400 (Node 1) and enter the
value 63.
MicroLogix 1000
TERM
Node 4
MicroLogix 1400
COM
SHLD
CHS GND
TX TX
TX PWR
DC SOURCE
CABLE
Node 1
EXTERNAL
IMPORTANT After the ladder logic has been entered into the MicroLogix 1400 and the
MicroLogix 1000 channel configuration has been changed, leave it
connected until the COMM 0 LED on the MicroLogix 1400 starts to blink.
This ensures proper connection to the controllers using a 1761-CBL-PM02
cable
To verify the data has been sent to node 4, disconnect the PM02 cable and
connect the PC running RSLogix 500/RSLogix Micro to the ML1000 (Node
4). Go to N7:0 and view the data, this should match the data in N7:0 of node 1.
Another way to verify the data has been sent to node 4 is to replace the Target
Device Data Table Address with an output modules address. In this example, the
output module is a MicroLogix 1000, the address is O:0.0 This displays on the
output LEDs, whatever number (in binary format) was entered into N7:0 of the
ML1400.
The above example uses the DF1 Full Duplex protocol. This is a point-to-point
or One Device to One Device protocol, using this protocol no other devices can
be connected. To create a network of multiple processors or devices use the
DH485 protocol and 1761-NET-AIC devices.
IMPORTANT This example was written using a MicroLogix 1400 communicating with
a MicroLogix 1000. However any DF1 or DH485 device may substitute
MicroLogix 1000 (such as MicroLogix 1200, MicroLogix1500, SLC 5/03,
5/04, 5/05, PLC-5, Bar Code Scanners, and so on).
Example of application: A block of logic that needs to be scanned more often than
the rest of the ladder program.
Getting Started
Enter the following parameters as the Minimum Configuration required for the
STI.
STI:0.PFN Program File Number defines which subroutine is
executed when the SPM value has timed out. The Integer
number entered must be a valid sub-routine program file
(3…255).
STI:0/AS Auto-start defines if the STI function will automatically
start when the MicroLogix 1400 enters run or test.
STI:0/UIE User Interrupt Enabled control bit is used to enable or
disable the STI subroutine from processing.
STI:0.SPM Setpoint (in milliseconds) defines the interval that the
interrupt will scan the PFN sub-routine.
Example
This example also sets the User Interrupt Enable bit and the Auto Start bit
allowing the STI to execute.
IMPORTANT Ladder Logic Subroutine file #3 must be created in order for this example
to work. If the subroutine is not created the CPU will fault due to a STI
Error Code 1 - Invalid File Number for PFN has been entered.
If the Auto Start bit (AS) is set, this starts the interrupt upon power up and sets
the Timed Interrupt Enabled bit (TIE) automatically, allowing the interrupt to
execute as shown in the above example.
If the AS bit is not set, then the TIE bit must be set through the ladder logic in
order for the interrupt to execute.
The User Interrupt Enable bit (UIE) determines if the interrupt executes or not.
Getting Started
Values can be entered for the Year, Month, Day, Hour, Minute, and Seconds
offline, once downloaded, the values will take effect immediately.
# 17558 User Interrupt The UID instruction can be used as an output instruction to disable selected user
interrupts.
Disable (UID) Quick Start
Once a user interrupt is disabled, the User Interrupt Enable bit (UIE) for the
selected interrupt is cleared or resets to zero (0). This stops the interrupt from
executing.
To re-enable an interrupt, the UIE bit must be set to a one (1), or a UIE
instruction must be used.
The following table indicates the types of interrupts disabled by the UID.
The setting of the Auto Start bit (AS) starts the interrupt on power up and sets
the Timed Interrupt Enabled bit (TIE) automatically, allowing the interrupt to
execute.
If the AS bit is not set then the TIE bit must be set through the ladder logic in
order for the interrupt to execute.
The User Interrupt Enable bit (UIE) determines if the interrupt executes or not.
# 18465 RTC The following example illustrates a message write from an SLC 5/03 or higher
processor to a Micrologix 1400 processor with RTC enabled.
Synchronization
Between Controllers This example can also be applied for messaging between MicroLogix 1100, 1200,
Quick Start 1400, and 1500 controllers. When messaging from a MicroLogix 1100/1200/
1400/1500 controller to MicroLogix 1100/1200/1400/1500 controller it is
recommended that RTC:0 be used as the source instead of (S:37 - S:42).
Example
The example shows network connections using DH-485, however DF1 Full or
Half Duplex Ethernet/IP will also work.
+24vdc
TERM
COM
SHLD
CHS GND
TX TX
TX PWR
DC SOURCE
CABLE
EXTERNAL
1747-CP3
COM
SHLD
CHS GND
TX TX
TX PWR
DC SOURCE
CABLE
EXTERNAL
44616
The example above messages the SLC 500 Date and Time data (S:37 - S:42)to
the MicroLogix 1400 RTC each time the SLC processor is powered up and
placed into the RUN mode or each time the Time Synchronization Bit (B3:0/0)
is enabled.
For each processor that requires its RTC to be synchronized, a MSG write will be
required. This is done simply by duplicating the above ladder logic, referencing a
different Control Block (that is, N100:0 = MSG1 | N100:20 = MSG2 | N100:40
= MSG3, and so on.) and specifying a different node address in the MSG set-up
screen.
The Data Logging feature allows the capture or storage of application data as a
record for later retrieval. Each record is stored in a user-configured battery backed
queue. The size of the queue is 128K bytes, independent of the rest of the
processor memory.
5. Complete the Data Log Queue as shown below. The number of records
and addresses selected are arbitrary for this example.
IMPORTANT Integer file N10 must be created with a length of 5 or the software will
not compile the ladder program. Also, an embedded RTC must be
enabled and configured if the Date and Time stamp are to be used. If an
RTC module is disabled the data for these fields will contain zeros.
The Data Logging utility is the only supported method for retrieving data, that
has been stored in the processor.
4. Click “Connect”.
IMPORTANT By default the MicroLogix 1400 communications are configured for 19200
baud If using defaults select 19200 above, otherwise, select the baud
rate configured in the MicroLogix Channel Configuration Screen.
The DLOG utility will now retrieve the status information from the
MicroLogix 1400 controller.
In this example you can see that Queue #0 has 100 records allocated and 5
recorded.
IMPORTANT If you do not see five records verify your Data Logging Enable bit was
toggled 5 times causing the 5 entries to be recorded in the Queue.
6. Select Read Log. This retrieves the data from the MicroLogix 1400
controller.
Once the Read Log has completed the following screen appears
confirming the number of records that have been read from the Queue(s)
IMPORTANT Remember that once the data records have been read from the
MicroLogix controller, the queue is automatically cleared.
Make note of the filename used and the directory where it was saved for
future reference.
9. Open the data file that was created using Microsoft Excel.
IMPORTANT If you are unable to locate your file in Excel, remember “Files of type”
must be changed to “Text Files” or “All files (*.*)” in order to locate your
saved file.
The headings for each column are not stored in the data file these were
added for readability.
Each time the DLG instruction receives a false-to-true transition, another entry is
saved in the Data Logging queue. The above data reflects that the DLG
instruction was executed 5 times. The above data also reflects that no data points
had changed during each DLG execution.
Question 1: Can I write my own software application to retrieve the data stored in
the Data Logging queue?
Answer 1: Yes. In the MicroLogix 1400 Instruction Set Reference manual, under
the Data Logging chapter, all the information necessary to create your own
software application, for retrieving the data stored in the processors Data Logging
queue, is shown. See Recipe and Data Logging on page 465.
Answer 2: No. To retrieve data, use either the free Data Logging Utility or a
custom application must be created by the user. If the data does not need to be
stored in the processor, but sent directly to a printer, then use the ASCII
instructions of the MicroLogix processor to send out the data.
This utility allows retrieval of data remotely through a Remote Access Modem
Kit (RAD).
The following outlines the configuration and steps that can be used to read data
log records from an MicroLogix 1400 controller remotely through a
1747CH0RAD (Remote Access Modem Kit).
This example assumes that the programmer has configured the DLG instruction
in the ML1400 to log data and that HyperTerminal is installed, configured and
the user is familiar with its use.
Establish Connections
IMPORTANT It will appear as though HyperTerminal has disconnected. It has not; the
connection is still established, only HyperTerminal is no longer running.
Number Systems
This appendix:
• covers binary and hexadecimal numbers.
• explains the use of a hex mask to filter data in certain programming
instructions.
Binary Numbers The processor memory stores 16-bit binary numbers. As indicated in the
following figure, each position in the number has a decimal value, beginning at
the right with 20 and ending at the left with 215.
The far left position will always be 0 for positive values. As indicated in the figure,
this limits the maximum positive decimal value to 32767. All positions are 1
except the far left position.
Other examples:
0000 1001 0000 1110 = 211+28+23+22+21
= 2048+256+8+4+2 = 2318
0010 0011 0010 1000 = 213+29+28+25+23
= 8192+512+256+32+8
= 9000
1x214 = 16384
1x213 = 8192
1x212 = 4096
1x211 = 2048
1x210 = 1024
1x29 = 512
1x28 = 256
1x27 = 128
1x26 = 64
1x25 = 32
1x24 = 16
1x23 = 8
1x22 = 4
1x21 = 2
1x20 = 1
0111 1111 1111 1111 32767
The 2s complement notation is used. The far left position is always 1 for negative
values. The equivalent decimal value of the binary number is obtained by
subtracting the value of the far left position, 32768, from the sum of the values of
the other positions. In the following figure, the value is 32767 - 32768 = -1. All
positions are 1.
Another example:
(214+213+212+211+25+21+20) - 215 =
(16384+8192+4096+2048+32+2+1) - 32768 =
An often easier way to calculate a value is to locate the last 1 in the string of 1s
beginning at the left, and subtract its value from the total value of positions to the
right of that position. For example,
1x214 = 16384
1x213 = 8192
1x212 = 4096
1x211 = 2048
1x210 = 1024
1x29 = 512
1x28 = 256
1x27 = 128
1x26 = 64
1x25 = 32
1x24 = 16
1x23 = 8
1x22 = 4
1x21 = 2
1x20 = 1
1111 1111 1111 1111 32767
Hexadecimal Numbers Hexadecimal numbers use single characters with equivalent decimal values
ranging from 0…15.
HEX 0 1 2 3 4 5 6 7 8 9 A B C D E F
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
The position values of hexadecimal numbers are powers of 16, beginning with
160 at the right:
163 162 161 160
Example
2x163 = 8192
1x162 = 256
8x161 = 128
10x160 = 10
218A 8586
Example
Hex Mask This is a 4-character code, entered as a parameter in SQO, SQC, and other
instructions to exclude selected bits of a word from being operated on by the
instruction. The hexadecimal values are used in their binary equivalent form, as
indicated in the figure below. The figure also shows an example of a hexadecimal
code and the corresponding mask word.
Hex Code
Hex Binary
Value Value 00FF
0 0000
1 0001
2 0010
3 0011
4 0100 0000 0000 1111 1111
5 0101
6 0110 Mask Word
7 0111
8 1000
9 1001
A 1010
B 1011
C 1400
D 1101
E 1110
F 1111
Bits of the mask word that are set (1) will pass data from a source to a destination.
Reset bits (0) will not. In the example below, data in bits 0-7 of the source word is
passed to the destination word. Data in bits 8-15 of the source word is not passed
to the destination word.
Source Word 1110 1001 1100 1010
Notes:
The following terms are used throughout this manual. Refer to the Allen-Bradley
Industrial Automation Glossary, publication AG-7.1, for a complete guide to
Allen-Bradley technical terms.
address
A character string that uniquely identifies a memory location. For example, I:1/0
is the memory address for data located in Input file word 1, bit 0.
application
ASCII
baud rate
bit
The smallest unit of memory used in discrete or binary logic, where the value 1
represents ON and 0 represents OFF.
block diagrams
Boolean operators
Logical operators such as AND, OR, NAND, NOR, NOT, and Exclusive-OR
that can be used singularly or in combination to form logic statements or circuits.
Can have an output response of T or F.
branch
A parallel logic path within a rung of a ladder program. Its primary use is to build
OR logic.
communication scan
control program
controller
controller overhead
control profile
The means by which a controller determines which outputs turn on under what
conditions.
counter
data table
The part of processor memory that contains I/O status and files where user data
(such as bit, integer, timers, and counters) is monitored, manipulated, and
changed for control purposes.
DIN rail
download
DTE
EMI
Electromagnetic interference.
embedded I/O
expansion I/O
Expansion I/O is I/O that is connected to the controller via a bus or cable.
MicroLogix 1100, 1200 and 1400 controllers use Bulletin 1762 expansion I/O.
MicroLogix 1500 controllers use Bulletin 1769 expansion I/O. For MicroLogix
controllers, embedded I/O is all I/O residing at slot 1 and higher.
encoder
A device that detects position, and transmits a signal representing that position.
executing mode
false
The status of an instruction that does not provide a continuous logical path on a
ladder rung.
FET
FIFO (First-In-First-Out)
file
full-duplex
half-duplex
hard disk
high byte
Bits 8 to 15 of a word.
housekeeping
The portion of the scan when the controller performs internal checks and services
communications.
input device
A device, such as a push button or a switch, that supplies an electrical signal to the
controller.
input scan
The controller reads all input devices connected to the input terminals.
inrush current
instruction
instruction set
I/O
jump
ladder logic
The element (or bit) in a binary word that carries the smallest value of weight.
Used as status indicator for processor functions and inputs and outputs.
LIFO (Last-In-First-Out)
low byte
Bits 0 to 7 of a word.
logic
mnemonic
modem
modes
negative logic
The use of binary logic in such a way that “0” represents the desired voltage level.
network
normally closed
Contacts on a relay or switch that are closed when the relay is de-energized or
deactivated. They are open when the relay is energized or the switch is activated.
normally open
Contacts on a relay or switch that are open when the relay is de-energized or the
switch is deactivated. They are closed when the relay is energized or the switch is
activated.
off-delay time
The OFF delay time is a measure of the time required for the controller logic to
recognize that a signal has been removed from the input terminal of the
controller. The time is determined by circuit component delays and by any
applied filter.
offline
offset
on-delay time
The ON delay time is a measure of the time required for the controller logic to
recognize that a signal has been presented at the input terminal of the controller.
one shot
A programming technique that sets a bit ON or OFF for one program scan.
online
operating voltage
For inputs, the voltage range needed for the input to be in the On state. For
outputs, the allowable range of user-supplied voltage.
output device
A device, such as a pilot light or a motor starter coil, that receives a signal or
command from the controller.
output scan
The controller turns on, off, or modifies the devices connected to the output
terminals.
PCCC
processor
processor files
program file
Areas within a processor that contain the logic programs. MicroLogix controllers
support multiple program files.
program mode
program scan
A part of the controller’s operating cycle. During the program scan, the logic
program is processed and the Output Image is updated.
programming device
protocol
read
To acquire data. For example, the processor reads information from other devices
via a read message.
relay
relay logic
restore
reserved bit
retentive data
RS-232
run mode
An executing mode during which the controller scans or executes the logic
program.
rung
A rung contains input and output instructions. During Run mode, the inputs on
a rung are evaluated to be true or false. If a path of true logic exists, the outputs are
made true (energized). If all paths are false, the outputs are made false
(de-energized).
RTU
save
scan
The scan is made up of four elements: input scan, program scan, output scan, and
housekeeping.
scan time
sinking
A term used to describe current flow between two devices. A sinking device
provides a direct path to ground.
sourcing
A term used to describe current flow between two devices. A sourcing device or
circuit provides a power.
status
terminal
A point on an I/O module that external devices, such as a push button or pilot
light, are wired to.
throughput
The time between when an input turns on and a corresponding output turns on
or off. Throughput consists of input delays, program scan, output delays, and
overhead.
true
upload
watchdog timer
A timer that monitors a cyclical process and is cleared at the conclusion of each
cycle. If the watchdog runs past its programmed time period, it causes a fault.
write
To send data to another device. For example, the processor writes data to another
device with a message write instruction.
Rockwell Automation provides technical information on the Web to assist you in using its products.
At http://www.rockwellautomation.com/support/, you can find technical manuals, a knowledge base of FAQs, technical and
application notes, sample code and links to software service packs, and a MySupport feature that you can customize to make the
best use of these tools.
For an additional level of technical phone support for installation, configuration, and troubleshooting, we offer TechConnect
support programs. For more information, contact your local distributor or Rockwell Automation representative,
or visit http://www.rockwellautomation.com/support/.
Installation Assistance
If you experience a problem within the first 24 hours of installation, review the information that is contained in this manual.
You can contact Customer Support for initial help in getting your product up and running.
Rockwell Automation tests all of its products to ensure that they are fully operational when shipped from the manufacturing facility.
However, if your product is not functioning and needs to be returned, follow these procedures.
United States Contact your distributor. You must provide a Customer Support case number (call the phone number above to obtain
one) to your distributor to complete the return process.
Outside United States Please contact your local Rockwell Automation representative for the return procedure.
Documentation Feedback
Your comments will help us serve your documentation needs better. If you have any suggestions on how to improve this document,
complete this form, publication RA-DU002, available at http://www.rockwellautomation.com/literature/.
Rockwell Otomasyon Ticaret A.Ş., Kar Plaza İş Merkezi E Blok Kat:6 34752 İçerenköy, İstanbul, Tel: +90 (216) 5698400