1762 rm001 - en P PDF
1762 rm001 - en P PDF
42 Act i ve Node Tabl e (DF1 Hal f -Dupl ex M ast er) Nodes 240 t o 255
(CS0:42/ 1 i s node 240, CS0:42/ 2 i s node 241, et c.)
Active Node Table Block
I/O Status File
Word Description
0 Embedded M odul e Error Code Al w ays zero
1 t o 6 Expansi on M odul e Error Code The word number corresponds t o t he modul es sl ot number. Ref er t o t he I/ O modul es
document at i on f or speci f i c i nf ormat i on. (M i croLogi x 1200)
1 t o 16
(1)
Expansi on M odul e Error Code The word number corresponds t o t he modul es sl ot number. Ref er t o t he I/ O modul es
document at i on f or speci f i c i nf ormat i on. (M i croLogi x 1500)
(1) 1 t o 8 f or Seri es A Base Uni t s.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
80 Funct i on Fi l es
Notes:
81 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 4
Programming Instructions Overview
Instruction Set
The following table shows the MicroLogix 1200 and 1500 programming
instructions listed within their functional group.
(1)
(1) The RTA - Real Ti me Cl ock Adj ust Inst ruct i on appears on page 58 f ol l owi ng t he Real -Ti me Cl ock Funct i on Fi l e i nf ormat i on.
Functional Group Description Page
Hi gh-Speed Count er HSL, RAC The hi gh-speed count er i nst ruct i ons (al ong wi t h t he HSC f unct i on f i l e) al l ow you t o moni t or
and cont rol t he hi gh-speed out put s. General l y used wi t h DC i nput s.
87
Hi gh-Speed Out put s PTO, PWM The hi gh-speed out put i nst ruct i ons (al ong w i t h t he PTO and PWM f unct i on f i l es) al l ow you
t o moni t or and cont rol t he hi gh-speed out put s. General l y used wi t h FET out put s (BXB uni t s).
119
Rel ay-Type (Bi t ) XIC, XIO, OTE, OTL, OTU, OSR, ONS, OSF The rel ay-t ype (bi t ) i nst ruct i ons moni t or and cont rol t he st at us
of bi t s.
147
Ti mer and Count er TON, TOF, RTO, CTU, CTD, RES The t i mer and count er i nst ruct i ons cont rol operat i ons based on t i me or
t he number of event s.
153
Compare EQU, NEQ, LES, LEQ, GRT, GEQ, M EQ, LIM The compare i nst ruct i ons compare val ues by usi ng a speci f i c
compare operat i on.
163
M at h ADD, SUB, M UL, DIV, NEG, CLR, ABS, SQR, SCL, SCP, SWP The mat h i nst ruct i ons perf orm ari t hmet i c
operat i ons.
169
Conversi on DCD, ENC, TOD, FRD, GCD The conversi on i nst ruct i ons mul t i pl ex and de-mul t i pl ex dat a and perf orm
conversi ons bet ween bi nary and deci mal val ues.
181
Logi cal AND, OR, XOR, NOT The l ogi cal i nst ruct i ons perf orm bi t -wi se l ogi cal operat i ons on words. 191
M ove M OV, M VM The move i nst ruct i ons modi f y and move words. 195
Fi l e CPW, COP, FLL, BSL, BSR, FFL, FFU, LFL, LFU The f i l e i nst ruct i ons perf orm operat i ons on f i l e dat a. 199
Sequencer SQC, SQO, SQL Sequencer i nst ruct i ons are used t o cont rol aut omat i c assembl y machi nes t hat have
consi st ent and repeat abl e operat i ons.
215
Program Cont rol JM P, LBL, JSR, SBR, RET, SUS, TND, M CR, END The program f l ow i nst ruct i ons change t he f l ow of
l adder program execut i on.
223
Input and Out put IIM , IOM , REF The i nput and out put i nst ruct i ons al l ow you t o sel ect i vel y updat e dat a wi t hout wai t i ng
f or t he i nput and out put scans.
229
User Int errupt STS, INT, UID, UIE, UIF The user i nt errupt i nst ruct i ons al l ow you t o i nt errupt your program based on
def i ned event s.
233
Process Cont rol PID The process cont rol i nst ruct i on provi des cl osed-l oop cont rol . 253
ASCII ABL, ACB, ACI, ACL, ACN, AEX, AHL, AIC, ARD, ARL, ASC, ASR, AWA, AWT The ASCII i nst ruct i ons
convert and wri t e ASCII st ri ngs. They cannot be used wi t h M i croLogi x 1500 1764-LSP Seri es A
processors.
279
Communi cat i ons M SG, SVC The communi cat i on i nst ruct i ons read or wri t e dat a t o anot her st at i on. 309
Reci pe
(M i croLogi x 1500 onl y)
RCP The reci pe i nst ruct i on al l ows you t o t ransf er a dat a set bet ween t he reci pe dat abase and a set of
user-speci f i ed dat a t abl e el ement s.
359
Dat a Loggi ng
(M i croLogi x 1500
1764-LRP onl y)
DLG The dat a l oggi ng i nst ruct i on al l ow you t o capt ure t i me-st amped and dat e-st amped dat a. 359
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
82 Programmi ng Inst ruct i ons Overvi ew
Using the Instruction
Descriptions
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
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.
The terms used within the table are defined as follows:
Parameter - The parameter is the information you supply to the instruction.
It can be an address, a value, or an instruction-specific parameter such as a
timebase.
Data Files - See Data Files on page 48.
Function Files - See Function Files on page 55.
CS - See Communications Status File on page 66.
IOS - See Input/Output Status File on page 79.
DLS - See Data Log Status File on page 370.
Address Mode - See Addressing Modes on page 82.
Addressing Level - Address levels describe the granularity at which an
instruction allows an operand to be used. For example, relay type
instructions (XIC, XIO, etc.) must be programmed to the bit level, timer
instructions (TON, TOF, etc.) must be programmed to the element level
(timers have 3 words per element) and math instructions (ADD, SUB, etc.)
must be programmed to the word or long word level.
Addressing Modes
The MicroLogix 1200 and MicroLogix 1500 support three types of data
addressing:
Immediate
Valid Addressing Modes and File Types - Example Table
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
(1) See Import ant not e about i ndi rect addressi ng.
Address
Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
I
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source A
Source B
Dest i nat i on
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Programmi ng Inst ruct i ons Overvi ew 83
Direct
Indirect
The MicroLogix 1200 and 1500 do not support indexed addressing. Indexed
addressing can be duplicated with indirect addressing. See Example - Using
Indirect Addressing to Duplicate Indexed Addressing on page 85.
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 1200 and 1500 allow
incredible flexibility in how data can be monitored or manipulated. Each of the
addressing modes are described below.
Immedi at e Addressi ng
Immediate addressing is primarily used to assign numeric constants within
instructions. For example: You require a 10 second timer, so you program a timer
with a 1 second time base and a preset value of 10. The numbers 1 and 10 in this
example are both forms of immediate addressing.
Di rect Addressi ng
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 to 32,767) entered
from the programming software.
Test Value = TPI: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 (TPI:0.POT0) and High Limit (N7:17) are direct addressing
examples. The Low Limit is immediate addressing.
Indi rect Addressi ng
Indirect addressing allows components within the address to be used as pointers to
other data locations within the controller. This functionality can be especially
useful for certain types of applications, recipe management, batch processing and
many others. Indirect addressing can also be difficult to understand and
troubleshoot. It is recommended that you only use indirect addressing when it is
required by the application being developed.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
84 Programmi ng Inst ruct i ons Overvi ew
The MicroLogix 1200 and 1500 support 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
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.
Indirect Addressing of a File
Address: N[N50:100]:10
Description: In this example, the source of the COP instruction is indirected
by N50:100. The data in N50:100 defines the data file number to be used in
the instruction. In this example, the copy instruction source A is defined by
N[N50:100]:10. When the instruction is scanned, the data in N50:100 is used
to define the data file to be used for the COP instruction. If the value of
location N50:100 = 27, this instruction copies 15 elements of data from
N27:10 (N27:10 to N27:24) to N7:0 (N7:0 to N7:14)
TIP If a number l arger t han t he number of el ement s i n t he dat a f i l e i s pl aced i n
N10:1 (i n t hi s exampl e), dat a i nt egri t y cannot be guarant eed, because a f i l e
boundary wi l l be crossed. Thi s may not generat e a cont rol l er f aul t , but t he
dat a l ocat i on i s i nval i d/ unknow n.
TIP If a number l arger t han 255 i s pl aced i n N50:100 i n t hi s exampl e, a
cont rol l er f aul t occurs. Thi s i s because t he cont rol l er has a maxi mum of
255 dat a f i l es. In addi t i on, t he f i l e def i ned by t he i ndi rect i on shoul d mat ch
t he f i l e t ype def i ned by t he i nst ruct i on, i n t hi s exampl e an i nt eger f i l e.
0000
B3:0
0
ADD
Add
Source A N7:[N10:1]
0<
Source B 1234
1234<
Dest N11:33
0<
ADD
0001
LIM
Li mi t Test
Low Li m 10
10<
Test N50:100
10<
Hi gh Li m 25
25<
LIM B3:0
0
COP
Copy Fi l e
Source #N[N50:100]:10
Dest #N7:0
Lengt h 15
COP
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Programmi ng Inst ruct i ons Overvi ew 85
Indirect Addressing of Bit
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.
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.
Example - Using Indirect Addressing to Duplicate Indexed
Addressing
In this section, an indexed addressing example is shown first. Then an equivalent
indirect addressing example is shown. Indexed addressing is supported by SLC 500
and MicroLogix 1000 programmable controllers. The MicroLogix 1200 and 1500
do not support indexed addressing. This example is shown for comparison
purposes.
TIP Thi s exampl e al so i l l ust rat es how t o perf orm a l i mi t check on t he i ndi rect
address. The l i mi t i nst ruct i on at t he begi nni ng of t he rung i s moni t ori ng t he
i ndi rect el ement . If t he dat a at N50:100 i s l ess t han 10 or great er t han 25,
t he copy i nst ruct i on i s not processed. Thi s procedure can be used t o make
sure an i ndi rect address does not access dat a an uni nt ended l ocat i on.
TIP If a number l arger t han 4096 (or l arger t han t he number of el ement s i n t he
dat a f i l e) i s pl aced i n B25:0 i n t hi s exampl e, dat a i nt egri t y cannot be
guarant eed. Exceedi ng t he number of el ement s i n t he dat a f i l e woul d cause
t he f i l e boundary t o be crossed.
IMPORTANT You must exerci se ext reme care when usi ng i ndi rect addressi ng. Al ways be
aw are of t he possi bi l i t y of crossi ng f i l e boundari es or poi nt i ng t o dat a t hat
was not i nt ended t o be used.
0002
B3:0
[B25:0]
B3:0
10
0003 END
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
86 Programmi ng Inst ruct i ons Overvi ew
Indexed Addressi ng Exampl e
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.
In this example, the controller uses the following addresses:
Indi rect Addressi ng Exampl e
An equivalent example using indirect addressing is shown below. In place of using
the index register, S:24, the user can designate any other valid word address as the
indirect address. Multiple indirect addresses can be used within an instruction.
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.
In this example, the controller uses the following addresses:
Operand Base Address Offset Value in S:24 Working Address
Source A N7:0 20 N7:20
Dest i nat i on N15:0 20 N15:20
TIP In t he SLC and M L1000 cont rol l ers, t here are some i nst ruct i ons t hat cl ear
S:24 af t er t he i nst ruct i on compl et es. For t hi s reason, you must i nsure t hat
t he i ndex regi st er i s l oaded wi t h t he i nt ended val ue pri or t o t he execut i on
of an i ndexed i nst ruct i on.
Operand Base Address Offset Value in N7:3 Working Address
Source A N7:0 20 N7:20
Dest i nat i on N7:0 20 N15:20
ADD
Add
Source A #N7:0
Source B 25
Dest #N15:0
ADD ADD
Add
Source A N7:20
Source B 25
Dest N15:20
ADD
Indexed Worki ng
Indi rect Worki ng
ADD
Add
Source A N7:[N7:3]
Source B 25
Dest N15:[N7:3]
ADD ADD
Add
Source A N7:20
Source B 25
Dest N15:20
ADD
87 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 5
Using the High-Speed Counter and
Programmable Limit Switch
High-Speed Counter
Overview
The MicroLogix 1200 has one 20 kHz high-speed counter; the MicroLogix 1500
has two. Functionally, the counters are identical. Each counter has four dedicated
inputs that are isolated from other inputs on the controller. HSC0 utilizes inputs 0
through 3 and HSC1 (MicroLogix 1500 only) utilizes inputs 4 through 7. Each
counter operates independently from the other.
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 87.
HSL - High-Speed Counter Load on page 110.
RAC - Reset Accumulated Value on page 111.
Programmable Limit
Switch Overview
The Programmable Limit Switch function allows you to configure the High-Speed
Counter to operate as a PLS (programmable limit switch) or rotary cam switch. See
page 112 for more information.
High-Speed Counter
(HSC) Function File
Within the RSLogix 500 Function File Folder, you see a HSC Function File. This
file provides access to HSC configuration data, and also allows the control
program access to all information pertaining to each of the High-Speed Counters.
TIP HSC0 i s used i n t hi s document t o def i ne how any HSC works. The M i croLogi x
1500s HSC1 i s i dent i cal i n f unct i onal i t y.
IMPORTANT The HSC f unct i on can onl y be used wi t h t he cont rol l ers embedded I/ O. It
cannot be used wi t h expansi on I/ O modul es.
TIP If t he cont rol l er i s i n t he run mode, t he dat a wi t hi n sub-el ement f i el ds may
be changi ng.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
88 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
The HSC function, along with the PTO and PWM 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 each HSC for any
one of eight (8) modes of operation. (Operating Modes are discussed later in this
chapter. See section HSC Mode (MOD) on page 101). Some of the enhanced
capabilities of the High-Speed Counters are:
20 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)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 89
The High-Speed Counter function operates as described in the following diagram.
High-Speed Counter
Function File
Sub-Elements Summary
Each 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, or provide HSC status information for use within the control program.
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. Terms and behavior for HSC1 are identical.
+2,147,483,647 maxi mum
-2,147,483,648 mi ni mum
Overf l ow
Hi gh Preset
0
Low Preset
Underf l ow
High-Speed Counter Function File (HSC:0or HSC:1)
Sub-Element Description Address Data Format HSC
Modes
(1)
FunctionUser Program
Access
For More
Information
PFN - Program Fi l e Number HSC:0.PFN w ord (INT) 0 t o 7 cont rol read onl y 90
ER - Error Code HSC:0.ER w ord (INT) 0 t o 7 st at us read onl y 90
UIX - User Int errupt Execut i ng HSC:0/ UIX bi t 0 t o 7 st at us read onl y 93
UIE - User Int errupt Enabl e HSC:0/ UIE bi t 0 t o 7 cont rol read/ wri t e 93
UIL - User Int errupt Lost HSC:0/ UIL bi t 0 t o 7 st at us read/ wri t e 94
UIP - User Int errupt Pendi ng HSC:0/ UIP bi t 0 t o 7 st at us read onl y 94
FE - Funct i on Enabl ed HSC:0/ FE bi t 0 t o 7 cont rol read/ wri t e 91
AS - Aut o St art HSC:0/ AS bi t 0 t o 7 cont rol read onl y 91
ED - Error Det ect ed HSC:0/ ED bi t 0 t o 7 st at us read onl y 92
CE - Count i ng Enabl ed HSC:0/ CE bi t 0 t o 7 cont rol read/ wri t e 92
SP - Set Paramet ers HSC:0/ SP bi t 0 t o 7 cont rol read/ wri t e 92
LPM - Low Preset M ask HSC:0/ LPM bi t 2 t o 7 cont rol read/ wri t e 95
HPM - Hi gh Preset M ask HSC:0/ HPM bi t 0 t o 7 cont rol read/ wri t e 96
UFM - Underf l ow M ask HSC:0/ UFM bi t 2 t o 7 cont rol read/ wri t e 98
OFM - Overf l ow M ask HSC:0/ OFM bi t 0 t o 7 cont rol read/ wri t e 99
LPI - Low Preset Int errupt HSC:0/ LPI bi t 2 t o 7 st at us read/ wri t e 95
HPI - Hi gh Preset Int errupt HSC:0/ HPI bi t 0 t o 7 st at us read/ wri t e 96
UFI - Underf l ow Int errupt HSC:0/ UFI bi t 2 t o 7 st at us read/ wri t e 98
OFI - Overf l ow Int errupt HSC:0/ OFI bi t 0 t o 7 st at us read/ wri t e 99
LPR - Low Preset Reached HSC:0/ LPR bi t 2 t o 7 st at us read onl y 96
HPR - Hi gh Preset Reached HSC:0/ HPR bi t 2 t o 7 st at us read onl y 97
DIR - Count Di rect i on HSC:0/ DIR bi t 0 t o 7 st at us read onl y 100
UF - Underf l ow HSC:0/ UF bi t 0 t o 7 st at us read/ wri t e 97
OF - Overf l ow HSC:0/ OF bi t 0 t o 7 st at us read/ wri t e 99
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
90 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
HSC Function File
Sub-Elements
All examples illustrate HSC0. Terms and behavior for HSC1 are identical.
ProgramFile Number (PFN)
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 to 255).
See also:Interrupt Latency on page 236.
Error Code (ER)
The ERs (Error Codes) detected by the HSC sub-system are displayed in this word.
Errors include:
M D - M ode Done HSC:0/ M D bi t 0 or 1 st at us read/ wri t e 100
CD - Count Down HSC:0/ CD bi t 2 t o 7 st at us read onl y 101
CU - Count Up HSC:0/ CU bi t 0 t o 7 st at us read onl y 101
M OD - HSC M ode HSC:0.M OD word (INT) 0 t o 7 cont rol read onl y 101
ACC - Accumul at or HSC:0.ACC l ong word (32-bi t INT) 0 t o 7 cont rol read/ wri t e 106
HIP - Hi gh Preset HSC:0.HIP l ong word (32-bi t INT) 0 t o 7 cont rol read/ wri t e 106
LOP - Low Preset HSC:0.LOP l ong word (32-bi t INT) 2 t o 7 cont rol read/ wri t e 107
OVF - Overf l ow HSC:0.OVF l ong word (32-bi t INT) 0 t o 7 cont rol read/ wri t e 107
UNF - Underf l ow HSC:0.UNF l ong word (32-bi t INT) 2 t o 7 cont rol read/ wri t e 108
OM B - Out put M ask Bi t s HSC:0.OM B word (16-bi t bi nary) 0 t o 7 cont rol read onl y 109
HPO - Hi gh Preset Out put HSC:0.HPO word (16-bi t bi nary) 0 t o 7 cont rol read/ wri t e 110
LPO - Low Preset Out put HSC:0.LPO word (16-bi t bi nary) 2 t o 7 cont rol read/ wri t e 110
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101. N/ a = not appl i cabl e
High-Speed Counter Function File (HSC:0or HSC:1)
Sub-Element Description Address Data Format HSC
Modes
(1)
FunctionUser Program
Access
For More
Information
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
PFN - Program
Fi l e Number
HSC:0.PFN word (INT) 0 t o 7 cont rol read onl y
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
ER - Error Code HSC:0.ER word (INT) 0 t o 7 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 91
Function Enabled (FE)
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 235.
Auto Start (AS)
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.
HSC Error Codes
Error Code Name
Mode
(1)
Description
1 Inval i d Fi l e
Number
n/ a Int errupt (program) f i l e i dent i f i ed i n HSC:0.PFN i s
l ess t han 3, great er t han 255, or does not exi st
2 Inval i d M ode n/ a
Inval i d M ode
(1)
3 Inval i d Hi gh
Preset
0,1 Hi gh preset i s l ess t han or equal t o zero (0)
2 t o 7 Hi gh preset i s l ess t han or equal t o l ow preset
4 Inval i d Overf l ow 0 t o 7 Hi gh preset i s great er t han overf l ow
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
FE - Funct i on
Enabl ed
HSC:0/ FE bi t 0 t o 7 cont rol read/ wri t e
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
AS - Aut o St art HSC:0/ AS bi t 0 t o 7 cont rol read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
92 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
Error Detected (ED)
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.
Counting Enabled (CE)
The CE (Counting Enabled) control bit is used to enable or disable the
High-Speed Counter. When set (1), counting is enabled, when clear (0, default)
counting is disabled. If this bit is disabled while the counter is running, the
accumulated value is held; if the bit is then set, counting resumes.
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.
Set Parameters (SP)
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.
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
ED - Error
Det ect ed
HSC:0/ ED bi t 0 t o 7 st at us read onl y
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
CE - Count i ng
Enabl ed
HSC:0/ CE bi t 0 t o 7 cont rol read/ wri t e
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
SP - Set
Paramet ers
HSC:0/ SP bi t 0 t o 7 cont rol read/ w ri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 93
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.
User Interrupt Enable (UIE)
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).
User Interrupt Executing (UIX)
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
Description Address Data
Format
HSC
Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User Program
Access
UIE - User Int errupt Enabl e HSC:0/ UIE bi t 0 t o 7 cont rol read/ w ri t e
ATTENTION: If you enabl e i nt errupt s duri ng t he program scan vi a an OTL,
OTE, or UIE, t hi s i nst ruct i on must be t he l ast i nst ruct i on execut ed on t he rung
(l ast i nst ruct i on on l ast branch). It i s recommended t hi s be t he onl y out put
i nst ruct i on on t he rung.
Description Address Data
Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User Program
Access
UIX - User Int errupt Execut i ng HSC:0/ UIX bi t 0 t o 7 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
94 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
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.
User Interrupt Pending (UIP)
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.
User Interrupt Lost (UIL)
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.
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
UIP - User
Int errupt
Pendi ng
HSC:0/ UIP bi t 0 t o 7 st at us read onl y
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
UIL - User
Int errupt Lost
HSC:0/ UIL bi t 0 t o 7 st at us read/ w ri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 95
Low Preset Mask (LPM)
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.
Low Preset Interrupt (LPI)
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
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
LPM - Low
Preset M ask
HSC:0/ LPM bi t 2 t o 7 cont rol read/ wri t e
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
LPI - Low
Preset Int errupt
HSC:0/ LPI bi t 2 t o 7 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
96 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
Low Preset Reached (LPR)
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.
High Preset Mask (HPM)
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.
High Preset Interrupt (HPI)
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.
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
LPR - Low
Preset
Reached
HSC:0/ LPR bi t 2 t o 7 st at us read onl y
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
HPM - Hi gh
Preset M ask
HSC:0/ HPM bi t 0 t o 7 cont rol read/ wri t e
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
HPI - Hi gh
Preset Int errupt
HSC:0/ HPI bi t 0 t o 7 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 97
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
High Preset Reached (HPR)
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)
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.
Underflow conditions do not generate a controller fault.
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
HPR - Hi gh
Preset Reached
HSC:0/ HPR bi t 2 t o 7 st at us read onl y
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
UF - Underf l ow HSC:0/ UF bi t 0 t o 7 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
98 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
Underflow Mask (UFM)
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.
Underflow Interrupt (UFI)
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
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
UFM -
Underf l ow
M ask
HSC:0/ UFM bi t 2 t o 7 cont rol read/ wri t e
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
UFI - Underf l ow
Int errupt
HSC:0/ UFI bi t 2 t o 7 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 99
Overflow (OF)
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.
Overflow conditions do not generate a controller fault.
Overflow Mask (OFM)
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.
Overflow Interrupt (OFI)
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.
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
OF - Overf l ow HSC:0/ OF bi t 0 t o 7 st at us read/ wri t e
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
OFM - Overf l ow
M ask
HSC:0/ OFM bi t 0 t o 7 cont rol read/ wri t e
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
OFI - Overf l ow
Int errupt
HSC:0/ OFI bi t 0 t o 7 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
100 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
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
Underflow Interrupt executes
Controller enters an executing mode
Count Direction (DIR)
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.
Mode Done (MD)
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.
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
DIR - Count
Di rect i on
HSC:0/ DIR bi t 0 t o 7 st at us read onl y
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
M D - M ode
Done
HSC:0/ M D bi t 0 or 1 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 101
Count Down (CD)
The CD (Count Down) bit is used with the bidirectional counters (modes 2 to 7).
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)
The CU (Count Up) bit is used with all of the HSCs (modes 0 to 7). If the CE bit is
set, the CU bit is set (1). If the CE bit is clear, the CU bit is cleared (0).
HSC Mode (MOD)
The MOD (Mode) variable sets the High-Speed Counter to one of 8 types of
operation. This integer value is configured through the programming device and is
accessible in the control program as a read-only variable.
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
CD - Count Down HSC:0/ CD bi t 2 t o 7 st at us read onl y
Description Address Data Format
HSC Modes
(1)
(1) For M ode descri pt i ons, see HSC M ode (M OD) on page 101.
Type User ProgramAccess
CU - Count Up HSC:0/ CU bi t 0 t o 7 st at us read onl y
Description Address Data Format Type User ProgramAccess
M OD - HSC M ode HSC:0.M OD word (INT) cont rol read onl y
HSC Operating Modes
Mode
Number
Type
0 Up Count er - The accumul at or i s i mmedi at el y cl eared (0) w hen i t reaches t he hi gh
preset . A l ow preset cannot be def i ned i n t hi s mode.
1 Up Count er w i t h ext ernal reset and hol d - The accumul at or i s i mmedi at el y cl eared
(0) when i t reaches t he hi gh preset . A l ow preset cannot be def i ned i n t hi s mode.
2 Count er wi t h ext ernal di rect i on
3 Count er wi t h ext ernal di rect i on, reset , and hol d
4 Two i nput count er (up and down)
5 Two i nput count er (up and down) wi t h ext ernal reset and hol d
6 Quadrat ure count er (phased i nput s A and B)
7 Quadrat ure count er (phased i nput s A and B) wi t h ext ernal reset and hol d
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
102 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
HSC M ode 0 - Up Count er
HSC M ode 1 - Up Count er wi t h Ext ernal Reset and Hol d
HSC M ode 2 - Count er wi t h Ext ernal Di rect i on
HSC Mode 0Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
Function Count Not Used Not Used Not Used
Example 1 on (1) HSC Accumul at or + 1 count
Example 2 on
(1)
of f (0) of f (0) Hol d accumul at or val ue
(1) HSC1 onl y appl i es t o t he M i croLogi x 1500.
Bl ank cel l s = dont care, = ri si ng edge, = f al l i ng edge
TIP Input s I1:0.0/ 0 t hrough I1:0.0/ 7 are avai l abl e f or use as i nput s t o ot her
f unct i ons regardl ess of t he HSC bei ng used.
HSC Mode 1Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
Function Count Not Used Reset Hold
Example 1 on
(1)
of f
(0)
of f
(0)
on (1) HSC Accumul at or + 1 count
Example 2 on
(1)
of f
(0)
on
(1)
Hol d accumul at or val ue
Example3 on
(1)
of f
(0)
of f (0) Hol d accumul at or val ue
Example 4 on
(1)
of f
(0)
on
(1)
of f
(0)
Hol d accumul at or val ue
Example 5 Cl ear accumul at or (=0)
(1) HSC1 onl y appl i es t o t he M i croLogi x 1500.
Bl ank cel l s = dont care, = ri si ng edge, = f al l i ng edge
TIP Input s I1:0.0/ 0 t hrough I1:0.0/ 7 are avai l abl e f or use as i nput s t o ot her
f unct i ons regardl ess of t he HSC bei ng used.
HSC Mode 2Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
Function Count Direction Not Used Not Used
Example 1 of f
(0)
on (1) HSC Accumul at or + 1 count
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 103
HSC M ode 3 - Count er wi t h Ext ernal Di rect i on, Reset , and Hol d
HSC M ode 4 - Two Input Count er (up and down)
Example 2 on
(1)
on (1) HSC Accumul at or - 1 count
Example3 of f (0) Hol d accumul at or val ue
(1) HSC1 onl y appl i es t o t he M i croLogi x 1500.
Bl ank cel l s = dont care, = ri si ng edge, = f al l i ng edge
HSC Mode 2Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
TIP Input s I1:0.0/ 0 t hrough I1:0.0/ 7 are avai l abl e f or use as i nput s t o ot her
f unct i ons regardl ess of t he HSC bei ng used.
HSC Mode 3Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
Function Count Direction Reset Hold
Example 1 of f
(0)
on
(1)
of f
(0)
of f
(0)
on (1) HSC Accumul at or + 1 count
Example 2 on
(1)
on
(1)
of f
(0)
of f
(0)
on (1) HSC Accumul at or - 1 count
Example3 on
(1)
of f
(0)
on
(1)
Hol d accumul at or val ue
Example 4 on
(1)
of f
(0)
of f (0) Hol d accumul at or val ue
Example 5 on
(1)
of f
(0)
on
(1)
of f
(0)
Hol d accumul at or val ue
Example 6 Cl ear accumul at or (=0)
(1) HSC1 onl y appl i es t o t he M i croLogi x 1500.
Bl ank cel l s = dont care, = ri si ng edge, = f al l i ng edge
TIP Input s I1:0.0/ 0 t hrough I1:0.0/ 7 are avai l abl e f or use as i nput s t o ot her
f unct i ons regardl ess of t he HSC bei ng used.
HSC Mode 4Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
Function Count Up Count Down Not Used Not Used
Example 1 on
(1)
of f
(0)
on (1) HSC Accumul at or + 1 count
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
104 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
HSC M ode 5 - Two Input Count er (up and down) wi t h Ext ernal Reset and Hol d
Usi ng t he Quadrat ure Encoder
The Quadrature Encoder is used for determining direction of rotation and
position for rotating, such as a lathe. The Bidirectional Counter counts the rotation
of the Quadrature Encoder.
The figure below shows a quadrature encoder connected to inputs 0, 1, and 2. The
count direction is determined by the phase angle between A and B. If A leads B,
the counter increments. If B leads A, the counter decrements.
Example 2 on
(1)
of f
(0)
on (1) HSC Accumul at or - 1 count
Example3 of f (0) Hol d accumul at or val ue
(1) HSC1 onl y appl i es t o t he M i croLogi x 1500.
Bl ank cel l s = dont care, = ri si ng edge, = f al l i ng edge
HSC Mode 4Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
TIP Input s I1:0.0/ 0 t hrough I1:0.0/ 7 are avai l abl e f or use as i nput s t o ot her
f unct i ons regardl ess of t he HSC bei ng used.
HSC Mode 5Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
Function Count Direction Reset Hold
Example 1 on
(1)
of f
(0)
on
(1)
of f
(0)
of f
(0)
on (1) HSC Accumul at or + 1 count
Example 2 on
(1)
of f
(0)
on
(1)
of f
(0)
of f
(0)
on (1) HSC Accumul at or - 1 count
Example3 on
(1)
of f
(0)
on
(1)
Hol d accumul at or val ue
Example 4 on
(1)
of f
(0)
of f (0) Hol d accumul at or val ue
Example 5 on
(1)
of f
(0)
on
(1)
of f
(0)
Hol d accumul at or val ue
Example 6 Cl ear accumul at or (=0)
(1) HSC1 onl y appl i es t o t he M i croLogi x 1500.
Bl ank cel l s = dont care, = ri si ng edge, = f al l i ng edge
TIP Input s I1:0.0/ 0 t hrough I1:0.0/ 7 are avai l abl e f or use as i nput s t o ot her
f unct i ons regardl ess of t he HSC bei ng used.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 105
The counter can be reset using the Z input. The Z outputs from the encoders
typically provide one pulse per revolution.
HSC M ode 6 - Quadrat ure Count er (phased i nput s A and B)
Quadrat ure Encoder
Input 0
Input 1
Input 2
A
B
Z
(Reset i nput )
Reverse Rot at i on
Forward Rot at i on
B
A
1 2
3
2 1
Count
HSC Mode 6Examples
(1)
Input Terminals I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE Bit Comments
Function Count A Count B Not Used Not Used
Example 1
(2)
of f (0) on (1) HSC Accumul at or + 1 count
Example 2
(3)
of f (0) on (1) HSC Accumul at or - 1 count
Example3 of f (0) Hol d accumul at or val ue
Example 4 on (1) Hol d accumul at or val ue
Example 5 on (1) Hol d accumul at or val ue
Example 6 of f (0) Hol d accumul at or val ue
(1) HSC1 onl y appl i es t o t he M i croLogi x 1500.
(2) Count i nput A l eads count i nput B.
(3) Count i nput B l eads count i nput A.
Bl ank cel l s = dont care, = ri si ng edge, = f al l i ng edge
TIP Input s I1:0.0/ 0 t hrough I1:0.0/ 7 are avai l abl e f or use as i nput s t o ot her
f unct i ons regardl ess of t he HSC bei ng used.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
106 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
HSC M ode 7 - Quadrat ure Count er (phased i nput s A and B) Wi t h Ext ernal Reset
and Hol d
Bl ank cel l s = dont care, = ri si ng edge, = f al l i ng edge
Accumulator (ACC)
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.
High Preset (HIP)
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:
HSC Mode 7Examples
(1)
Input
Terminals
I1:0.0/ 0 (HSC0)
I1:0.0/ 4 (HSC1)
I1:0.0/ 1 (HSC0)
I1:0.0/ 5 (HSC1)
I1:0.0/ 2 (HSC0)
I1:0.0/ 6 (HSC1)
I1:0.0/ 3 (HSC0)
I1:0.0/ 7 (HSC1)
CE
Bit
Comments
Function Count A Count B Z reset Hold
Example 1
(2)
of f (0) of f (0) on (1) HSC Accumul at or + 1 count
Example 2
(3)
of f (0) of f (0) of f (0) on (1) HSC Accumul at or - 1 count
Example3 of f (0) of f (0) on (1) Reset accumul at or t o zero
Example 4 on (1) Hol d accumul at or val ue
Example 5 on (1) Hol d accumul at or val ue
Example 6 of f (0) on (1) Hol d accumul at or val ue
Example 7 of f (0) of f (0) Hol d accumul at or val ue
(1) HSC1 onl y appl i es t o t he M i croLogi x 1500.
(2) Count i nput A l eads count i nput B.
(3) Count i nput B l eads count i nput A.
TIP Input s I1:0.0/ 0 t hrough I1:0.0/ 7 are avai l abl e f or use as i nput s t o ot her
f unct i ons regardl ess of t he HSC bei ng used.
Description Address Data Format Type User ProgramAccess
ACC - Accumul at or HSC:0.ACC l ong word (32-bi t INT) cont rol read/ wri t e
Description Address Data Format Type User ProgramAccess
HIP - Hi gh Preset HSC:0.HIP l ong word (32-bi t INT) cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 107
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 110.
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.
Low Preset (LOP)
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 110.
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)
The OVF (Overflow) defines the upper count limit for the counter. If the counters
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.
Description Address Data Format Type User ProgramAccess
LOP - Low Preset HSC:0.LOP l ong word (32-bi t INT) cont rol read/ wri t e
Description Address Data Format Type User ProgramAccess
OVF - Overf l ow HSC:0.OVF l ong word (32-bi t INT) cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
108 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
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.
Underflow (UNF)
The UNF (Underflow) defines the lower count limit for the counter. If the
counters 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 Dat a l oaded i nt o t he overf l ow vari abl e must be great er t han t he dat a
resi dent i n t he hi gh preset (HSC:0.HIP) or an HSC error i s generat ed.
Description Address Data Format Type User ProgramAccess
UNF - Underf l ow HSC:0.UNF l ong word (32-bi t INT) cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 109
Output Mask Bits (OMB)
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.
The table below illustrates this relationship:
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 12 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.
TIP Dat a l oaded i nt o t he overf l ow vari abl e must be great er t han t he dat a
resi dent i n t he hi gh preset (HSC:0.HIP) or an HSC error i s generat ed.
Description Address Data Format Type User ProgramAccess
OM B - Out put M ask Bi t s HSC:0.OM B w ord (16-bi t bi nary) cont rol read onl y
Affect of HSC Output Mask on Base Unit Outputs
Output Address 16-Bit Signed Integer Data Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HSC:0.HPO (hi gh preset out put ) 0 1 1 0 1 0 0 1 1 0 0 1
HSC:0.OM B (out put mask) 1 0 0 0 0 1 1 1 0 0 1 1
O0:0.0 0 0 0 1 0 1
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
110 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
High Preset Output (HPO)
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 109 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.
Low Preset Output (LPO)
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 109 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.
HSL - High-Speed
Counter Load
Instruction Type: output
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:
Description Address Data Format Type User ProgramAccess
HPO - Hi gh Preset Out put HSC:0.HPO word (16-bi t bi nary) cont rol read/ wri t e
Description Address Data Format Type User ProgramAccess
LPO - Low Preset Out put HSC:0.LPO word (16-bi t bi nary) cont rol read/ wri t e
HSL
High Speed Counter Load
HSC Number HSC0
High Preset N7:0
Low Preset N7:1
Output High Source N7:2
Output Low Source N7:3
HSL
Controller Data Size Execution Time When Rung Is:
True False
M i croLogi x 1200 word 46.7 s 0.0 s
l ong word 47.3 s 0.0 s
M i croLogi x 1500 word 39.7 s 0.0 s
l ong word 40.3 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 111
Counter Number - Specifies which high-speed counter is being used;
0 = HSC0 and 1 = HSC1 (MicroLogix 1500 only).
High Preset - Specifies the value in the high preset register. The data ranges
for the high preset are -32786 to 32767 (word) and -2,147,483,648 to
2,147,483,647 (long word).
Low Preset - Specifies the value in the low preset register. The data ranges
for the low preset are -32786 to 32767 (word) and -2,147,483,648 to
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 to 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 to 65,535.
Valid Addressing Modes and File Types are shown below:
RAC - Reset
Accumulated Value
Instruction Type: output
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 (MicroLogix 1200 and 1500)
Counter Number 1 = HSC1 (MicroLogix 1500 only)
Source - Specifies the location of the data to be loaded into the HSC
accumulator. The data range is from -2,147,483,648 to 2,147,483,647.
HSL Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Count er Number
Hi gh Preset
Low Preset
Out put Hi gh Source
Out put Low Source
RAC
Reset Accumulated Value
Counter HSC0
Source 0
RAC
Controller Execution Time When Rung Is:
True False
M i croLogi x 1200 21.2 s 0.0 s
M i croLogi x 1500 17.8 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
112 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
Valid Addressing Modes and File Types are shown below:
Programmable Limit
Switch (PLS) File
The Programmable Limit Switch function allows you to configure the High-Speed
Counter to operate as a PLS (programmable limit switch) or rotary 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 controllers base
unit. The PLS data file is illustrated below.
PLS Data File
Data files 9 to 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:
RAC Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
F
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Count er Number
Source
IMPORTANT The PLS Funct i on onl y operat es i n t andem wi t h t he HSC of a M i croLogi x
1200 or 1500. To use t he PLS f unct i on, an HSC must f i rst be conf i gured.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 113
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.
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.
TIP The Out put Hi gh Dat a (OHD) i s onl y wri t t en when t he Hi gh preset (HIP) i s
reached. The Out put Low Dat a (OLD) i s wri t t en when t he l ow preset i s
reached.
TIP Out put Hi gh Dat a i s onl y operat i onal when t he count er i s count i ng up.
Out put Low Dat a i s onl y operat i onal when t he count er i s count i ng down.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
114 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
Addressing PLS Files
The addressing format for the PLS file is shown below.
PLS Example
Set t i ng up t he PLS Fi l e
1. Using RSLogix 500, create a new project, give it a name and select the
appropriate controller.
Format Explanation
PLSf:e.s PLS Programmabl e Li mi t Swi t ch f i l e
f Fi l e number The val i d f i l e number range i s f rom 9 t o 255.
: El ement del i mi t er
e El ement number The val i d el ement number range i s f rom 0 t o 255.
. Sub-El ement del i mi t er
s Sub-El ement number The val i d sub-el ement number range i s f rom 0 t o 5
Examples: PLS10:2
PLS12:36.5
PLS File 10, Element 2
PLS File 12, Element 36, Sub-Element 5(Output Low Source)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 115
2. Right click on Data Files and select New.
3. Enter a file number (9 to 255) and select Programmable Limit Switch as
thetype. A Name and/or Description may be entered as well, but is
notrequired.
4. Elements refers to the number of PLS steps. For this example enter a value
of4.
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 to the left.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
116 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
6. Double-click on PLS10 under Data Files. For this example, enter the values
as illustrated below.
PLS Data File Definitions:
Once the values above have been entered for HIP and OHD, the PLS is
configured.
Conf i guri ng t he HSC f or Use wi t h t he PLS
1. Under Controller, double-click on Function Files.
2. For HSC:0, configure the HSC.MOD to use PLS10 and for the HSC to
operate in mode 00.
Data Description Data Format
HIP Hi gh Preset 32-bi t si gned i nt eger
LOP Low Preset
OHD Out put Hi gh Dat a 16-bi t bi nary
(bi t 15--> 0000 0000 0000 0000 <--bi t 0)
OLD Out put Low Dat a
IMPORTANT The val ue f or M OD must be ent ered i n Hexadeci mal .
For exampl e, PLS10 = 0A and HSC M ode = 00
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch 117
PLS Operat i on f or Thi s Exampl e
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.
When HSC.ACC equals 250, the PLS10:0.OHD is sent through the HSC.OMB
mask and energizes the outputs.
This will repeat as the HSC.ACC reaches 500, 750, and 1000. Once completed, the
cycle resets and repeats.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
118 Usi ng t he Hi gh-Speed Count er and Programmabl e Li mi t Swi t ch
119 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 6
Using High-Speed Outputs
The high-speed output instructions allow you to control and monitor the PTO and
PWM functions which control the physical high-speed outputs.
PTO - Pulse Train Output
Instruction Type: output
Pulse Train Output
Function
The MicroLogix 1200 1762-L24BXB and 1762-L40BXB controllers each support
one high-speed output. A MicroLogix 1500 controller utilizing a 1764-28BXB Base
Unit supports two 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
Instruction Used To: Page
PTO - Pul se Trai n Out put Generat e st epper pul ses 119
PWM - Pul se Wi dt h M odul at i on Generat e PWM out put 137
PTO
Pul se Trai n Out put
PTO Number 0
PTO IMPORTANT The PTO f unct i on can onl y be used w i t h t he cont rol l ers embedded I/ O. It
cannot be used wi t h expansi on I/ O modul es.
IMPORTANT The PTO i nst ruct i on shoul d onl y be used wi t h M i croLogi x 1200 and 1500
BXB uni t s. Rel ay out put s are not capabl e of perf ormi ng very hi gh-speed
operat i ons.
Execution Time for the PTO Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 75.6 s 24.4 s
M i croLogi x 1500 72.6 s 21.1 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
120 Usi ng Hi gh-Speed Out put s
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.
In this implementation, the user defines the total number of pulses to be generated
(which corresponds to distance traveled), and how many pulses to use for each
acceleration/deceleration period. The number of pulses not used in the
acceleration/deceleration period defines how many pulses are generated during the
run phase. In this implementation, the acceleration/deceleration intervals are the
same.
Within the PTO function file, there are PTO element(s). An element can be set to
control either output 2 (O0:0/2 on 1762-L24BXB, 1762-L40BXB and
1764-28BXB) or output 3 (O0:0/3 on 1764-28BXB only).
The interface to the PTO sub-system is accomplished by scanning a PTO
instruction in the main program file (file number 2) or by scanning a PTO
instruction in any of the subroutine files. A typical operating sequence of a PTO
instruction is as follows:
1. The rung that a PTO instruction is on is solved true.
2. The PTO instruction is started, and pulses are produced based on the
accelerate/decelerate (ACCEL) parameters, which define the number of
ACCEL pulses and the type of profile: s-curve or trapezoid.
3. The ACCEL phase completes.
4. The RUN phase is entered and the number of pulses defined for RUN
areoutput.
5. The RUN phase completes.
6. Decelerate (DECEL) is entered, and pulses are produced based on the
accelerate/decelerate parameters, which define the number of DECEL
pulses and the type of profile: s-curve or trapezoid.
7. The DECEL phase completes.
8. The PTO instruction is DONE.
TIP Wi t h M i croLogi x 1200 FRN 8, M i croLogi x 1500 FRN 9 and RSLogi x 500
versi on 6.10.10 and hi gher, t he accel erat e/ decel erat e i nt erval s are no
l onger requi red t o be t he same. Independent val ues can now be def i ned f or
t hese i nt erval s. The ADI bi t i n t he PTO f unct i on f i l e i s used t o enabl e t hi s
f eat ure. See page 124.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 121
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.
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.
Condi t i ons Requi red t o St art t he PTO
The following conditions must exist to start the PTO:
The PTO instruction must be in an idle state.
For idle state behavior, all of the following conditions must be met:
Jog Pulse (JP) bit must be off
Jog Continuous (JC) bit must be off
Enable Hard Stop (EH) bit must be off
Normal Operation (NS) bit must be off
The output cannot be forced
The rung it is on must transition from a False state (0) to a True state (1).
Momentary Logic Enable Example
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
TIP PTO st at us i s onl y as f resh as t he scan t i me of t he cont rol l er. Worst case
l at ency i s t he same as t he maxi mum scan of t he cont rol l er. Thi s condi t i on
can be mi ni mi zed by pl aci ng a PTO i nst ruct i on i n t he STI (sel ect abl e t i med
i nt errupt ) f i l e, or by addi ng PTO i nst ruct i ons t o your program t o i ncrease
how of t en a PTO i nst ruct i on i s scanned.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
122 Usi ng Hi gh-Speed Out put s
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.
Standard Logic Enable Example
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:
Stage 0 1 2 3 4 5 6 7 8 9 10 11 12
Rung St at e
Sub-Elements: Relative Timing
Normal Operat i on/ NO
Accel erat e St at us/ AS
Run St at us/ RS
Decel erat e St at us/ DS
Enabl e/ EN
Done/ DN
Idl e/ ID
Jog Pul se/ JP
Jog Cont i nuous/ JC
St art of PTO St art of PTO
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 123
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.
Pulse Train Outputs
(PTO) Function File
Within the RSLogix 500 Function File Folder, you see a PTO Function File with
two elements, PTO0 (1762-L24BXB, 1762-L40BXB, and 1764-28BXB) and PTO1
(1764-28BXB only). These elements provide access to PTO configuration data and
also allow the control program access to all information pertaining to each of the
Pulse Train Outputs.
Stage 0 1 2 3 4 5 6 7 8 9 10 11 12
Rung St at e
Sub-Elements: Relative Timing
Normal Operat i on / NO
Accel erat e St at us / AS
Run St at us / RS
Decel erat e St at us / DS
Enabl e / EN
Done / DN
Idl e / ID
Jog Pul se / JP
Jog Cont i nuous / JC
St art of PTO
St art of PTO
TIP If t he cont rol l er mode i s run, t he dat a w i t hi n sub-el ement f i el ds may be
changi ng.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
124 Usi ng Hi gh-Speed Out put s
Pulse Train Output
Function File
Sub-Elements Summary
The variables within each PTO sub-element, along with what type of behavior and
access the control program has to those variables, are listed individually below. All
examples illustrate PTO 0. Terms and behavior for PTO 1 (MicroLogix 1500 only)
are identical.
Pulse Train Output Function File (PTO:0)
Sub-Element Description Address Data
Format
Range Type User Program
Access
For More
Information
OUT - Out put PTO:0.OUT word (INT) 2 or 3 cont rol read onl y 125
DN - Done PTO:0/ DN bi t 0 or 1 st at us read onl y 126
DS - Decel erat i ng St at us PTO:0/ DS bi t 0 or 1 st at us read onl y 126
RS - Run St at us PTO:0/ RS bi t 0 or 1 st at us read onl y 126
AS - Accel erat i ng St at us PTO:0/ AS bi t 0 or 1 st at us read onl y 127
RP - Ramp Prof i l e PTO:0/ RP bi t 0 or 1 cont rol read/ wri t e 127
IS - Idl e St at us PTO:0/ IS bi t 0 or 1 st at us read onl y 127
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 125
PTO Output (OUT)
The PTO OUT (Output) variable defines the output (O0:0/2 or O0:0/3) that the
PTO 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, PTO pulses output 2 (O0:0.0/2) of the embedded
outputs (1762-L24BXB, 1762-L40BXB, and 1764-28BXB).
When OUT = 3, PTO pulses output 3 (O0:0.0/3) of the embedded outputs
(1764-28BXB only).
ED - Error Det ect ed St at us PTO:0/ ED bi t 0 or 1 st at us read onl y 128
NS - Normal Operat i on St at us PTO:0/ NS bi t 0 or 1 st at us read onl y 128
JPS - Jog Pul se St at us PTO:0/ JPS bi t 0 or 1 st at us read onl y 134
JCS - Jog Cont i nuous St at us PTO:0/ JCS bi t 0 or 1 st at us read onl y 135
ADI - Accel / Decel Pul ses Independent PTO:0/ ADI bi t 0 or 1 cont rol read/ w ri t e 131
JP - Jog Pul se PTO:0/ JP bi t 0 or 1 cont rol read/ w ri t e 134
JC - Jog Cont i nuous PTO:0/ JC bi t 0 or 1 cont rol read/ w ri t e 135
EH - Enabl e Hard St op PTO:0/ EH bi t 0 or 1 cont rol read/ w ri t e 129
EN - Enabl e St at us (f ol l ows rung st at e) PTO:0/ EN bi t 0 or 1 st at us read onl y 129
ER - Error Code PTO:0.ER word (INT) -2 t o 7 st at us read onl y 136
OF - Out put Frequency (Hz) PTO:0.OF word (INT) 0 t o 20,000 cont rol read/ w ri t e 129
OFS - Operat i ng Frequency St at us (Hz) PTO:0.OFS word (INT) 0 t o 20,000 st at us read onl y 130
JF - Jog Frequency (Hz) PTO:0.JF word (INT) 0 t o 20,000 cont rol read/ w ri t e 134
TOP - Tot al Out put Pul ses To Be Generat ed PTO:0.TOP l ong w ord
(32-bi t INT)
0 t o
2,147,483,647
cont rol read/ w ri t e 130
OPP - Out put Pul ses Produced PTO:0.OPP l ong w ord
(32-bi t INT)
0 t o
2,147,483,647
st at us read onl y 130
ADP - Accel / Decel Pul ses PTO:0.ADP l ong w ord
(32-bi t INT)
see p. 131 cont rol read/ w ri t e 131
CS - Cont rol l ed St op PTO:0/ CS bi t 0 or 1 cont rol read/ w ri t e 133
Pulse Train Output Function File (PTO:0)
Sub-Element Description Address Data
Format
Range Type User Program
Access
For More
Information
Sub-Element
Description
Address Data Format Range Type User Program
Access
OUT - Out put PTO:0.OUT word (INT) 2 or 3 cont rol read onl y
TIP Forci ng an out put cont rol l ed by t he PTO whi l e i t i s runni ng st ops al l out put
pul ses and causes a PTO error.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
126 Usi ng Hi gh-Speed Out put s
PTO Done (DN)
The PTO DN (Done) bit is controlled by the PTO 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 PTO instruction has completed its operation
successfully.
Cleared (0) - When the rung the PTO is on is false. If the rung is false when
the PTO instruction completes, the Done bit is set until the next scan of the
PTO instruction.
PTO Decelerating Status (DS)
The PTO DS (Decel) bit is controlled by the PTO 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 PTO instruction is not within the deceleration
phase of the output profile.
PTO Run Status (RS)
The PTO RS (Run Status) bit is controlled by the PTO 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 PTO instruction is within the run phase of the
outputprofile.
Sub-Element
Description
Address Data Format Range Type User Program
Access
DN - Done PTO:0/ DN bi t 0 or 1 st at us read onl y
Sub-Element
Description
Address Data Format Range Type User Program
Access
DS - Decel erat i ng St at us PTO:0/ DS bi t 0 or 1 st at us read onl y
Sub-Element
Description
Address Data Format Range Type User Program
Access
RS - Run St at us PTO:0/ RS bi t 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 127
Cleared (0) - Whenever a PTO instruction is not within the run phase of the
output profile.
PTO Accelerating Status (AS)
The PTO AS (Accelerating Status) bit is controlled by the PTO sub-system. It can
be used by an input instruction on any rung within the control program. The AS
bit operates as follows:
Set (1) - Whenever a PTO instruction is within the acceleration phase of the
output profile.
Cleared (0) - Whenever a PTO instruction is not within the acceleration
phase of the output profile.
PTO Ramp Profile (RP)
The PTO RP (Ramp Profile) bit controls how the output pulses generated by the
PTO sub-system accelerate to and decelerate from the Output Frequency that is
set in the PTO function file (PTO: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 PTO instruction to produce an S-Curve profile.
Cleared (0) - Configures the PTO instruction to produce a Trapezoid profile.
PTO Idle Status (IS)
Sub-Element
Description
Address Data
Format
Range Type User Program
Access
AS - Accel erat i ng St at us PTO:0/ AS bi t 0 or 1 st at us read onl y
Sub-Element
Description
Address Data Format Range Type User Program
Access
RP - Ramp Prof i l e PTO:0/ RP bi t 0 or 1 cont rol read/ wri t e
Sub-Element
Description
Address Data Format Range Type User Program
Access
IS - Idl e St at us PTO:0/ IS bi t 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
128 Usi ng Hi gh-Speed Out put s
The PTO IS (Idle Status) is controlled by the PTO sub-system. It can be used in
the control program by an input instruction. The PTO sub-system must be in an
idle state whenever any PTO operation needs to start.
The IS bit operates as follows:
Set (1) - PTO sub-system is in an idle state. The idle state is defined as the
PTO is not running and no errors are present.
Cleared (0) - PTO sub-system is not in an idle state (it is running)
PTO Error Detected (ED)
The PTO ED (Error Detected Status) bit is controlled by the PTO sub-system. It
can be used by an input instruction on any rung within the control program to
detect when the PTO instruction is in an error state. If an error state is detected,
the specific error is identified in the error code register (PTO:0.ER). The ED bit
operates as follows:
Set (1) - Whenever a PTO instruction is in an error state
Cleared (0) - Whenever a PTO instruction is not in an error state
PTO Normal Operation Status (NS)
The PTO NS (Normal Operation Status) bit is controlled by the PTO sub-system.
It can be used by an input instruction on any rung within the control program to
detect when the PTO is in its normal state. A normal state is ACCEL, RUN,
DECEL or DONE, with no PTO errors. The NS bit operates as follows:
Set (1) - Whenever a PTO instruction is in its normal state
Cleared (0) - Whenever a PTO instruction is not in its normal state
Sub-Element
Description
Address Data Format Range Type User Program
Access
ED - Error Det ect ed St at us PTO:0/ ED bi t 0 or 1 st at us read onl y
Sub-Element Description Address Data Format Range Type User Program
Access
NS - Normal Operat i on St at us PTO:0/ NS bi t 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 129
PTO Enable Hard Stop (EH)
The PTO EH (Enable Hard Stop) bit is used to stop the PTO sub-system
immediately. Once the PTO 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 PTO sub-system operation (idle, normal, jog continuous or jog pulse)
and generates a PTO sub-system error. The EH bit operates as follows:
Set (1) - Instructs the PTO sub-system to stop generating pulses
immediately (output off = 0)
Cleared (0) - Normal operation
PTO Enable Status (EN)
The PTO EN (Enable Status) is controlled by the PTO sub-system. When the
rung preceding the PTO instruction is solved true, the PTO instruction is enabled
and the enable status bit is set. If the rung preceding the PTO instruction
transitions to a false state before the pulse sequence completes its operation, the
enable status bit resets (0). The EN bit operates as follows:
Set (1) - PTO is enabled
Cleared (0) - PTO has completed, or the rung preceding the PTO is false
PTO Output Frequency (OF)
The PTO OF (Output Frequency) variable defines the frequency of the PTO
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. Data less than zero and
greater than 20,000 generates a PTO error.
Sub-Element
Description
Address Data Format Range Type User Program
Access
EH - Enabl e Hard St op PTO:0/ EH bi t 0 or 1 cont rol read/ wri t e
Sub-Element
Description
Address Data Format Range Type User Program
Access
EN - Enabl e St at us
(f ol l ows rung st at e)
PTO:0/ EN bi t 0 or 1 st at us read onl y
Sub-Element Description Address Data
Format
Range Type User Program
Access
OF - Out put Frequency (Hz) PTO:0.OF word (INT) 0 t o 20,000 cont rol read/ w ri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
130 Usi ng Hi gh-Speed Out put s
PTO Operating Frequency Status (OFS)
The PTO OFS (Output Frequency Status) is generated by the PTO sub-system
and can be used in the control program to monitor the actual frequency being
produced by the PTO sub-system.
PTO Total Output Pulses To Be Generated (TOP)
The PTO TOP (Total Output Pulses) defines the total number of pulses to be
generated for the pulse profile (accel/run/decel inclusive).
PTO Output Pulses Produced (OPP)
The PTO OPP (Output Pulses Produced) is generated by the PTO sub-system and
can be used in the control program to monitor how many pulses have been
generated by the PTO sub-system.
Sub-Element
Description
Address Data Format Range Type User Program
Access
OFS - Operat i ng
Frequency St at us (Hz)
PTO:0.OFS word (INT) 0 t o 20,000 st at us read onl y
TIP The val ue di spl ayed may not exact l y mat ch t he val ue ent ered i n t he
PTO:0.OF. Thi s i s because t he PTO sub-syst em may not be capabl e of
reproduci ng an exact f requency at some of t he hi gher f requenci es. For PTO
appl i cat i ons, t hi s i s t ypi cal l y not an i ssue because, i n al l cases, an exact
number of pul ses are produced.
Sub-Element
Description
Address Data
Format
Range Type User
Program
Access
TOP - Tot al Out put
Pul ses To Be Generat ed
PTO:0.TOP l ong word
(32-bi t INT)
0 t o 2,147,483,647 cont rol read/ wri t e
Sub-Element
Description
Address Data
Format
Range Type User Program
Access
OPP - Out put
Pul ses Produced
PTO:0.OPP l ong word
(32-bi t INT)
0 t o 2,147,483,647 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 131
PTO Accel/Decel Pulses Independent (ADI)
The PTO 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 PTO 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 PTO is
enabled. If the four long elements are not properly identified, the controller will
return a -3 error in the PTO function file when going to run.
PTO Accel / Decel Pulses or File:Elem, if ADI=1 (ADP)
The PTO 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 PTO
Output Frequency (OF). The PTO Output Frequency (OF) defines the operating
frequency in pulses/second during the run portion of the profile.
Sub-Element
Description
Address Data Format Range Type User Program
Access
ADI - Accel / Decel
Pul ses Independent
PTO:0/ ADI bi t 0 or 1 cont rol read/ wri t e
Element 1: Acceleration Count
Element 2: Deceleration Count
Elements 3 and 4: reserved
Sub-Element
Description
Address Data Format Range Type User Program
Access
ADP - Accel / Decel
Pul ses
PTO:0.ADP l ong word (32-bi t
INT)
see bel ow cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
132 Usi ng Hi gh-Speed Out put s
In the example below,
TOP (total output pulses) = 12,000
ADP (accelerate/decelerate pulses)= 6,000 (This is the maximum ADP
value that may be entered without causing a fault. The run portion will
equal0.)
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 to 6000. At 6000, the output frequency (OF variable) is
generated and immediately enters the deceleration phase, 6000 to 12,000. At
12,000, the PTO operation would stop (output frequency = 0).
If you need to determine the ramp period (accelerate/decelerate ramp duration):
2 x ADP/OF = duration in seconds (OF = output frequency)
The following formulas can be used to calculate the maximum frequency limit for
both profiles. The maximum frequency = 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)
TIP When ent eri ng t he ADP paramet ers, t he PTO wi l l generat e an Accel /
Decel Error i f one of t he f ol l owi ng condi t i ons occur:
The t ot al pul ses f or t he accel erat i on and decel erat i on phases i s l ess t han
0.
The t ot al pul ses f or t he accel erat i on and decel erat i on phases i s great er
t han t he t ot al out put pul ses t o be generat ed (TOP).
Accel erat i on and decel erat i on val ues can ei t her be i dent i cal (ADI = 0), or
a uni que val ue f or each (ADI = 1).
Accel Run Decel
6,000 0 6,000
Accel Run Decel
12,000
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 133
PTO Controlled Stop (CS)
The PTO CS (Controlled Stop) bit is used to stop an executing PTO instruction, in
the run portion of the profile, by immediately starting the decel phase. Once set,
the decel phase completes without an error or fault condition.
If the CS bit is set during the accel phase, the accel phase completes and the PTO
immediately enters the decel phase.
Sub-Element Description Address Data
Format
Range Type User Program
Access
CS - Cont rol l ed St op PTO:0/ CS bi t 0 or 1 cont rol read/ wri t e
Normal Ramp Funct i on wi t hout CS
Accel Run Decel
Normal Ramp
Funct i on
Ramp Funct i on
Decel Af t er CS
i s Set
Accel
Cont rol l ed
St op (CS) Set
Run Decel
Normal Ramp
Funct i on
Ramp Funct i on
Decel Af t er CS
i s Set
Accel
Cont rol l ed
St op (CS) Set
Decel
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
134 Usi ng Hi gh-Speed Out put s
PTO J og Frequency (J F)
The PTO JF (Jog Frequency) variable defines the frequency of the PTO 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). Data less than zero and greater than 20,000 generates a PTO error.
PTO J og Pulse (J P)
The PTO JP (Jog Pulse) bit is used to instruct the PTO sub-system to generate a
single pulse. The width is defined by the Jog Frequency parameter in the PTO
function file. Jog Pulse operation is only possible under the following conditions:
PTO sub-system in idle
Jog continuous not active
Enable not active
The JP bit operates as follows:
Set (1) - Instructs the PTO sub-system to generate a single Jog Pulse
Cleared (0) - Arms the PTO Jog Pulse sub-system
PTO J og Pulse Status (J PS)
The PTO JPS (Jog Pulse Status) bit is controlled by the PTO sub-system. It can be
used by an input instruction on any rung within the control program to detect
when the PTO has generated a Jog Pulse.
Sub-Element
Description
Address Data
Format
Range Type User Program
Access
JF - Jog Frequency (Hz) PTO:0.JF word (INT) 0 t o 20,000 cont rol read/ wri t e
Sub-Element
Description
Address Data Format Range Type User Program
Access
JP - Jog Pul se PTO:0/ JP bi t 0 or 1 cont rol read/ wri t e
Sub-Element
Description
Address Data
Format
Range Type User Program
Access
JPS - Jog Pul se St at us PTO:0/ JPS bi t 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 135
The JPS bit operates as follows:
Set (1) - Whenever a PTO instruction outputs a Jog Pulse
Cleared (0) - Whenever a PTO instruction exits the Jog Pulse state
PTO J og Continuous (J C)
The PTO JC (Jog Continuous) bit instructs the PTO sub-system to generate
continuous pulses. The frequency generated is defined by the Jog Frequency
parameter in the PTO function file. Jog Continuous operation is only possible
under the following conditions:
PTO sub-system in idle
Jog Pulse not active
Enable not active
The JC bit operates as follows:
Set (1) - Instructs the PTO sub-system to generate continuous Jog Pulses
Cleared (0) - The PTO sub-system does not generate Jog Pulses
When the Jog Continuous bit is cleared, the current output pulse is truncated.
PTO J og Continuous Status (J CS)
The PTO JCS (Jog Continuous Status) bit is controlled by the PTO sub-system. It
can be used by an input instruction on any rung within the control program to
detect when the PTO is generating continuous Jog Pulses. The JCS bit operates as
follows:
Set (1) - Whenever a PTO instruction is generating continuous Jog Pulses
Cleared (0) - Whenever a PTO instruction is not generating continuous Jog
Pulses.
TIP The out put (j og) pul se i s normal l y compl et e wi t h t he JP bi t set . The JPS bi t
remai ns set unt i l t he JP bi t i s cl eared (0 = of f ).
Sub-Element
Description
Address Data Format Range Type User Program
Access
JC - Jog Cont i nuous PTO:0/ JC bi t 0 or 1 cont rol read/ wri t e
Sub-Element Description Address Data
Format
Range Type User Program
Access
JCS - Jog Cont i nuous St at us PTO:0/ JCS bi t 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
136 Usi ng Hi gh-Speed Out put s
PTO Error Code (ER)
PTO ER (Error Codes) detected by the PTO sub-system are displayed in this
register. The error codes are shown in the table below:
Sub-Element
Description
Address Data Format Range Type User Program
Access
ER - Error Code PTO:0.ER w ord (INT) -3 t o 7 st at us read onl y
Pulse Train Output Error Codes
Error
Code
Non-User
Fault
Recoverable
Fault
Instruction
Errors
Error
Name
Description
-3 No Yes Yes Undef i ned
Accel /
Decel
Accel erat i on Count and Decel erat i on not def i ned duri ng goi ng t o run mode
when Accel / Decel Pul ses Independent (ADI) i s set (1).
-2 Yes No No Overl ap
Error
An out put overl ap i s det ect ed. M ul t i pl e f unct i ons are assi gned t o t he same
physi cal out put . Thi s i s a conf i gurat i on error. The cont rol l er f aul t s and t he
User Faul t Rout i ne does not execut e. Exampl e: PTO0 and PTO1 are bot h
at t empt i ng t o use a si ngl e out put .
-1 Yes No No Out put
Error
An i nval i d out put has been speci f i ed. Out put 2 and out put 3 are t he onl y val i d
choi ces. Thi s i s a conf i gurat i on error. The cont rol l er f aul t s and t he User Faul t
Rout i ne does not execut e.
0 --- --- Normal Normal (0 = no error present )
1 No No Yes Hardst op
Det ect ed
Thi s error i s generat ed whenever a hard st op i s det ect ed. Thi s error does not
f aul t t he cont rol l er.
To cl ear t hi s error, scan t he PTO i nst ruct i on on a f al se rung and reset t he EH
(Enabl e Hard St op) bi t t o 0.
2 No No Yes Out put
Forced
Error
The conf i gured PTO out put (2 or 3) i s current l y f orced. The f orced condi t i on
must be removed f or t he PTO t o operat e.
Thi s error does not f aul t t he cont rol l er. It i s aut omat i cal l y cl eared when t he
f orce condi t i on i s removed.
3 No Yes No Frequency
Error
The operat i ng f requency val ue (OFS) i s l ess t han 0 or great er t han 20,000.
Thi s error f aul t s t he cont rol l er. It can be cl eared by l ogi c wi t hi n t he User Faul t
Rout i ne.
4 No Yes No Accel /
Decel
Error
The accel erat e/ decel erat e paramet ers (ADP) are:
l ess t han zero
great er t han hal f t he t ot al out put pul ses t o be generat ed (TOP)
Accel / Decel exceeds l i mi t (See page 131.)
Thi s error f aul t s t he cont rol l er. It can be cl eared by l ogi c wi t hi n t he User Faul t
Rout i ne.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 137
PWM - Pulse Width
Modulation
Instruction Type: output
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.
5 No No Yes Jog Error PTO i s i n t he i dl e st at e and t wo or more of t he f ol l ow i ng are set :
Enabl e (EN) bi t set
Jog Pul se (JP) bi t set
Jog Cont i nuous (JC) bi t set
Thi s error does not f aul t t he cont rol l er. It i s aut omat i cal l y cl eared when t he
error condi t i on i s removed.
6 No Yes No Jog
Frequency
Error
The j og f requency (JF) val ue i s l ess t han 0 or great er t han 20,000. Thi s error
f aul t s t he cont rol l er. It can be cl eared by l ogi c wi t hi n t he User Faul t Rout i ne.
7 No Yes No Lengt h
Error
The t ot al out put pul ses t o be generat ed (TOP) i s l ess t han zero. Thi s error
f aul t s t he cont rol l er. It can be cl eared by l ogi c wi t hi n t he User Faul t Rout i ne.
Pulse Train Output Error Codes
Error
Code
Non-User
Fault
Recoverable
Fault
Instruction
Errors
Error
Name
Description
PWM
Pul se Wi dt h M odul at i on
PWM Number 1
PWM
IMPORTANT The PWM f unct i on can onl y be used wi t h t he cont rol l ers embedded I/ O. It
cannot be used wi t h expansi on I/ O modul es.
IMPORTANT The PWM i nst ruct i on shoul d onl y be used wi t h M i croLogi x 1200 and 1500
BXB uni t s. Rel ay out put s are not capabl e of perf ormi ng very hi gh-speed
operat i ons.
Execution Time for the PWM Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 126.6 s 24.7 s
M i croLogi x 1500 107.4 s 21.1 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
138 Usi ng Hi gh-Speed Out put s
The interface to the PWM sub-system is accomplished by scanning a PWM
instruction in the main program file (file number 2), or by scanning a PWM
instruction in any of the subroutine files. A typical operating sequence of a PWM
instruction is as follows:
1. The rung that a PWM instruction is on is solved true (the PWM is started).
2. A waveform at the specified frequency is produced.
3. The RUN phase is active. A waveform at the specified frequency with the
specified duty cycle is output.
4. The rung that the PWM is on is solved false.
5. The PWM instruction is IDLE.
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.
Pulse Width Modulation
(PWM) Function File
Within the PWM function file are two PWM elements. Each element can be set to
control either output 2 (O0:0/2 on 1762-L24BXB, 1762-L40BXB, and
1764-28BXB) or output 3 (O0:0/3 on 1764-28BXB only). Function file element
PWM:0 is shown below.
TIP PWM st at us i s onl y as f resh as t he scan t i me of t he cont rol l er. Worst case
l at ency i s t he maxi mum scan of t he cont rol l er. Thi s condi t i on can be
mi ni mi zed by pl aci ng a PWM i nst ruct i on i n t he STI (sel ect abl e t i med
i nt errupt ) f i l e, or by addi ng PWM i nst ruct i ons t o your program t o i ncrease
how of t en a PWM i nst ruct i on i s scanned.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 139
Pulse Width Modulated
Function File Elements
Summary
The variables within each PWM element, along with what type of behavior and
access the control program has to those variables, are listed individually below.
PWM Output (OUT)
The PWM OUT (Output) variable defines the physical output that the PWM
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 or O0:0/3 as listed below:
O0:0.0/2: PWM modulates output 2 of the embedded outputs
(1762-L24BXB, 1762-L40BXB, and 1764-28BXB)
O0:0.0/3: PWM modulates output 3 of the embedded outputs
(1764-28BXB only)
Element Description Address Data Format Range Type User Program
Access
For More
Information
OUT - PWM Out put PWM :0.OUT word (INT) 2 or 3 st at us read onl y 139
DS - Decel erat i ng St at us PWM :0/ DS bi t 0 or 1 st at us read onl y 140
RS - PWM Run St at us PWM :0/ RS bi t 0 or 1 st at us read onl y 140
AS - Accel erat i ng St at us PWM :0/ AS bi t 0 or 1 st at us read onl y 140
PP - Prof i l e Paramet er Sel ect PWM :0/ PP bi t 0 or 1 cont rol read/ wri t e 141
IS - PWM Idl e St at us PWM :0/ IS bi t 0 or 1 st at us read onl y 141
ED - PWM Error Det ect i on PWM :0/ ED bi t 0 or 1 st at us read onl y 141
NS - PWM Normal Operat i on PWM :0/ NS bi t 0 or 1 st at us read onl y 142
EH - PWM Enabl e Hard St op PWM :0/ EH bi t 0 or 1 cont rol read/ wri t e 142
ES - PWM Enabl e St at us PWM :0/ ES bi t 0 or 1 st at us read onl y 142
OF - PWM Out put Frequency PWM :0.OF word (INT) 0 t o 20,000 cont rol read/ wri t e 143
OFS - PWM Operat i ng Frequency St at us PWM :0.OFS word (INT) 0 t o 20,000 st at us read onl y 143
DC - PWM Dut y Cycl e PWM :0.DC word (INT) 1 t o 1000 cont rol read/ wri t e 143
DCS - PWM Dut y Cycl e St at us PWM :0.DCS word (INT) 1 t o 1000 st at us read onl y 144
ADD - Accel / Decel Del ay PWM :0.ADD word (INT) 0 t o 32,767 cont rol read/ wri t e 144
ER - PWM Error Codes PWM :0.ER word (INT) -2 t o 5 st at us read onl y 144
Element
Description
Address Data
Format
Range Type User ProgramAccess
OUT - PWM Out put PWM :0.OUT word (INT) 2 or 3 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
140 Usi ng Hi gh-Speed Out put s
PWM Decelerating Status (DS)
The PWM DS (Decel) bit is controlled by the PWM 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 PWM output is within the deceleration phase of the
output profile.
Cleared (0) - Whenever a PWM output is not within the deceleration phase
of the output profile.
PWM Run Status (RS)
The PWM RS (Run Status) bit is controlled by the PWM sub-system. It can be
used by an input instruction on any rung within the control program.
Set (1) - Whenever the PWM instruction is within the run phase of the
output profile.
Cleared (0) - Whenever the PWM instruction is not within the run phase of
the output profile.
PWM Accelerating Status (AS)
The PWM AS (Accelerating Status) bit is controlled by the PWM sub-system. It
can be used by an input instruction on any rung within the control program. The
AS bit operates as follows:
Set (1) - Whenever a PWM output is within the acceleration phase of the
output profile.
Cleared (0) - Whenever a PWM output is not within the acceleration phase
of the output profile.
Element Description Address Data Format Range Type User Program
Access
DS - Decel erat i ng St at us PWM :0/ DS bi t 0 or 1 st at us read onl y
Element Description Address Data Format Range Type User Program
Access
RS - PWM Run St at us PWM :0/ RS bi t 0 or 1 st at us read onl y
Element Description Address Data Format Range Type User Program
Access
AS - Accel erat i ng St at us PWM :0/ AS bi t 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 141
PWM Profile Parameter Select (PP)
The PWM PP (Profile Parameter Select) selects which component of the
waveform is modified during a ramp phase:
Set (1) - selects Frequency
Cleared (0) - selects Duty Cycle
The PWM PP bit cannot be modified while the PWM output is running/enabled.
See PWM ADD on page 144 for more information.
PWM Idle Status (IS)
The PWM IS (Idle Status) is controlled by the PWM sub-system and represents no
PWM activity. It can be used in the control program by an input instruction.
Set (1) - PWM sub-system is in an idle state.
Cleared (0) - PWM sub-system is not in an idle state (it is running).
PWM Error Detected (ED)
The PWM ED (Error Detected) bit is controlled by the PWM sub-system. It can
be used by an input instruction on any rung within the control program to detect
when the PWM instruction is in an error state. If an error state is detected, the
specific error is identified in the error code register (PWM:0.ED).
Set (1) - Whenever a PWM instruction is in an error state.
Cleared (0) - Whenever a PWM instruction is not in an error state.
Element Description Address Data Format Range Type User Program
Access
PP - Prof i l e Paramet er Sel ect PWM :0/ PP bi t 0 or 1 cont rol read/ w ri t e
Element Description Address Data Format Range Type User Program
Access
IS - PWM Idl e St at us PWM :0/ IS bi t 0 or 1 st at us read onl y
Element Description Address Data
Format
Range Type User Program
Access
ED - PWM Error Det ect i on PWM :0/ ED bi t 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
142 Usi ng Hi gh-Speed Out put s
PWM Normal Operation (NS)
The PWM NS (Normal Operation) bit is controlled by the PWM sub-system. It
can be used by an input instruction on any rung within the control program to
detect when the PWM is in its normal state. A normal state is defined as ACCEL,
RUN, or DECEL with no PWM errors.
Set (1) - Whenever a PWM instruction is in its normal state.
Cleared (0) - Whenever a PWM instruction is not in its normal state.
PWM Enable Hard Stop (EH)
The PWM EH (Enable Hard Stop) bit stops the PWM sub-system immediately. A
PWM hard stop generates a PWM sub-system error.
Set (1) - Instructs the PWM sub-system to stop its output modulation
immediately (output off = 0).
Cleared (0) - Normal operation.
PWM Enable Status (ES)
The PWM ES (Enable Status) is controlled by the PWM sub-system. When the
rung preceding the PWM instruction is solved true, the PWM instruction is
enabled, and the enable status bit is set. When the rung preceding the PWM
instruction transitions to a false state, the enable status bit is reset (0) immediately.
Set (1) - PWM is enabled.
Cleared (0) - PWM has completed or the rung preceding the PWM is false.
Element Description Address Data
Format
Range Type User Program
Access
NS - PWM Normal Operat i on PWM :0/ NS bi t 0 or 1 st at us read onl y
Element Description Address Data
Format
Range Type User Program
Access
EH - PWM Enabl e Hard St op PWM :0/ EH bi t 0 or 1 cont rol read/ wri t e
Element Description Address Data Format Range Type User Program
Access
ES - PWM Enabl e St at us PWM :0/ ES bi t 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 143
PWM Output Frequency (OF)
The PWM OF (Output Frequency) variable defines the frequency of the PWM
function. This frequency can be changed at any time.
PWM Operating Frequency Status (OFS)
The PWM OFS (Output Frequency Status) is generated by the PWM sub-system
and can be used in the control program to monitor the actual frequency produced
by the PWM sub-system.
PWM Duty Cycle (DC)
The PWM DC (Duty Cycle) variable controls the output signal produced by the
PWM 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)
Element Description Address Data
Format
Range Type User Program
Access
OF - PWM Out put Frequency PWM :0.OF word (INT) 0 t o 20,000 cont rol read/ wri t e
Element Description Address Data
Format
Range Type User Program
Access
OFS - PWM Operat i ng
Frequency St at us
PWM :0.OFS word (INT) 0 t o 20,000 st at us read onl y
Element Description Address Data Format Range Type User Program
Access
DC - PWM Dut y Cycl e PWM :0.DC word (INT) 1 t o 1000 cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
144 Usi ng Hi gh-Speed Out put s
PWM Duty Cycle Status (DCS)
The PWM DCS (Duty Cycle Status) provides feedback from the PWM sub-system.
The Duty Cycle Status variable can be used within an input instruction on a rung
of logic to provide PWM system status to the remaining control program.
PWM Accel/Decel Delay (ADD)
PWM ADD (Accel/Decel Delay) defines the amount of time in 10 millisecond
intervals to ramp from zero to the specified frequency or duration. Also specifies
the time to ramp down to zero.
The PWM ADD value is loaded and activated immediately (whenever the PWM
instruction is scanned on a true rung of logic). This allows multiple steps or stages
of acceleration or deceleration to occur.
PWM Error Code (ER)
PWM ER (Error Codes) detected by the PWM sub-system are displayed in this
register. The table identifies known errors.
Element Description Address Data
Format
Range Type User Program
Access
DCS - PWM Dut y Cycl e St at us PWM :0.DCS word (INT) 1 t o 1000 st at us read onl y
Element Description Address Data Format Range Type User Program
Access
ADD - Accel / Decel Del ay PWM :0.ADD w ord (INT) 0 t o 32,767 cont rol read/ wri t e
Element Description Address Data Format Range Type User Program
Access
ER - PWM Error Codes PWM :0.ER w ord (INT) -2 t o 5 st at us read onl y
Error
Code
Non-User
Fault
Recoverable
Fault
Instruction
Errors
Error
Name
Description
-2 Yes No No Overl ap
Error
An out put overl ap i s det ect ed. M ul t i pl e f unct i ons are assi gned t o t he same
physi cal out put . Thi s i s a conf i gurat i on error. The cont rol l er f aul t s and t he
User Faul t Rout i ne does not execut e. Exampl e: PWM 0 and PWM 1 are bot h
at t empt i ng t o use a si ngl e out put .
-1 Yes No No Out put
Error
An i nval i d out put has been speci f i ed. Out put 2 and out put 3 are t he onl y val i d
choi ces. Thi s i s a conf i gurat i on error. The cont rol l er f aul t s and t he User Faul t
Rout i ne does not execut e.
0 Normal Normal (0 = no error present )
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Hi gh-Speed Out put s 145
1 No No Yes Hardst op
Error
Thi s error i s generat ed whenever a hardst op i s det ect ed. Thi s error does not
f aul t t he cont rol l er. It i s aut omat i cal l y cl eared when t he hardst op condi t i on i s
removed.
2 No No Yes Out put
Forced
Error
The conf i gured PWM out put (2 or 3) i s current l y f orced. The f orced condi t i on
must be removed f or t he PWM t o operat e. Thi s error does not f aul t t he
cont rol l er. It i s aut omat i cal l y cl eared when t he f orce condi t i on i s removed.
3 Yes Yes No Frequency
Error
The f requency val ue i s l ess t han 0 or great er t han 20,000. Thi s error f aul t s
t he cont rol l er. It can be cl eared by l ogi c wi t hi n t he User Faul t Rout i ne.
4 Reserved
5 Yes Yes No Dut y Cycl e
Error
The PWM dut y cycl e i s ei t her l ess t han zero or great er t han 1000.
Thi s error f aul t s t he cont rol l er. It can be cl eared by l ogi c wi t hi n t he User Faul t
Rout i ne.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
146 Usi ng Hi gh-Speed Out put s
Notes:
147 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 7
Relay-Type (Bit) Instructions
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.
XIC - Examine if Closed
XIO - Examine if Open
Instruction Type: input
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)
Instruction Used To: Page
XIC - Exami ne i f Cl osed Exami ne a bi t f or an ON condi t i on 147
XIO - Exami ne i f Open Exami ne a bi t f or an OFF condi t i on 147
OTE - Out put Enabl e Turn ON or OFF a bi t (non-ret ent i ve) 148
OTL - Out put Lat ch Lat ch a bi t ON (ret ent i ve) 149
OTU - Out put Unl at ch Unl at ch a bi t OFF (ret ent i ve) 149
ONS - One Shot Det ect an OFF t o ON t ransi t i on 150
OSR - One Shot Ri si ng Det ect an OFF t o ON t ransi t i on 151
OSF - One Shot Fal l i ng Det ect an ON t o OFF t ransi t i on 151
B3:0
0
B3:0
0
Execution Time for the XIC and XIO Instructions
Controller When Instruction Is:
True False
M i croLogi x 1200 0.9 s 0.8 s
M i croLogi x 1500 0.9 s 0.7 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
148 Rel ay-Type (Bi t ) Inst ruct i ons
The instructions operate as follows:
Addressing Modes and File Types can be used as shown in the following table:
OTE - Output Energize
Instruction Type: output
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.
XIO and XIC Instruction Operation
Rung State Addressed
Bit
XIC Instruction XIO Instruction
True Of f Ret urns a Fal se Ret urns a True
True On Ret urns a True Ret urns a Fal se
Fal se -- Inst ruct i on i s not eval uat ed Inst ruct i on i s not eval uat ed
XIC and XIO Instructions Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
2
)Address
Mode
(3)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Operand Bi t
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are onl y f or use wi t h M i croLogi x 1200 and 1500 BXB uni t s.
(2) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor.
(3) See Import ant not e about i ndi rect addressi ng.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
B3:0
1
Execution Time for the OTE Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 1.4 s 1.1 s
M i croLogi x 1500 1.2 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Rel ay-Type (Bi t ) Inst ruct i ons 149
Addressing Modes and File Types can be used as shown in the following table:
OTL - Output Latch
OTU - Output Unlatch
Instruction Type: output
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.
TIP A bi t t hat i s set wi t hi n a subrout i ne usi ng an OTE i nst ruct i on remai ns set
unt i l t he OTE i s scanned agai n.
ATTENTION: If you enabl e i nt errupt s duri ng t he program scan vi a an OTL,
OTE, or UIE, t hi s i nst ruct i on must be t he l ast i nst ruct i on execut ed on t he rung
(l ast i nst ruct i on on l ast branch). It i s recommended t hi s be t he onl y out put
i nst ruct i on on t he rung.
ATTENTION: Never use an out put address at more t han one pl ace i n your
l ogi c program. Al w ays be f ul l y aware of t he l oad represent ed by t he out put
coi l .
OTE Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
2
)Address
Mode
(3)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Dest i nat i on Bi t
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are onl y f or use wi t h M i croLogi x 1200 and 1500 BXB uni t s.
(2) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor.
(3) See Import ant not e about i ndi rect addressi ng.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
L
B3:0
1
U
B3:0
1
Execution Time for the OTL and OTU Instructions
Controller OTL - When Rung Is: OTU - When Rung Is:
True False True False
M i croLogi x 1200 1.0 s 0.0 s 1.1 s 0.0 s
M i croLogi x 1500 0.9 s 0.0 s 0.9 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
150 Rel ay-Type (Bi t ) Inst ruct i ons
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:
ONS - One Shot
Instruction Type: input
ATTENTION: If you enabl e i nt errupt s duri ng t he program scan vi a an OTL,
OTE, or UIE, t hi s i nst ruct i on must be t he l ast i nst ruct i on execut ed on t he rung
(l ast i nst ruct i on on l ast branch). It i s recommended t hi s be t he onl y out put
i nst ruct i on on t he rung.
ATTENTION: In t he event of a power l oss, any OTL cont rol l ed bi t (i ncl udi ng
f i el d devi ces) energi zes wi t h t he ret urn of power i f t he OTL bi t was set when
power was l ost .
ATTENTION: Under error condi t i ons, physi cal out put s are t urned of f . Once
t he error condi t i ons are cl eared, t he cont rol l er resumes operat i on usi ng t he
dat a t abl e val ue.
OTL and OTU Instructions Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are onl y f or use wi t h M i croLogi x 1200 and 1500
BXB uni t s.
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
2
)
(2) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor.
Address
Mode
(3)
(3) See Import ant not e about i ndi rect addressi ng.
Address
Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Operand Bi t
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
ONS
N7:1
0
Execution Time for the ONS Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 2.6 s 1.9 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Rel ay-Type (Bi t ) Inst ruct i ons 151
The ONS instruction is a retentive input instruction that triggers an event to occur
one time. After the false-to-true rung transition, the ONS instruction remains true
for one program scan. The output then turns OFF and remains OFF until the
logic preceding the ONS instruction is false (this re-activates the ONS instruction).
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:
OSR - One Shot Rising
OSF - One Shot Falling
Instruction Type: output
M i croLogi x 1500 2.2 s 1.7 s
TIP The ONS i nst ruct i on f or t he M i croLogi x 1200 and 1500 provi des t he same
f unct i onal i t y as t he OSR i nst ruct i on f or t he M i croLogi x 1000 and SLC 500
cont rol l ers.
ONS Instruction Operation
Rung Transition Storage Bit Rung State after Execution
f al se-t o-t rue (one scan) st orage bi t i s set t rue
t rue-t o-t rue st orage bi t remai ns set f al se
t rue-t o-f al se, f al se-t o-f al se st orage bi t i s cl eared f al se
Execution Time for the ONS Instructions
Controller When Rung Is:
True False
ONS Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
St orage Bi t
OSR
One Shot Ri si ng
St orage Bi t B3:0/ 0
Out put Bi t B3:0/ 1
OSR
OSF
One Shot Fal l i ng
St orage Bi t B3:0/ 0
Out put Bi t B3:0/ 1
OSF
Execution Time for the OSR and OSF Instructions
Controller OSR - When Rung Is: OSF - When Rung Is:
True False True False
M i croLogi x 1200 3.4 s 3.0 s 2.8 s 3.7 s
M i croLogi x 1500 3.2 s 2.8 s 2.7 s 3.4 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
152 Rel ay-Type (Bi t ) Inst ruct i ons
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:
TIP The OSR i nst ruct i on f or t he M i croLogi x 1200 and 1500 does not provi de t he
same f unct i onal i t y as t he OSR i nst ruct i on f or t he M i croLogi x 1000 and SLC
500 cont rol l ers. For t he same f unct i onal i t y as t he OSR i nst ruct i on f or t he
M i croLogi x 1000 and SLC 500 cont rol l ers, use t he ONS i nst ruct i on.
OSR Storage and Output Bit Operation
Rung State Transition Storage Bit Output Bit
f al se-t o-t rue (one scan) bi t i s set bi t i s set
t rue-t o-t rue bi t i s set bi t i s reset
t rue-t o-f al se and f al se-t o-f al se bi t i s reset bi t i s reset
OSF Storage and Output Bits Operation
Rung State Transition Storage Bit Output Bit
t rue-t o-f al se (one scan) bi t i s reset bi t i s set
f al se-t o-f al se bi t i s reset bi t i s reset
f al se-t o-t rue and t rue-t o-t rue bi t i s set bi t i s reset
OSR and OSF Instructions Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
St orage Bi t
Out put Bi t
153 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 8
Timer and Counter Instructions
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 87.
Timer Instructions
Overview
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
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 to 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 to 32767.
Timers can be set to any one of three time bases:
Instruction Used To: Page
TON - Ti mer, On-Del ay Del ay t urni ng on an out put on a t rue rung 155
TOF - Ti mer, Of f -Del ay Del ay t urni ng of f an out put on a f al se rung 156
RTO - Ret ent i ve Ti mer On Del ay t urni ng on an out put f rom a t rue rung.
The accumul at or i s ret ent i ve.
156
CTU - Count Up Count up 159
CTD - Count Down Count down 159
RES - Reset Reset t he RTO and count ers ACC and st at us
bi t s (not used w i t h TOF t i mers).
160
Timer Base Settings
Time Base Timing Range
0.001 seconds 0 t o 32.767 seconds
0.01 seconds 0 t o 327.67 seconds
1.00 seconds 0 t o 32,767 seconds
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
154 Ti mer and Count er Inst ruct i ons
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.
EN = Ti mer Enabl e Bi t
TT = Ti mer Ti mi ng Bi t
DN = Ti mer Done Bi t
Addressing Modes and File Types can be used as shown in the following table:
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 File
Word Bit
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 EN TT DN Int ernal Use
Word 1 Preset Val ue
Word 2 Accumul at ed Val ue
ATTENTION: Do not copy t i mer el ement s whi l e t he t i mer enabl e bi t (EN) i s
set . Unpredi ct abl e machi ne operat i on may occur.
Timer Instructions Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
(1)
(1) Val i d f or Ti mer Fi l es onl y.
Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address
Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Ti mer
Ti me Base
Preset
Accumul at or
TIP Use an RES i nst ruct i on t o reset a t i mers accumul at or and st at us bi t s.
Timer Accuracy
Time Base Accuracy
0.001 seconds -0.001 t o 0.00
0.01 seconds -0.01 t o 0.00
1.00 seconds -1.00 t o 0.00
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Ti mer and Count er Inst ruct i ons 155
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.
Repeating Timer Instructions
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.
TON - Timer, On-Delay
Instruction Type: output
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 instructions use the following control and status bits:
TIP Ti mi ng coul d be i naccurat e i f Jump (JM P), Label (LBL), Jump t o Subrout i ne
(JSR), or Subrout i ne (SBR) i nst ruct i ons ski p over t he rung cont ai ni ng a t i mer
i nst ruct i on w hi l e t he t i mer i s t i mi ng. If t he ski p durat i on i s wi t hi n 2.5
seconds, no t i me i s l ost ; i f t he ski p durat i on exceeds 2.5 seconds, an
undet ect abl e t i mi ng error occurs. When usi ng subrout i nes, a t i mer must be
scanned at l east every 2.5 seconds t o prevent a t i mi ng error.
EN
DN
TON
Ti mer On Del ay
Ti mer T4:0
Ti me Base 1.0
Preset 0<
Accum 0<
TON
Execution Time for the TON Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 18.0 s 3.0 s
M i croLogi x 1500 15.5 s 2.5 s
Timer Control and Status Bits, Timer Word 0(Data File 4is 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 accumul at ed val ue preset val ue rung st at e goes f al se
bit 14- T4:0/TT TT - timer timing rung st at e i s t rue and accumul at ed
val ue < preset val ue
rung st at e goes f al se
DN bi t i s set
bit15- T4:0/EN EN - timer enable rung st at e i s t rue rung st at e goes f al se
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
156 Ti mer and Count er Inst ruct i ons
TOF - Timer, Off-Delay
Instruction Type: output
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 instructions use the following control and status bits:
RTO - Retentive Timer,
On-Delay
Instruction Type: output
EN
DN
TOF
Ti mer Of f Del ay
Ti mer T4:0
Ti me Base 1.0
Preset 0<
Accum 0<
TOF
Execution Time for the TOF Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 2.9 s 13.0 s
M i croLogi x 1500 2.5 s 10.9 s
Timer Control and Status Bits, Timer Word 0(Data File 4is 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 condi t i ons are t rue rung condi t i ons go f al se and t he accumul at ed
val ue i s great er t han or equal t o t he preset
val ue
bit 14- T4:0/TT TT - timer timing rung condi t i ons are f al se and accumul at ed val ue
i s l ess t han t he preset val ue
rung condi t i ons go t rue or w hen t he done bi t i s
reset
bit15- T4:0/EN EN - timer enable rung condi t i ons are t rue rung condi t i ons go f al se
ATTENTION: Because t he RES i nst ruct i on reset s t he accumul at ed val ue and
st at us bi t s, do not use t he RES i nst ruct i on t o reset a t i mer address used i n a
TOF i nst ruct i on. If t he TOF accumul at ed val ue and st at us bi t s are reset ,
unpredi ct abl e machi ne operat i on may occur.
EN
DN
RTO
Ret ent i ve Ti mer On
Ti mer T4:0
Ti me Base 1.0
Preset 0<
Accum 0<
RTO
Execution Time for the RTO Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 18.0 s 2.4 s
M i croLogi x 1500 15.8 s 2.2 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Ti mer and Count er Inst ruct i ons 157
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.
Timer instructions use the following control and status bits:
To reset the accumulator of a retentive timer, use an RES instruction. See RES -
Reset on page 160.
How Counters Work
The figure below demonstrates how a counter works. The count value must remain
in the range of -32,768 to +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.
Counter Control and Status Bits, Timer Word 0(Data File 4is 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 accumul at ed val ue preset val ue t he appropri at e RES i nst ruct i on i s enabl ed
bit 14- T4:0/TT TT - timer timing rung st at e i s t rue and accumul at ed
val ue < preset val ue
rung st at e goes f al se, or
DN bi t i s set
bit15- T4:0/EN EN - timer enable rung st at e i s t rue rung st at e goes f al se
-32,768 +32,767 0
Overf l ow Underf l ow
Count er Accumul at or Val ue
Count Up
Count Down
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
158 Ti mer and Count er Inst ruct i ons
Using the CTU and CTD Instructions
Counter instructions use the following parameters:
Counter - This is the address of the counter within the data file. All counters
are 3-word data elements. Word 0 contains the Control and Status Bits,
Word 1 contains the Preset, and Word 2 contains the Accumulated Value.
CU = Count Up Enabl e Bi t
CD = Count Down Enabl e Bi t
DN = Count Done Bi t
OV = Count Overf l ow Bi t
UN = Count Underf l ow Bi t
Preset - When the accumulator reaches this value, the DN bit is set. The
preset data range is from -32768 to 32767.
Accumulator - The accumulator contains the current count. The
accumulator data range is from -32768 to 32767.
The accumulated value is incremented (CTU) or decremented (CTD) on
each false-to-true rung transition. The accumulated value is retained when
the rung condition again becomes false, and when power is cycled on the
controller. The accumulated count is retained until cleared by a reset (RES)
instruction that has the same address as the counter.
Addressing Modes and File Types can be used as shown in the following table:
Word Bit
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 CU CD DN OV UN Not Used
Word 1 Preset Val ue
Word 2 Accumul at ed Val ue
TIP The count er cont i nues t o count when t he accumul at or i s great er t han t he CTU
preset and when t he accumul at or i s l ess t han t he CTD preset .
CTD and CTU Instructions Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
(1)
(1) Val i d f or Count er Fi l es onl y.
Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address
Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Count er
Preset
Accumul at or
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Ti mer and Count er Inst ruct i ons 159
Using Counter File Control and Status Bits
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 Instruction Counter Control and Status Bits, Counter Word 0
(Data File 5is configured as a timer file for this example.)
Bit Is Set When: And Remains Set Until One of the Following
Occurs:
bit 12- C5:0/OV OV - overflow
indicator
t he accumul at ed val ue wraps f rom +32,767
t o -32,768 and cont i nues t o count up
a RES i nst ruct i on wi t h t he same address as t he CTU
i nst ruct i on i s enabl ed
bit 13- C5:0/DN DN - done
indicator
accumul at ed val ue preset val ue accumul at ed val ue < preset val ue or,
a RES i nst ruct i on wi t h t he same address as t he
CTU i nst ruct i on i s enabl ed
bit 15- C5:0/CU CU - count up
enable
rung st at e i s t rue rung st at e i s f al se
a RES i nst ruct i on wi t h t he same address as t he
CTU i nst ruct i on i s enabl ed
CTD Instruction Counter Control and Status Bits, Counter Word 0
(Data File 5is configured as a timer file for this example.)
Bit Is Set When: And Remains Set Until One of the Following
Occurs:
bit 11- C5:0/UN UN - underflow
indicator
t he accumul at ed val ue w raps f rom -32,768
t o +32,767 and cont i nues t o count down
a RES i nst ruct i on wi t h t he same address as t he CTD
i nst ruct i on i s enabl ed
bit 13- C5:0/DN DN - done
indicator
accumul at ed val ue preset val ue accumul at ed val ue < preset val ue or,
a RES i nst ruct i on wi t h t he same address as t he
CTU i nst ruct i on i s enabl ed
bit 14- C5:0/CD CD - count down
enable
rung st at e i s t rue rung st at e i s f al se
a RES i nst ruct i on wi t h t he same address as t he
CTD i nst ruct i on i s enabl ed
CU
DN
CTU
Count Up
Count er C5:0
Preset 0<
Accum 0<
CTU
CU
DN
CTU
Count Down
Count er C5:0
Preset 0<
Accum 0<
CTD
Execution Time for the CTU and CTD Instructions
Controller CTU - When Rung Is: CTD - When Rung Is:
True False True False
M i croLogi x 1200 9.0 s 9.2 s 9.0 s 9.0 s
M i croLogi x 1500 6.4 s 8.5 s 7.5 s 8.5 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
160 Ti mer and Count er Inst ruct i ons
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.
RES - Reset
Instruction Type: output
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:
TIP If t he si gnal i s comi ng f rom a f i el d devi ce wi red t o an i nput on t he cont rol l er,
t he on and of f durat i on of t he i ncomi ng si gnal must not be more t han t wi ce
t he cont rol l er scan t i me (assumi ng 50% dut y cycl e). Thi s condi t i on i s needed
t o enabl e t he count er t o det ect f al se-t o-t rue t ransi t i ons f rom t he i ncomi ng
devi ce.
RES
R6:0
Execution Time for the RES Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 5.9 s 0.0 s
M i croLogi x 1500 4.8 s 0.0 s
RES Instruction Operation
When using a RES instruction with a:
Timer Element Counter Element Control Element
The cont rol l er reset s t he:
ACC val ue t o 0
DN bi t
TT bi t
EN bi t
The cont rol l er reset s t he:
ACC val ue t o 0
OV bi t
UN bi t
DN bi t
CU bi t
CD bi t
The cont rol l er reset s t he:
POS val ue t o 0
EN bi t
EU bi t
DN bi t
EM bi t
ER bi t
UL bi t
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Ti mer and Count er Inst ruct i ons 161
Addressing Modes and File Types can be used as shown in the following table:
Because t he RES i nst ruct i on reset s t he accumul at ed val ue and st at us bi t s, do
not use t he RES i nst ruct i on t o reset a t i mer address used i n a TOF i nst ruct i on.
If t he TOF accumul at ed val ue and st at us bi t s are reset , unpredi ct abl e machi ne
operat i on or i nj ury t o personnel may occur.
RES Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address
Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
St ruct ure
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
162 Ti mer and Count er Inst ruct i ons
Notes:
163 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 9
Compare Instructions
Use these input instructions when you want to compare values of data.
Using the Compare
Instructions
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
chapter). Both sources cannot be immediate values. The valid data ranges for these
instructions are:
-32768 t o 32767 (w ord)
-2,147,483,648 t o 2,147,483,647 (l ong word)
Addressing Modes and File Types can be used as shown in the following table:
Instruction Used To: Page
EQU - Equal Test whet her t wo val ues are equal (=) 164
NEQ - Not Equal Test whet her one val ue i s not equal t o a
second val ue ()
164
LES - Less Than Test whet her one val ue i s l ess t han a second
val ue (<)
165
LEQ - Less Than or Equal To Test whet her one val ue i s l ess t han or equal
t o a second val ue ()
165
GRT - Great er Than Test whet her one val ue i s great er t han a
second val ue (>)
165
GEQ - Great er Than or Equal To Test w het her one val ue i s great er t han or
equal t o a second val ue ()
165
M EQ - M ask Compare f or Equal Test port i ons of t wo val ues t o see whet her
t hey are equal
166
LIM - Li mi t Test Test whet her one val ue i s wi t hi n t he range of
t wo ot her val ues
167
EQU, NEQ, GRT, LES, GEQ and LEQ Instructions
Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
2
)
Address
Mode
(3)
Address
Level
OISBT
,
C
,
R
NF
(
4
)
S
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
(
5
)
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source A
Source B
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
164 Compare Inst ruct i ons
When at least one of the operands is a Floating Data Point value:
For EQU, GEQ, GRT, LEQ, and LES - If either Source is not a number
(NAN), then rung state changes to false.
For NEQ - If either Source is not a number (NAN), then rung state remains
true.
EQU - Equal
NEQ - Not Equal
Instruction Type: input
The EQU instruction is used to test whether one value is equal to a second value.
The NEQ instruction is used to test whether one value is not equal to a
secondvalue.
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are onl y f or use wi t h M i croLogi x 1200 and 1500
BXB uni t s.
(2) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor.
(3) See Import ant not e about i ndi rect addressi ng.
(4) The F f i l e i s val i d f or M i croLogi x 1200 and 1500 Seri es C and hi gher cont rol l ers onl y.
(5) Onl y use t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or Source A i n GRT, LES, GEQ and LEQ i nst ruct i ons.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
EQU
Equal
Source A N7:0
0<
Source B N7:1
0<
EQU
NEQ
Not Equal
Source A N7:0
0<
Source B N7:1
0<
NEQ
Execution Time for the EQU and NEQ Instructions
Controller Instruction Data Size When Rung Is:
True False
M i croLogi x 1200 EQU w ord 1.3 s 1.1 s
l ong word 2.8 s 1.9 s
NEQ w ord 1.3 s 1.1 s
l ong word 2.5 s 2.7 s
M i croLogi x 1500 EQU w ord 1.2 s 1.1 s
l ong word 2.6 s 1.9 s
NEQ w ord 1.2 s 1.1 s
l ong word 2.3 s 2.5 s
EQU and NEQ Instruction Operation
Instruction Relationship of Source Values Resulting Rung State
EQU A = B t rue
A B f al se
NEQ A = B f al se
A B t rue
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Compare Inst ruct i ons 165
GRT - Greater Than
LES - Less Than
Instruction Type: input
The GRT instruction is used to test whether one value is greater than a second
value. The LES instruction is used to test whether one value is less than a
secondvalue.
GEQ - Greater Than or
Equal To
LEQ - Less Than or Equal
To
Instruction Type: input
GRT
Great er Than (A>B)
Source A N7:0
0<
Source B N7:1
0<
GRT
LES
Less Than (A<B)
Source A N7:0
0<
Source B N7:1
0<
LES
Execution Time for the GRT and LES Instructions
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 1.3 s 1.1 s
l ong word 2.8 s 2.7 s
M i croLogi x 1500 word 1.2 s 1.1 s
l ong word 2.6 s 2.5 s
GRT and LES Instruction Operation
Instruction Relationship of Source Values Resulting Rung State
GRT A > B t rue
A B f al se
LES A B f al se
A < B t rue
IMPORTANT Onl y use t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or Source A i n
GRT, LES, GEQ and LEQ i nst ruct i ons.
GEQ
Grt r Than or Eql (A>=B)
Source A N7:0
0<
Source B N7:1
0<
GEQ
LEQ
Less Than or Eql (A<=B)
Source A N7:0
0<
Source B N7:1
0<
LEQ
Execution Time for the GEQ and LEQ Instructions
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 1.3 s 1.1 s
l ong word 2.8 s 2.7 s
M i croLogi x 1500 word 1.2 s 1.1 s
l ong word 2.6 s 2.5 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
166 Compare Inst ruct i ons
The GEQ instruction is used to test whether one value is greater than or equal to a
second value. The LEQ instruction is used to test whether one value is less than or
equal to a second value.
MEQ - Mask Compare
for Equal
Instruction Type: input
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:
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:
-32768 to 32767 (word)
-2,147,483,648 to 2,147,483,647 (long word)
GEQ and LEQ Instruction Operation
Instruction Relationship of Source Values Resulting Rung State
GEQ A B t rue
A < B f al se
LEQ A > B f al se
A B t rue
IMPORTANT Onl y use t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or Source A i n
GRT, LES, GEQ and LEQ i nst ruct i ons.
M EQ
M asked Equal
Source N7:0
0<
M ask N7:1
0000h<
Compare N7:2
0<
M EQ
Execution Time for the MEQ Instructions
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 1.9 s 1.8 s
l ong word 3.9 s 3.1 s
M i croLogi x 1500 word 1.7 s 1.7 s
l ong word 3.5 s 2.9 s
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
M ask: M ask:
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
Int ermedi at e Resul t : Int ermedi at e Resul t :
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
Compari son of t he Int ermedi at e Resul t s: not equal
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Compare Inst ruct i ons 167
The mask is displayed as a hexadecimal unsigned value from 0000 to FFFF FFFF.
Addressing Modes and File Types can be used as shown in the following table:
LIM - Limit Test
Instruction Type: input
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.
The Low Limit, Test, and High Limit values can be word addresses or constants,
restricted to the following combinations:
MEQ Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are onl y f or use wi t h M i croLogi x 1200 and 1500
BXB uni t s.
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
2
)
(2) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor.
Address
Mode
(3)
(3) See Import ant not e about i ndi rect addressi ng.
Address
Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Mask
Compare
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
LIM
Li mi t Test
Low Li m N7:0
0<
Test 0
0<
Hi gh Li m N7:1
0<
LIM
Execution Time for the LIM Instructions
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 6.4 s 6.1 s
l ong w ord 14.4 s 13.6 s
M i croLogi x 1500 word 5.5 s 5.3 s
l ong w ord 12.2 s 11.7 s
LIM Instruction Operation Based on Low Limit, Test, and High Limit Values
When: And: Rung State
Low Li mi t Hi gh Li mi t Low Li mi t Test Hi gh Li mi t t rue
Low Li mi t Hi gh Li mi t Test < Low Li mi t or Test > Hi gh Li mi t f al se
Hi gh Li mi t < Low Li mi t Hi gh Li mi t < Test < Low Li mi t f al se
Hi gh Li mi t < Low Li mi t Test Hi gh Li mi t or Test Low Li mi t t rue
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
168 Compare Inst ruct i ons
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. But the Low Limit and High Limit parameters cannot both be
constants.
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.
The data ranges are:
-32768 to 32767 (word)
-2,147,483,648 to 2,147,483,647 (long word)
Addressing Modes and File Types can be used as shown in the following table:
LIM Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
2
)
Address
Mode
(3)
Address Level
OISBT
,
C
,
R
NF
(
4
)
S
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Low Li mi t
Test
Hi gh Li mi t
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are onl y f or use wi t h M i croLogi x 1200 and 1500 BXB uni t s.
(2) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor.
(3) See Import ant not e about i ndi rect addressi ng.
(4) The F f i l e i s val i d f or M i croLogi x 1200 and 1500 Seri es C and hi gher cont rol l ers onl y.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
169 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 10
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
Instructions
Use these output instructions to perform computations using an expression or a
specific arithmetic instruction.
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.
When using math instructions, observe the following:
Instruction Used To: Page
ADD - Add Add t w o val ues 174
SUB - Subt ract Subt ract t wo val ues 174
M UL - M ul t i pl y M ul t i pl y t w o val ues 175
DIV - Di vi de Di vi de one val ue by anot her 175
NEG - Negat e Change t he si gn of t he source val ue and pl ace i t
i n t he dest i nat i on
175
CLR - Cl ear Set al l bi t s of a word t o zero 176
ABS - Absol ut e Val ue Fi nd t he absol ut e val ue of t he source val ue 176
SQR - Square Root Fi nd t he square root of a val ue 180
SCL - Scal e Scal e a val ue 177
SCP - Scal e wi t h Paramet ers Scal e a val ue t o a range det ermi ned by creat i ng
a l i near rel at i onshi p
178
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
170 M at h Inst ruct i ons
Source and Destination can be different data sizes. Sources are evaluated at
the highest precision (word or long word) of the operands. Then the result is
converted to the size of the destination. If the signed value of the Source
does not fit in the Destination, the overflow shall be handled as follows:
If the Math Overflow Selection Bit is clear, a saturated result is stored in
the Destination. If the Source is positive, the Destination is +32767
(word) or +2,147,483,647 (long word). If the result is negative, the
Destination is -32768 (word) or -2,147,483,648 (long word).
If the Math Overflow Selection Bit is set, the unsigned truncated value of
the Source is stored in the Destination.
Sources can be constants or an address, but both sources cannot be
constants.
Valid constants are -32768 to 32767 (word) and -2,147,483,648 to
2,147,483,647 (long word).
Addressing Modes and File Types can be used as shown in the following table:
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).
Math Instructions (ADD, SUB, MUL, DIV, NEG, CLR) Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
2
)
Address
Mode
(3)
Address Level
OISBT
,
C
,
R
NF
(
4
)
S
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source A
Source B
Dest i nat i on
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are onl y f or use wi t h M i croLogi x 1200 and 1500 BXB uni t s.
(2) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor f or t he f ol l owi ng mat h i nst ruct i ons: ADD, SUB, M UL, DIV, NEG, and SCP.
(3) See Import ant not e about i ndi rect addressi ng.
(4) The F f i l e i s val i d f or M i croLogi x 1200 and 1500 Seri es C and hi gher cont rol l ers onl y.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Math Status Bits
With this Bit: The Controller:
S:0/0 Carry set s i f carry i s generat ed; ot herw i se reset s
S:0/1 Overf l ow set s when t he resul t of a mat h i nst ruct i on does not f i t i nt o t he
dest i nat i on, ot herwi se reset s
S:0/2 Zero Bi t set s i f resul t i s zero, ot herwi se reset s
S:0/3 Si gn Bi t set s i f resul t i s negat i ve (M SB i s set ), ot herwi se reset s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M at h Inst ruct i ons 171
Overflow Trap Bit, S:5/0
Minor error bit (S:5/0) is set upon detection of a mathematical overflow or
division by zero. If this bit is set upon execution of an END statement or a
Temporary End (TND) instruction, the recoverable major error code 0020 is
declared.
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
trapbit.
Using the Floating Point
(F) Data File
File Description
Floating point files contain IEEE-754 floating point data elements. One floating
point element is shown below. You can have up to 256 of these elements in each
floating point file.
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).
S:2/14 M at h Overf l ow
Sel ect ed
(1)
exami nes t he st at e of t hi s bi t t o det ermi ne t he val ue of t he
resul t when an overf l ow occurs
S:5/0
Overf l ow Trap
(1)
set s i f t he Overf l ow Bi t i s set , ot herwi se reset s
(1) Cont rol bi t s.
Math Status Bits
With this Bit: The Controller:
U
S:5
0
Floating Point Data File Structure
Floating Point Element
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
S
(1)
Exponent Val ue M ant i ssa
Hi gh Word Low Word
(1) S = Si gn Bi t
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
172 M at h Inst ruct i ons
Bits 23 to 30 are the exponent.
Bits 0 to 22 are the mantissa.
The value represented by a 32-bit floating point number (not one of the exception
values defined on page 172) 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:
s is the sign bit (0 or 1)
e is the exponent (1 to 254)
m is the mantissa (0 f < 1)
The valid range for floating point numbers is from -3.4028 x 10
38
to 3.4028 x 10
38
.
Definitions
Overflow - occurs when the result of an operation produces an exponent that is
greater than 254.
Underflow - occurs when the result of an operation produces an
exponent that is less than one.
Floating Point Exception Values
Zero - represented by an exponent and a mantissa of zero. Both positive and
negative zero are valid.
Denormalized - represented by an exponent of zero and a non-zero mantissa
part. Since denormalized numbers have very small, insignificant values, they are
treated as zero when used as source operand for most instructions. This reduces
execution time. Denormalized numbers are not generated by the instructions (but
are propagated by some instructions). Zero is generated on an underflow.
Infinity - represented by an exponent of 255 and a mantissa part of zero. Both
positive and negative infinity are generated when operations overflow. Infinity is
propagated through calculations.
NAN (not a number) - is represented by an exponent of 255 and a non-zero
mantissa part. NANs are used to indicate results that are mathematically undefined
such as 0/0 and adding plus infinity to minus infinity. All operations given a NAN
as input must generate a NAN as output.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M at h Inst ruct i ons 173
LSB Round-to-Even Rule
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.
Addressing Floating Point Files
The addressing format for floating point data files is shown below.
Programming Floating Point Values
The following table shows items to consider when using floating point data.
Format Explanation
Ff:e F Fl oat i ng Poi nt f i l e
f Fi l e number The val i d f i l e number range i s f rom 8 (def aul t ) t o 255.
: El ement del i mi t er
e El ement number The val i d el ement number range i s f rom 0 t o 255.
Examples: F8:2
F10:36
Floating Point File 8, Element 2
Floating Point File 10, Element 36
IMPORTANT These rul es do not appl y t o t he SCP i nst ruct i on. See page 179 f or t he rul es f or
t hat i nst ruct i on.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
174 M at h Inst ruct i ons
ADD - Add
SUB - Subtract
Instruction Type: output
Considerations When Using Floating Point Data
When at l east one of t he operands i s a Fl oat i ng Dat a Poi nt val ue:
If ei t her Source i s NAN, t hen t he resul t i s NAN.
Al l overf l ows resul t i n i nf i ni t y wi t h t he correct si gn.
Al l underf l ows resul t i n pl us zero.
Al l denormal i zed Source val ues are t reat ed as pl us zero.
Resul t s are al ways rounded usi ng t he Round t o Even rul e.
If Dest i nat i on i s an i nt eger and t he resul t i s NAN or i nf i ni t y, a sat urat ed resul t (-32768 or
+32767 f or word or -2,147,836,648 or +2,147,836,647 f or l ong w ord) i s st ored i n
Dest i nat i on and t he M at h Overf l ow Sel ect i on Bi t i s i gnored.
If Dest i nat i on i s an i nt eger, t he rounded resul t i s st ored. If an overf l ow occurs af t er roundi ng,
a sat urat ed resul t i s st ored i n Dest i nat i on and t he M at h Overf l ow Sel ect i on Bi t i s
i gnored. The sat urat ed resul t s are:
If Dest i nat i on i s an i nt eger and t he resul t i s posi t i ve, overf l ow Dest i nat i on i s +32767
(word) or +2,147,483, 648 (l ong w ord).
If Dest i nat i on i s an i nt eger and t he resul t i s negat i ve, overf l ow Dest i nat i on i s -32767
(word) or -2,147,483, 648 (l ong word).
Updat es t o M at h St at us Bi t s:
Carry - i s reset
Overf l ow - Is set i f t he resul t i s i nf i ni t y, NAN, or i f a conversi on t o i nt eger overf l ows;
ot herwi se i t i s reset .
Zero - Is set i f t he l ower 31 bi t s of t he Fl oat i ng Poi nt Dat a resul t i s al l zeros, ot herwi se i t i s
reset .
Si gn - Is set i f t he most si gni f i cant bi t of t he Dest i nat i on i s set (bi t 15 f or w ord, bi t 31 f or
l ong word or f l oat i ng poi nt dat a); ot herwi se i t i s reset .
Overf l ow Trap - The M at h Overf l ow Trap Bi t i s onl y set i f t he Overf l ow bi t i s set . Ot herwi se,
i t remai ns i n i t s l ast st at e.
ADD
Add
Source A N7:0
0<
Source B N7:1
0<
Dest N7:2
0<
ADD
SUB
Subt ract
Source A N7:0
0<
Source B N7:1
0<
Dest N7:2
0<
SUB
Execution Time for the ADD and SUB Instructions
Controller Instruction Data Size When Rung Is:
True False
M i croLogi x 1200 ADD word 2.7 s 0.0 s
l ong word 11.9 s 0.0 s
SUB word 3.4 s 0.0 s
l ong word 12.9 s 0.0 s
M i croLogi x 1500 ADD word 2.5 s 0.0 s
l ong word 10.4 s 0.0 s
SUB word 2.9 s 0.0 s
l ong word 11.2 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M at h Inst ruct i ons 175
Use the ADD instruction to add one value to another value (Source A + Source B)
and place the sum in the Destination.
Use the SUB instruction to subtract one value from another value (Source A -
Source B) and place the result in the Destination.
MUL - Multiply
DIV - Divide
Instruction Type: output
Use the MUL instruction to multiply one value by another value (Source A x
Source B) and place the result in the Destination.
Use the DIV instruction to divide one value by another value (Source A/Source B)
and place the result in the Destination. If the Sources are single words and the
Destination is directly addressed to S:13 (math register), then the quotient is stored
in S:14 and the remainder is stored in S:13. If long words are used, then the results
are rounded.
NEG - Negate
Instruction Type: output
Use the NEG instruction to change the sign of the Source and place the result in
the Destination.
M UL
M ul t i pl y
Source A N7:0
0<
Source B N7:1
0<
Dest N7:2
0<
M UL
DIV
Di vi de
Source A N7:0
0<
Source B N7:1
0<
Dest N7:2
0<
DIV
Execution Time for the MUL and DIV Instructions
Controller Instruction Data Size When Rung Is:
True False
M i croLogi x 1200 M UL word 6.8 s 0.0 s
l ong word 31.9 s 0.0 s
DIV word 12.2 s 0.0 s
l ong word 42.8 s 0.0 s
M i croLogi x 1500 M UL word 5.8 s 0.0 s
l ong word 27.6 s 0.1 s
DIV word 10.3 s 0.0 s
l ong word 36.7 s 0.0 s
NEG
Negat e
Source N7:0
0<
Dest N7:1
0<
NEG
Execution Time for the NEG Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 2.9 s 0.0 s
l ong w ord 12.1 s 0.0 s
M i croLogi x 1500 word 1.9 s 0.0 s
l ong w ord 10.4 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
176 M at h Inst ruct i ons
CLR - Clear
Instruction Type: output
Use the CLR instruction to set the Destination to a value of zero.
ABS - Absolute Value
Instruction Type: output
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 to 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.
CLR
Cl ear
Dest N7:0
0<
CLR
Execution Time for the CLR Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 1.3 s 0.0 s
l ong word 6.3 s 0.0 s
M i croLogi x 1500 word 1.2 s 0.0 s
l ong word 5.5 s 0.0 s
Execution Time for the ABS Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 3.8 s 0.0 s
M i croLogi x 1500 3.1 s 0.0 s
ABS
Absol ut e Val ue
Source N7:0
0<
Dest N7:1
0<
ABS
ABS Result Does Not Fit in Destination
When Both Operands Are Integers When At Least One Operand is Floating Point Data
If t he M at h Overf l ow Sel ect i on Bi t i s cl ear, a sat urat ed resul t
(32767 f or word or 2,147,836,647 f or l ong word) i s st ored i n
t he Dest i nat i on.
If t he M at h Overf l ow Sel ect i on Bi t i s set , t he unsi gned t runcat ed
val ue of t he resul t i s st ored i n t he Dest i nat i on.
The ABS i nst ruct i on cl ears t he si gn bi t . No operat i on i s
perf ormed on t he remai ni ng bi t s.
If Dest i nat i on i s an i nt eger and Source i s NAN or i nf i ni t y, a
sat urat ed resul t (32767 f or word or 2,147,836,647 f or l ong
word) i s st ored i n Dest i nat i on and t he M at h Overf l ow
Sel ect i on Bi t i s i gnored.
If Dest i nat i on i s an i nt eger, t he rounded resul t i s st ored. If an
overf l ow occurs af t er roundi ng, a sat urat ed resul t (32767 f or
word or 2,147,836,647 f or l ong word) i s st ored i n Dest i nat i on
and t he M at h Overf l ow Sel ect i on Bi t i s i gnored.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M at h Inst ruct i ons 177
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:
SCL - Scale
Instruction Type: output
The SCL instruction causes the value at the Source address to be multiplied by the
Rate (slope) value. The resulting value is added to the Offset and the rounded
result is placed in the Destination.
The following equations express the linear relationship between the input value
and the resulting scaled value:
Updates to Math Status Bits
When Both Operands Are Integers When At Least One Operand is Floating Point Data
Carry - Is set i f i nput i s negat i ve, ot herw i se reset s.
Overf l ow - Is set i f t he si gned resul t cannot f i t i n t he
Dest i nat i on; ot herw i se i t i s reset .
Zero - Is set i f Dest i nat i on i s al l zeros, ot herwi se i t i s reset .
Si gn - Is set i f t he most si gni f i cant bi t of t he Dest i nat i on i s set ,
ot herwi se i t i s reset .
Overf l ow Trap - The M at h Overf l ow Trap Bi t i s onl y set i f t he
Overf l ow bi t i s set . Ot herw i se, i t remai ns i n i t s l ast st at e.
Carry - Is reset .
Overf l ow - Is set i f t he si gned resul t i s i nf i ni t y, NAN, or cannot f i t
i n t he Dest i nat i on; ot herwi se i t i s reset .
Zero - Is set i f Dest i nat i on i s al l zeros, ot herw i se i t i s reset .
Si gn - Is set i f t he most si gni f i cant bi t of t he Dest i nat i on i s set ,
ot herwi se i t i s reset .
Overf l ow Trap - The M at h Overf l ow Trap Bi t i s onl y set i f t he
Overf l ow bi t i s set . Ot herwi se, i t remai ns i n i t s l ast st at e.
ABS Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 4-2.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
(1) See Import ant not e about i ndi rect addressi ng.
Address
Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
F
l
o
a
t
i
n
g
P
o
i
n
t
E
l
e
m
e
n
t
Source
Dest i nat i on
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, M G, PD, RTC, HSC, PTO, PWM ,
STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
SCL
Scal e
Source N7:0
0<
Rat e [/ 10000] N7:1
0<
Of f set N7:2
0<
Dest N7:3
0<
SCL
Execution Time for the SCL Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 10.5 s 0.0 s
M i croLogi x 1500 8.7 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
178 M at h Inst ruct i ons
scaled value = [(rate x source)/10000] + offset, where
rate = (scaled max. - scaled min.)/(input max. - input min.)
offset = scaled min. - (input min. x rate)
Rate and Offset can both be immediate values. The data range for rate and offset is
-32768 to 32767.
Addressing Modes and File Types can be used as shown in the following table:
SCP - Scale with
Parameters
Instruction Type: output
The SCP instruction produces a scaled output value that has a linear relationship
between the input and scaled values. This instruction solves the following equation
listed below to determine scaled output:
SCL Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
(1)
Mode
(1) See Import ant not e about i ndi rect addressi ng.
Address
Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Rat e
Of f set
Dest i nat i on
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
IMPORTANT Do not use t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or t he
Dest i nat i on paramet er i n t he SCL i nst ruct i on.
SCP
Scal e w/ Paramet ers
Input N7:0
0<
Input Mi n. N7:1
0<
Input Max. N7:2
0<
Scal ed M i n. N7:3
0<
Scal ed M ax. N7:4
0<
Out put N7:5
0<
SCP
Execution Time for the SCP Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 31.5 s 0.0 s
l ong word 52.2 s 0.0 s
M i croLogi x 1500 word 27.0 s 0.0 s
l ong word 44.7 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M at h Inst ruct i ons 179
y = [(y
1
- y
0
)/(x
1
- x
0
)](x - x
0
) + y
0
Addressing Modes and File Types can be used as shown in the following table:
Special Considerations when Using Floating Point Parameters
If any of the parameters (except Output) are NAN (not a number), Infinity, or
De-normalized; then the result is -NAN.
If y
1
- y
0
or x
1
- x
0
result in an overflow, then the result is -NAN
Other Considerations
If y
1
- y
0
= 0, the Result becomes the Scaled Start value
If x
1
- x
0
= 0 and x = x
0
, the Result becomes the Scaled Start value
If x
1
- x
0
= 0 and x does not equal x
0
, The Result becomes a negative overflow (for
integer values) or a negative NAN (for floating point values)
SCP Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(2)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Input (x)
Input M i n. (x
0
)
Input M ax. (x
1
)
Scal ed M i n. (y
0
)
Scal ed M ax. (y
1
)
Out put (y)
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are onl y recommended f or use wi t h M i croLogi x 1200 and 1500 BXB uni t s.
(2) See Import ant not e about i ndi rect addressi ng.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
IMPORTANT Do not use t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or t he Scal ed
Out put paramet er i n t he SCP i nst ruct i on.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
180 M at h Inst ruct i ons
SQR - Square Root
Instruction Type: output
The SQR instruction calculates the square root of the absolute value of the source
and places the rounded result in the destination.
The data ranges for the source is -32768 to 32767 (word) and -2,147,483,648 to
2,147,483,647 (long word). The Carry Math Status Bit is set if the source is
negative. See Updates to Math Status Bits on page 170 for more information.
SQR
Square Root
Source N7:0
0<
Dest N7:1
0<
SQR
Execution Time for the SQR Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 26.0 s 0.0 s
l ong word 30.9 s 0.0 s
M i croLogi x 1500 word 22.3 s 0.0 s
l ong word 26.0 s 0.0 s
SQR Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NS
T
FLM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Dest i nat i on
(1) See Import ant not e about i ndi rect addressi ng.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
181 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 11
Conversion Instructions
The conversion instructions multiplex and de-multiplex data and perform
conversions between binary and decimal values.
Using Decode and
Encode Instructions
Addressing Modes and File Types can be used as shown in the following table:
Instruction Used To: Page
DCD - Decode 4 t o 1-of -16 Decodes a 4-bi t val ue (0 t o 15), t urni ng on t he
correspondi ng bi t i n t he 16-bi t dest i nat i on.
182
ENC - Encode 1-of -16 t o 4 Encodes a 16-bi t source t o a 4-bi t val ue.
Searches t he source f rom t he l owest t o t he
hi ghest bi t and l ooks f or t he f i rst set bi t . The
correspondi ng bi t posi t i on i s wri t t en t o t he
dest i nat i on as an i nt eger.
182
FRD - Convert From Bi nary
Coded Deci mal
Convert s t he BCD source val ue t o an i nt eger and
st ores i t i n t he dest i nat i on.
184
TOD - Convert t o Bi nary Coded
Deci mal
Convert s t he i nt eger source val ue t o BCD f ormat
and st ores i t i n t he dest i nat i on.
187
Conversion Instructions Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Dest i nat i on
(1) See Import ant not e about i ndi rect addressi ng.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
182 Conversi on Inst ruct i ons
DCD - Decode 4 to
1-of-16
Instruction Type: output
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:
ENC - Encode 1-of-16
to 4
Instruction Type: output
DCD
Decode 4 t o 1 of 16
Source N7:0
0000h<
Dest N7:1
0000000000000000<
DCD
Execution Time for the DCD Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 1.9 s 0.0 s
M i croLogi x 1500 0.9 s 0.0 s
Decode 4to 1-of-16
Source Bits Destination Bits
15to 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
ENC
Encode 1 of 16 t o 4
Source N7:0
0000000000000000<
Dest N7:1
0000h<
ENC
Execution Time for the ENC Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 7.2 s 0.0 s
M i croLogi x 1500 6.8 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Conversi on Inst ruct i ons 183
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:
Updates to Math Status Bits
Encode 1-of-16to 4
Source Bits Destination Bits
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 15to 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 = det ermi nes t he st at e of t he f l ag
TIP If source i s zero, t he dest i nat i on i s zero and t he mat h st at us i s zero, t he f l ag
i s set t o 1.
Math Status Bits
With this Bit: The Controller:
S:0/0 Carry al ways reset s
S:0/1 Overf l ow set s i f more t han one bi t i n t he source i s set ; ot herwi se reset s. The mat h
overf l ow bi t (S:5/ 0) i s not set .
S:0/2 Zero Bi t set s i f resul t i s zero, ot herwi se reset s
S:0/3 Si gn Bi t al ways reset s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
184 Conversi on Inst ruct i ons
FRD - Convert from
Binary Coded Decimal
(BCD)
Instruction Type: output
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:
FRD Instruction Source Operand
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.
FRD
From BCD
Source S:0
0000h<
Dest N7:0
0<
FRD
Execution Time for the FRD Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 14.1 s 0.0 s
M i croLogi x 1500 12.3 s 0.0 s
FRD Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
(2)
Dest i nat i on
(1) See Import ant not e about i ndi rect addressi ng.
(2) See FRD Inst ruct i on Source Operand on page 184.
IMPORTANT You cannot use i ndi rect addressi ng w i t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Conversi on Inst ruct i ons 185
Updates to Math Status Bits
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.
Math Status Bits
With this Bit: The Controller:
S:0/0 Carry al ways reset s
S:0/1 Overf l ow set s i f non-BCD val ue i s cont ai ned at t he source or t he val ue t o be
convert ed i s great er t han 32,767; ot herwi se reset s. On overf l ow,
t he mi nor error f l ag i s al so set .
S:0/2 Zero Bi t set s i f resul t i s zero, ot herwi se reset s
S:0/3 Si gn Bi t al ways reset s
TIP Al ways provi de l adder l ogi c f i l t eri ng of al l BCD i nput devi ces pri or t o
perf ormi ng t he FRD i nst ruct i on. The sl i ght est di f f erence i n poi nt -t o-poi nt
i nput f i l t er del ay can cause t he FRD i nst ruct i on t o overf l ow due t o t he
conversi on of a non-BCD di gi t .
TIP To convert numbers l arger t han 9999 BCD, t he source must be t he M at h
Regi st er (S:13). You must reset t he M i nor Error Bi t (S:5.0) t o prevent an error.
]/ [
S:1
15
EQU
EQUAL
Source A N7:1
0
Source B I:0.0
0
M OV
M OVE
Source I:0.0
0
Dest N7:1
0
FRD
FROM BCD
Source I:0.0
0
Dest N7:2
0
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
186 Conversi on Inst ruct i ons
Exampl e
The BCD value 32,760 in the math register is converted and stored in N7:0. The
maximum source value is 32767 (BCD).
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.
Clearing S:14 before executing the FRD instruction is shown below:
FRD
From BCD
Source S:13
00032760<
Dest N7:0
32760<
FRD
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
3 2 7 6 0 N7:0Decimal 0111111111111000
TIP If t he mat h regi st er (S:13 and S:14) i s used as t he source f or t he FRD
i nst ruct i on and t he BCD val ue does not exceed f our di gi t s, be sure t o cl ear
word S:14 bef ore execut i ng t he FRD i nst ruct i on. If S:14 i s not cl eared and
a val ue i s cont ai ned i n t hi s word f rom anot her mat h i nst ruct i on l ocat ed
el sewhere i n t he program, an i ncorrect deci mal val ue i s pl aced i n t he
dest i nat i on word.
CLR
CLEAR
Dest S:14
0
FRD
FROM BCD
Source S:13
00001234
Dest N7:0
1234
M OV
M OVE
Source N7:2
4660
Dest S:13
4660
] [
I:1
0
0001 0010 0011 0100
0000 0100 1101 0010
S:13 and S:14 are
di spl ayed i n BCD f ormat .
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Conversi on Inst ruct i ons 187
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.
TOD - Convert to Binary
Coded Decimal (BCD)
Instruction Type: output
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:
TOD Instruction Destination Operand
The destination can be either a word address or math register.
The maximum values permissible once converted to BCD are:
9999 if the destination is a word address (allowing only a 4-digit BCD value)
32768 if the destination 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).
TOD
To BCD
Source N7:0
0<
Dest N7:1
0000h<
TOD
Execution Time for the TOD Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 17.2 s 0.0 s
M i croLogi x 1500 14.3 s 0.0 s
TOD Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
0
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFLM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Dest i nat i on
(2)
(1) See Import ant not e about i ndi rect addressi ng.
(2) See TOD Inst ruct i on Dest i nat i on Operand bel ow.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
188 Conversi on Inst ruct i ons
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.
Updates to Math Status Bits
Changes to the Math Register
Contains the 5-digit BCD result of the conversion. This result is valid at overflow.
Exampl e
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.
Math Status Bits
With this Bit: The Controller:
S:0/0 Carry al w ays reset s
S:0/1 Overf l ow set s i f BCD resul t i s l arger t han 9999. On overf l ow, t he mi nor error
f l ag i s al so set .
S:0/2 Zero Bi t set s i f resul t i s zero, ot herwi se reset s
S:0/3 Si gn Bi t set s i f t he source word i s negat i ve; ot herwi se reset s
TIP
To convert numbers l arger t han 9999 deci mal , t he dest i nat i on must be t he Mat h Regi st er
(S:13). You must reset t he M i nor Error Bi t (S:5/ 0) t o prevent an error.
TOD
To BCD
Source N7:3
9760<
Dest N10:0
9760<
TOD
9 7 6 0 N7:3 Decimal 0010 0110 0010 0000
9 7 6 0 N7:0 4-digit BCD 1001 0111 0110 0000
M SB LSB
The dest i nat i on val ue i s
di spl ayed i n BCD f ormat .
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Conversi on Inst ruct i ons 189
GCD - Gray Code
Instruction Type: output
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:
Updates to Math Status Bits
Execution Time for the GCD Instructions
Controller When Rung Is:
True False
M i croLogi x 1200 9.5 s 0.0 s
M i croLogi x 1500 8.2 s 0.0 s
GCD
Gray Code
Source I1:2.0
225<
Dest N7:1
190<
GCD
GCD Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 4-2.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Dest i nat i on
Math Status Bits
With this Bit: The Controller:
S:0/0 Carry al w ays reset
S:0/1 Overf l ow set i f t he Gray code i nput i s negat i ve, ot herwi se i s reset
S:0/2 Zero Bi t set i f t he dest i nat i on i s zero, ot herwi se reset
S:0/3 Si gn Bi t al w ays reset
S:5/0 Overf l ow Trap set i f t he Overf l ow Bi t i s set , ot herwi se reset
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
190 Conversi on Inst ruct i ons
Notes:
191 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 12
Logical Instructions
The logical instructions perform bit-wise logical operations on individual words.
Using Logical
Instructions
When using logical instructions, observe the following:
Source and Destination must be of the same data size (i.e. all words or all
long words).
Source A and Source B can be a constant or an address, but both cannot be
constants.
Valid constants are -32768 to 32767 (word) and -2,147,483,648 to
2,147,483,647 (long word).
Addressing Modes and File Types can be used as shown in the following table:
Instruction Used To: Page
AND - Bi t -Wi se AND Perf orm an AND operat i on 192
OR - Logi cal OR Perf orm an i ncl usi ve OR operat i on 193
XOR - Excl usi ve OR Perf orm an Excl usi ve Or operat i on 193
NOT - Logi cal NOT Perf orm a NOT operat i on 194
IMPORTANT Do not use t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or t he
Dest i nat i on paramet er i n t he AND, OR, and XOR i nst ruct i ons.
Logical Instructions Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
Function Files
(1)
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
2
)
Address
Mode
(3)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source A
Source B
(4)
Dest i nat i on
(1) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are val i d f or M i croLogi x 1200 and 1500 BXB uni t s.
(2) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor.
(3) See Import ant not e about i ndi rect addressi ng.
(4) Source B does not appl y t o t he NOT i nst ruct i on. The NOT i nst ruct i on onl y has one source val ue.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
192 Logi cal Inst ruct i ons
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).
AND - Bit-Wise AND
Instruction Type: output
The AND instruction performs a bit-wise logical AND of two sources and places
the result in the destination.
For more information, see Using Logical Instructions on page 191 and Updates to
Math Status Bits on page 192.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Math Status Bits
With this Bit: The Controller:
S:0/0 Carry al w ays reset s
S:0/1 Overf l ow al w ays reset s
S:0/2 Zero Bi t set s i f resul t i s zero, ot herwi se reset s
S:0/3 Si gn Bi t set s i f resul t i s negat i ve (M SB i s set ), ot herwi se reset s
AND
Bi t wi se AND
Source A N7:0
0000h<
Source B N7:1
0000h<
Dest N7:2
0000h<
AND
Execution Time for the AND Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 2.2 s 0.0 s
l ong word 9.2 s 0.0 s
M i croLogi x 1500 word 2.0 s 0.0 s
l ong word 7.9 s 0.0 s
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 t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or t he
Dest i nat i on paramet er i n t he AND, OR, and XOR i nst ruct i ons.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Logi cal Inst ruct i ons 193
OR - Logical OR
Instruction Type: output
The OR instruction performs a logical OR of two sources and places the result in
the destination.
XOR - Exclusive OR
Instruction Type: output
The XOR instruction performs a logical exclusive OR of two sources and places
the result in the destination.
OR
Bi t wi se Incl usi ve OR
Source A N7:0
0000h<
Source B N7:1
0000h<
Dest N7:2
0000h<
OR
Execution Time for the OR Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 2.2 s 0.0 s
l ong w ord 9.2 s 0.0 s
M i croLogi x 1500 word 2.0 s 0.0 s
l ong w ord 7.9 s 0.0 s
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 t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or t he
Dest i nat i on paramet er i n t he AND, OR, and XOR i nst ruct i ons.
XOR
Bi t wi se Excl usi ve OR
Source A N7:0
0000h<
Source B N7:1
0000h<
Dest N7:2
0000h<
XOR
Execution Time for the XOR Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 3.0 s 0.0 s
l ong w ord 9.9 s 0.0 s
M i croLogi x 1500 word 2.3 s 0.0 s
l ong w ord 8.9 s 0.0 s
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
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
194 Logi cal Inst ruct i ons
For more information, see Using Logical Instructions on page 191 and Updates to
Math Status Bits on page 192.
NOT - Logical NOT
Instruction Type: output
The NOT instruction is used to invert the source bit-by-bit (ones complement)
and then place the result in the destination.
For more information, see Using Logical Instructions on page 191 and Updates to
Math Status Bits on page 192.
Source: B
1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1
Destination:
0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1
IMPORTANT Do not use t he Hi gh Speed Count er Accumul at or (HSC.ACC) f or t he
Dest i nat i on paramet er i n t he AND, OR, and XOR i nst ruct i ons.
Truth Table for the XOR Instruction
NOT
NOT
Source N7:0
0<
Dest N7:1
0<
NOT
Execution Time for the NOT Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 2.4 s 0.0 s
l ong word 9.2 s 0.0 s
M i croLogi x 1500 word 2.4 s 0.0 s
l ong word 8.1 s 0.0 s
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
195 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 13
Move Instructions
The move instructions modify and move words.
MOV - Move
Instruction Type: output
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.
Using the MOV Instruction
When using the MOV instruction, observe the following:
Source and Destination can be different data sizes. The source is converted
to the destination size when the instruction executes. If the signed value of
the Source does not fit in the Destination, the overflow is handled as follows:
If the Math Overflow Selection Bit is clear, a saturated result is stored in
the Destination. If the Source is positive, the Destination is 32767 (word).
If the result is negative, the Destination is -32768.
If the Math Overflow Selection Bit is set, the unsigned truncated value of
the Source is stored in the Destination.
Source can be a constant or an address.
Valid constants are -32768 to 32767 (word) and -2,147,483,648 to
2,147,483,647 (long word).
Instruction Used to: Page
M OV - M ove M ove t he source val ue t o t he dest i nat i on. 195
M VM - M asked M ove M ove dat a f rom a source l ocat i on t o a sel ect ed
port i on of t he dest i nat i on.
197
M OV
M ove
Source N7:0
0<
Dest N7:1
0<
M OV
Execution Time for the MOV Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 2.4 s 0.0 s
l ong w ord 8.3 s 0.0 s
M i croLogi x 1500 word 2.3 s 0.0 s
l ong w ord 6.8 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
196 M ove Inst ruct i ons
Addressing Modes and File Types can be used as shown in the following table:
Updates to Math Status Bits
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).
MOV Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
(1)
Function Files
(2)
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
(
3
)
Address
Mode
(4)
Address Level
OISBT
,
C
,
R
NF
(
5
)
S
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Dest i nat i on
(6) (6) (6) (6)
(1) The ST f i l e i s not val i d f or M i croLogi x 1500 1764-LSP Seri es A processors.
(2) DAT f i l es are val i d f or t he M i croLogi x 1500 onl y. PTO and PWM f i l es are val i d f or M i croLogi x 1200 and 1500 BXB uni t s.
(3) The Dat a Log St at us f i l e can onl y be used by t he M i croLogi x 1500 1764-LRP Processor.
(4) See Import ant not e about i ndi rect addressi ng.
(5) The F f i l e i s val i d f or M i croLogi x 1200 and 1500 Seri es C and hi gher cont rol l ers onl y.
(6) Some el ement s can be wri t t en t o. Consul t t he f unct i on f i l e f or det ai l s.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Math Status Bits
With this Bit: The Controller:
S:0/0 Carry al ways reset s
S:0/1 Overf l ow set s when an overf l ow, i nf i ni t y, or NAN (not a number)
condi t i on i s det ect ed, ot herwi se reset s
S:0/2 Zero Bi t set s i f resul t i s zero, ot herwi se reset s
S:0/3 Si gn Bi t set s i f resul t i s negat i ve (M SB i s set ), ot herw i se reset s
S:5/0 M at h Overf l ow Trap
Bi t
(1)
(1) Cont rol bi t .
set s M at h Overf l ow Trap mi nor error i f t he Overf l ow bi t i s set ,
ot herw i se i t remai ns i n l ast st at e
TIP If you want t o move one word of dat a wi t hout af f ect i ng t he mat h f l ags, use a
copy (COP) i nst ruct i on wi t h a l engt h of 1 word i nst ead of t he M OV i nst ruct i on.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M ove Inst ruct i ons 197
MVM - Masked Move
Instruction Type: output
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
asfollows:
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.
Using the MVM Instruction
When using the MVM instruction, observe the following:
Source, Mask, and Destination must be of the same data size (i.e. all words
or all long words).
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.
M VM
M asked M ove
Source N7:0
0<
M ask N7:1
0000h<
Dest N7:2
0<
M VM
Execution Time for the MVM Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 7.8 s 0.0 s
l ong w ord 11.8 s 0.0 s
M i croLogi x 1500 word 7.2 s 0.0 s
l ong w ord 10.0 s 0.0 s
Mask Function for MVM Instruction
Source Bit Mask Bit Destination Bit
1 0 l ast st at e
0 0 l ast st at e
1 1 1
0 1 0
TIP Bi t s i n t he dest i nat i on t hat correspond t o zeros i n t he mask are not al t ered
as shown i n t he shaded areas i n t he f ol l owi ng t abl e.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
198 M ove Inst ruct i ons
Valid constants for the mask are -32768 to 32767 (word) and -2,147,483,648
to 2,147,483,647 (long word). The mask is displayed as a hexadecimal
unsigned value from 0000 0000 to FFFF FFFF.
Addressing Modes and File Types can be used as shown in the following table:
Updates to Math Status Bits
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).
Mask Example (Word Addressing Level)
Word Value in
Hexadecimal
Value in Binary
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Val ue i n Dest i nat i on
Bef ore M ove
FFFF 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Source Val ue 5555 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
M ask F0F0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
Val ue i n Dest i nat i on
Af t er M ove
5F5F 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1
MVM Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
(1)
Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(2)
Address Level
OISBT
,
C
,
R
NFS
T
L
(
3
)
M
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Mask
Dest i nat i on
(1) The ST f i l e i s not val i d f or M i croLogi x 1500 1764-LSP Seri es A processors.
(2) See Import ant not e about i ndi rect addressi ng.
(3) In earl i er f i rmware versi ons, when t he M VM i nst ruct i on was conf i gured t o execut e wi t h a Long Word Source val ue set t o zero, t he processor coul d pot ent i al l y l ose
communi cat i ons or hard f aul t . Thi s was correct ed i n M i croLogi x 1200 FRN 7 and M i croLogi x 1500 FRN 8 f i rmware.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Math Status Bits
With this Bit: The Controller:
S:0/0 Carry al w ays reset s
S:0/1 Overf l ow al w ays reset s
S:0/2 Zero Bi t set s i f dest i nat i on i s zero, ot herwi se reset s
S:0/3 Si gn Bi t set s i f t he M SB of t he dest i nat i on i s set , ot herwi se reset s
199 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 14
File Instructions
The file instructions perform operations on file data.
CPW - Copy Word
Instruction Type: output
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 PTO function file
Instruction Used To: Page
CPW - Copy Word Copy words of dat a f rom one l ocat i on t o anot her 199
COP - Copy Fi l e Copy a range of dat a f rom one f i l e l ocat i on t o
anot her
200
FLL - Fi l l Fi l e Load a f i l e wi t h a program const ant or a val ue
f rom an el ement address
201
BSL - Bi t Shi f t Lef t Load and unl oad dat a i nt o a bi t array one bi t at a
t i me
203
BSR - Bi t Shi f t Ri ght 204
FFL - Fi rst In, Fi rst Out (FIFO) Load Load words i nt o a f i l e and unl oad t hem i n t he
same order (f i rst i n, f i rst out )
206
FFU - Fi rst In, Fi rst Out (FIFO)
Unl oad
208
LFL - Last In, Fi rst Out (LIFO) Load Load words i nt o a f i l e and unl oad t hem i n reverse
order (l ast i n, f i rst out )
210
LFU - Last In, Fi rst Out (LIFO)
Unl oad
212
SWP - Swap
(M i croLogi x 1200 and 1500 Seri es
B and hi gher cont rol l ers onl y)
Swap l ow byt e wi t h hi gh byt e i n a speci f i ed
number of words
214
Execution Time for the CPW Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 Seri es C and hi gher onl y 18.3 s + 0.8 s/ word 0.0 s
M i croLogi x 1500 Seri es C and hi gher onl y 15.8 s + 0.7 s/ word 0.0 s
CPW
Copy Word
Source #HSC:0.2
Dest #N7:0
Lengt h 1
CPW
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
200 Fi l e Inst ruct i ons
Observe the following restrictions when using the CPW instruction:
The length of the data transferred cannot exceed 128 words.
Function files can be used for Source or Destination, but not both.
When referencing either a PLS file or a function file, addressing must be
specified to the sub-element level.
You can reference a sub-element of bits in a function file containing a
combination of read-only and read/write bits.
You cannot directly reference the high word of a long word as an operand in
the CPW instruction.
A Major fault (003F) is generated if the execution of the instruction exceeds
the data table space.
A Major fault (0044) is generated if a write attempt fails to the RTC function
file. This only occurs when attempting to write invalid data to the RTC
function file. Examples of invalid data are: setting the Day of Week to zero
or setting the Date to February 30th.
Addressing Modes and File Types are shown in the following table:
COP - Copy File
Instruction Type: output
CPW Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 4-2.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
(1) See Import ant not e about i ndi rect addressi ng.
Address
Level
OISBT
,
C
,
R
NF
(
2
)
(2) The F f i l e i s val i d f or M i croLogi x 1200 and 1500 Seri es C and hi gher cont rol l ers onl y.
S
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Dest i nat i on
Lengt h
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, M G, PD, RTC, HSC, PTO, PWM ,
STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
COP
Copy Fi l e
Source #N7:0
Dest #N7:1
Lengt h 1
COP
Execution Time for the COP Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 19.08 s + 0.8 s/ word 0.0 s
M i croLogi x 1500 15.9 s + 0.67 s/ word 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Fi l e Inst ruct i ons 201
The COP instruction copies blocks of data from one location into another.
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:
FLL - Fill File
Instruction Type: output
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.
COP Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files
(1)
Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(2)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Dest i nat i on
Lengt h
(1) The ST f i l e i s not val i d f or M i croLogi x 1500 1764-LSP Seri es A processors.
(2) See Import ant not e about i ndi rect addressi ng.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, M G, PD, RTC, HSC, PTO, PWM ,
STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
MaximumLengths for the COP Instruction
Source/Destination Data Type Range of Length Operand
1 word el ement s (i e. word) 1 t o 128
2 word el ement s (i e. l ong word) 1 t o 64
3 word el ement s (i e. count er) 1 t o 42
42 word el ement s (i e. st ri ng) 1 t o 3
FLL
Fi l l Fi l e
Source N7:0
Dest #N7:1
Lengt h 1
FLL
Execution Time for the FLL Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 14 + 0.6 s/ w ord 0.0 s
l ong w ord 15 + 1.2 s/ l ong word 0.0 s
M i croLogi x 1500 word 12.1 + 0.43 s/ w ord 0.0 s
l ong w ord 12.3 + 0.8 s/ l ong word 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
202 Fi l e Inst ruct i ons
This instruction uses the following operands:
Source - The source operand is the address of the value or constant used to
fill the destination. The data range for the source is from -32768 to 32767
(word) or -2,147,483,648 to 2,147,483,647 (long word), or any IEEE-754
32-bit value.
Destination - The starting destination address where the data is written.
Length - The length operand contains the number of elements. The length
can range from 1 to 128 (word), 1 to 64 (long word), or 1 to 42 (3 word
element such as counter).
Addressing Modes and File Types can be used as shown in the following table:
TIP A const ant cannot be used as t he source i n a t i mer (T), count er (C), or
cont rol (R) f i l e.
TIP The source and dest i nat i on operands must be of t he same f i l e t ype, unl ess
t hey are bi t (B) and i nt eger (N).
Dest i nat i on
Source
Word t o Fi l e
FLL Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NF
(
2
)
S
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Dest i nat i on
Lengt h
(1) See Import ant not e about i ndi rect addressi ng.
(2) The F f i l e i s val i d f or M i croLogi x 1200 and 1500 Seri es C and hi gher cont rol l ers onl y.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DATI, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Fi l e Inst ruct i ons 203
BSL - Bit Shift Left
Instruction Type: output
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.
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.
This instruction uses the following operands:
File - The file operand is the address of the bit array that is to be
manipulated.
Control - The control operand is the address of the BSLs control element.
The control element consists of 3 words:
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 to 2048.
EN
DN
BSL
Bi t Shi f t Lef t
Fi l e #B3:1
Cont rol R6:0
Bi t Address B32:0/ 0
Lengt h 1<
BSL
Execution Time for the BSL Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 32 s + 1.3 s/ word 1.3 s
M i croLogi x 1500 26.1 s + 1.06 s/ word 1.4 s
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0
EN
(1)
(1) EN - Enabl e Bi t i s set on f al se-t o-t rue t ransi t i on of t he rung and i ndi cat es t he i nst ruct i on i s enabl ed.
--
DN
(2)
(2) DN - Done Bi t , when set , i ndi cat es t hat t he bi t array has shi f t ed one posi t i on.
--
ER
(3)
(3) ER - Error Bi t , when set , i ndi cat es t hat t he i nst ruct i on det ect ed an error such as ent eri ng a negat i ve number f or t he
l engt h or source operand.
UL
(4)
(4) UL - Unl oad Bi t i s t he i nst ruct i ons out put . Avoi d usi ng t he UL (unl oad) bi t when t he ER (error) bi t i s set .
not used
Word 1 Si ze of bi t array (number of bi t s).
Word 2 not used
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
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
RESERVED 73 72 71 70 69 68 67 66 65 64
Dat a bl ock i s shi f t ed one bi t at
a t i me f rom bi t 16 t o bi t 73.
Source Bi t
I:22/ 12
58 Bi t Array #B3:1
Unl oad Bi t
(R6:0/ 10)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
204 Fi l e Inst ruct i ons
Addressing Modes and File Types can be used as shown in the following table:
BSR - Bit Shift Right
Instruction Type: output
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.
BSL Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Fi l e
Cont rol
(2)
Lengt h
Source
(1) See Import ant not e about i ndi rect addressi ng.
(2) Cont rol f i l e onl y. Not val i d f or Ti mers and Count ers.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DATI, TPI, CS, IOS, and DLS f i l es.
EN
DN
BSR
Bi t Shi f t Ri ght
Fi l e #B3:3
Cont rol R6:0
Bi t Address I:0/ 15
Lengt h 1<
BSR
Execution Time for the BSR Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 32 s + 1.3 s/ word 1.3 s
M i croLogi x 1500 26.1 s + 1.07 s/ word 1.4 s
Dat a bl ock i s shi f t ed one bi t at
a t i me f rom bi t 69 t o bi t 32.
Source Bi t
I:23/ 06
38 Bi t Array
#B3:2
Unl oad Bi t
(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
INVALID 69 68 67 66 65 64
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Fi l e Inst ruct i ons 205
This instruction uses the following operands:
File - The file operand is the address of the bit array that is to be
manipulated.
Control - The control operand is the address of the BSRs control element.
The control element consists of 3 words:
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 to 2048.
Addressing Modes and File Types can be used as shown in the following table:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0
EN
(1)
(1) EN - Enabl e Bi t i s set on f al se-t o-t rue t ransi t i on of t he rung and i ndi cat es t he i nst ruct i on i s enabl ed.
--
DN
(2)
(2) DN - Done Bi t , when set , i ndi cat es t hat t he bi t array has shi f t ed one posi t i on.
--
ER
(3)
(3) ER - Error Bi t , when set , i ndi cat es t hat t he i nst ruct i on det ect ed an error such as ent eri ng a negat i ve number f or t he
l engt h or source operand.
UL
(4)
(4) UL - Unl oad Bi t i s t he i nst ruct i ons out put . Avoi d usi ng t he UL (unl oad) bi t when t he ER (error) bi t i s set .
not used
Word 1 Si ze of bi t array (number of bi t s).
Word 2 not used
BSR Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFLS
T
M
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Fi l e
Cont rol
(2)
Lengt h
Source
(1) See Import ant not e about i ndi rect addressi ng.
(2) Cont rol f i l e onl y. Not val i d f or Ti mers and Count ers.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
206 Fi l e Inst ruct i ons
FFL - First In, First Out
(FIFO) Load
Instruction Type: output
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 instructions 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.
This instruction uses the following operands:
Source - The source operand is a constant or address of the value used to fill
the currently available position in the FIFO stack. The address level of the
source must match the FIFO stack. If FIFO is a word size file, source must
be a word value or constant. If FIFO is a long word size file, source must be
a long word value or constant. The data range for the source is from -32768
to 32767 (word) or -2,147,483,648 to 2,147,483,647 (long word).
EN
DN
EM
FFL
FIFO Load
Source N7:0
FIFO #N7:1
Cont rol R6:0
Lengt h 1<
Posi t i on 0<
FFL
Execution Time for the FFL Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 11.3 s 11.1 s
l ong word 11.7 s 11.2 s
M i croLogi x 1500 word 10.0 s 9.8 s
l ong word 10.9 s 9.7 s
(EU)
(EM )
(DN)
FFL
FIFO LOAD
Source N7:10
FIFO #N7:12
Cont rol R6:0
Lengt h 34
Posi t i on 9
FFU
FIFO UNLOAD
FIFO #N7:12
Dest N7:11
Cont rol R6:0
Lengt h 34
Posi t i on 9
(EN)
(DN)
(EM )
Destination Position
N7:11 N7:12 0
N7:13 1
FFU i nst ruct i on
unl oads dat a f rom
st ack #N7:12 at
posi t i on 0, N7:12
N7:14 2
3
4
5 34 words are al l ocat ed
f or FIFO st ack st art i ng
at N7:12, endi ng at
N7:45
6
7
Source 8
N7:10 9
FFL i nst ruct i on l oads
dat a i nt o st ack
#N7:12 at t he next
avai l abl e posi t i on, 9
i n t hi s case.
N7:45 33
Loading and Unloading of Stack #N7:12
FFL and FFU Instruction Pair
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Fi l e Inst ruct i ons 207
FIFO - The FIFO operand is the starting address of the stack.
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
3words:
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 to 128 (word) or 1 to 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 to 127 (word) or 0 to 63 (long word).
Addressing Modes and File Types can be used as shown in the following table:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0
EN
(1)
(1) EN - Enabl e Bi t i s set on f al se-t o-t rue t ransi t i on of t he rung and i ndi cat es t he i nst ruct i on i s enabl ed.
--
DN
(2)
(2) DN - Done Bi t , when set , i ndi cat es t hat t he st ack i s f ul l .
EM
(3)
(3) EM - Empt y Bi t , when set , i ndi cat es FIFO i s empt y.
not used
Word 1 Lengt h - maxi mum number of words or l ong words i n t he st ack.
Word 2 Posi t i on - t he next avai l abl e l ocat i on where t he i nst ruct i on l oads dat a.
FFL Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
FIFO
Cont rol
(2)
Lengt h
Posi t i on
(1) See Import ant not e about i ndi rect addressi ng.
(2) Cont rol f i l e onl y. Not val i d f or Ti mers or Count ers.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
208 Fi l e Inst ruct i ons
FFU - First In, First Out
(FIFO) Unload
Instruction Type: output
On a false-to-true rung transition, the FFU instruction unloads words or long
words from a user-created file called a FIFO stack. The data is unloaded using
first-in, first-out order. After the unload completes, the data in the stack is shifted
one element toward the top of the stack and the last element is zeroed out.
Instruction parameters have been programmed in the FFL - FFU instruction pair
shown below.
This instruction uses the following operands:
FIFO - The FIFO operand is the starting address of the stack.
Destination - The destination operand is a word or long word address that
stores the value which exits from the FIFO stack. The FFU instruction
unloads this value from the first location on the FIFO stack and places it in
the destination address. The address level of the destination must match the
EU
DN
EM
FFU
FIFO Unl oad
FIFO #N7:0
Dest N7:1
Cont rol R6:0
Lengt h 1<
Posi t i on 0<
FFU
Execution Time for the FFU Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 33 s + 0.8 s/ word 10.4 s
l ong word 36 s + 1.5 s/ l ong word 10.4 s
M i croLogi x 1500 word 27.7 s + 0.65 s/ word 9.7 s
l ong word 29.4 s + 1.25 s/ l ong word 9.7 s
(EU)
(EM )
(DN)
FFL
FIFO LOAD
Source N7:10
FIFO #N7:12
Cont rol R6:0
Lengt h 34
Posi t i on 9
FFU
FIFO UNLOAD
FIFO #N7:12
Dest N7:11
Cont rol R6:0
Lengt h 34
Posi t i on 9
(EN)
(DN)
(EM )
Destination Position
N7:11 N7:12 0
N7:13 1
FFU i nst ruct i on
unl oads dat a f rom
st ack #N7:12 at
posi t i on 0, N7:12
N7:14 2
3
4
5 34 words are al l ocat ed
f or FIFO st ack st art i ng
at N7:12, endi ng at
N7:45
6
7
Source 8
N7:10 9
FFL i nst ruct i on l oads
dat a i nt o st ack
#N7:12 at t he next
avai l abl e posi t i on, 9
i n t hi s case.
N7:45 33
Loading and Unloading of Stack #N7:12
FFL and FFU Instruction Pair
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Fi l e Inst ruct i ons 209
FIFO stack. If FIFO is a word size file, destination must be a word size file.
If FIFO is a long word size file, destination must be a long word size file.
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:
Length - The length operand contains the number of elements in the FIFO
stack. The length of the stack can range from 1 to 128 (word) or 1 to 64
(long word).
Position - Position is a component of the control register. The position can
range from 0 to 127 (word) or 0 to 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:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 --
EU
(1)
(1) EU - Enabl e Unl oad Bi t i s set on f al se-t o-t rue t ransi t i on of t he rung and i ndi cat es t he i nst ruct i on i s enabl ed.
DN
(2)
(2) DN - Done Bi t , when set , i ndi cat es t hat t he st ack i s f ul l .
EM
(3)
(3) EM - Empt y Bi t , when set , i ndi cat es FIFO i s empt y.
not used
Word 1 Lengt h - maxi mum number of w ords or l ong words i n t he st ack.
Word 2 Posi t i on - t he next avai l abl e l ocat i on where t he i nst ruct i on unl oads dat a.
FFU Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
FIFO
Dest i nat i on
Cont rol
(2)
Lengt h
Posi t i on
(1) See Import ant not e about i ndi rect addressi ng.
(2) Cont rol f i l e onl y. Not val i d f or Ti mers and Count ers.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
210 Fi l e Inst ruct i ons
LFL - Last In, First Out
(LIFO) Load
Instruction Type: output
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 instructions 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.
This instruction uses the following operands:
Source - The source operand is a constant or address of the value used to fill
the currently available position in the LIFO stack. The data size of the
source must match the LIFO stack. If LIFO is a word size file, source must
be a word value or constant. If LIFO is a long word size file, source must be
a long word value or constant. The data range for the source is from -32768
to 32767 (word) or -2,147,483,648 to 2,147,483,647 (long word).
LIFO - The LIFO operand is the starting address of the stack.
EN
DN
EM
LFL
LIFO Load
Source N7:0
LIFO #N7:1
Cont rol R6:0
Lengt h 1<
Posi t i on 0<
LFL
Execution Time for the LFL Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 25.5 s 10.4 s
l ong word 31.6 s 10.4 s
M i croLogi x 1500 word 22.2 s 9.7 s
l ong word 27.4 s 9.7 s
(DN)
(EN)
(DN)
(EM )
LFL
LIFO LOAD
Source N7:10
LIFO #N7:12
Cont rol R6:0
Lengt h 34
Posi t i on 9
(EU)
(EM )
LIFO UNLOAD
LIFO #N7:12
Dest N7:11
Cont rol R6:0
Lengt h 34
Posi t i on 9
LFU
Destination Position
N7:11 N7:12 0
N7:13 1
LFU i nst ruct i on
unl oads dat a f rom
st ack #N7:12 at
posi t i on 0, N7:12
N7:14 2
3
4
5 34 words are al l ocat ed
f or FIFO st ack st art i ng
at N7:12, endi ng at
N7:45
6
7
Source 8
N7:10 9
LFL i nst ruct i on l oads
dat a i nt o st ack
#N7:12 at t he next
avai l abl e posi t i on, 9
i n t hi s case.
N7:45 33
Loading and Unloading of Stack #N7:12
LFL and LFU Instruction Pair
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Fi l e Inst ruct i ons 211
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
3words:
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 to 128 (word) or 1 to 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 to 127 (word) or 0 to 63 (long word).
Addressing Modes and File Types can be used as shown in the following table:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0
EN
(1)
(1) EN - Enabl e Bi t i s set on f al se-t o-t rue t ransi t i on of t he rung and i ndi cat es t he i nst ruct i on i s enabl ed.
--
DN
(2)
(2) DN - Done Bi t , when set , i ndi cat es t hat t he st ack i s f ul l .
EM
(3)
(3) EM - Empt y Bi t , when set , i ndi cat es t hat LIFO i s empt y.
not used
Word 1 Lengt h - maxi mum number of words or l ong w ords i n t he st ack.
Word 2 Posi t i on - t he next avai l abl e l ocat i on where t he i nst ruct i on l oads dat a.
LFL Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
LIFO
Cont rol
(2)
Lengt h
Posi t i on
(1) See Import ant not e about i ndi rect addressi ng.
(2) Cont rol f i l e onl y. Not val i d f or Ti mers and Count ers.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
212 Fi l e Inst ruct i ons
LFU - Last In, First Out
(LIFO) Unload
Instruction Type: output
On a false-to-true rung transition, the LFU instruction unloads words or long
words from a user-created file called a LIFO stack. The data is unloaded using
last-in, first-out order. Instruction parameters have been programmed in the LFL -
LFU instruction pair shown below.
This instruction uses the following operands:
LIFO - The LIFO operand is the starting address of the stack.
Destination - The destination operand is a word or long word address that
stores the value which exits from the LIFO stack. The LFU instruction
unloads this value from the last location on the LIFO stack and places it in
the destination address. The address level of the destination must match the
LIFO stack. If LIFO is a word size file, destination must be a word size file.
If LIFO is a long word size file, destination must be a long word size file.
EU
DN
EM
LFU
LIFO Unl oad
LIFO #N7:0
Dest N7:1
Cont rol R6:0
Lengt h 1<
Posi t i on 0<
LFU
Execution Time for the LFU Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 29.1 s 10.4 s
l ong word 31.6 s 10.4 s
M i croLogi x 1500 word 25.6 s 9.7 s
l ong word 27.4 s 9.7 s
(DN)
(EN)
(DN)
(EM )
LFL
LIFO LOAD
Source N7:10
LIFO #N7:12
Cont rol R6:0
Lengt h 34
Posi t i on 9
(EU)
(EM )
LIFO UNLOAD
LIFO #N7:12
Dest N7:11
Cont rol R6:0
Lengt h 34
Posi t i on 9
LFU
Destination Position
N7:11 N7:12 0
N7:13 1
LFU i nst ruct i on
unl oads dat a f rom
st ack #N7:12 at
posi t i on 0, N7:12
N7:14 2
3
4
5 34 words are al l ocat ed
f or FIFO st ack st art i ng
at N7:12, endi ng at
N7:45
6
7
Source 8
N7:10 9
LFL i nst ruct i on l oads
dat a i nt o st ack
#N7:12 at t he next
avai l abl e posi t i on, 9
i n t hi s case.
N7:45 33
Loading and Unloading of Stack #N7:12
LFL and LFU Instruction Pair
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Fi l e Inst ruct i ons 213
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:
Length - The length operand contains the number of elements in the LIFO
stack. The length of the stack can range from 1 to 128 (word) or 1 to 64
(long word).
Position - This is the next location in the LIFO stack where data will be
unloaded. Position is a component of the control register. The position can
range from 0 to 127 (word) or 0 to 63 (long word). The position is
decremented after each unload.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0 --
EU
(1)
(1) EU - Enabl e Unl oad Bi t i s set on f al se-t o-t rue t ransi t i on of t he rung and i ndi cat es t he i nst ruct i on i s enabl ed.
DN
(2)
(2) DN - Done Bi t , when set , i ndi cat es t hat t he st ack i s f ul l .
EM
(3)
(3) EM - Empt y Bi t , when set , i ndi cat es LIFO i s empt y.
not used
Word 1 Lengt h - maxi mum number of words or doubl e words i n t he st ack.
Word 2 Posi t i on - t he next avai l abl e l ocat i on where t he i nst ruct i on unl oads dat a.
LFU Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
LIFO
Dest i nat i on
Cont rol
(2)
Lengt h
Posi t i on
(1) See Import ant not e about i ndi rect addressi ng.
(2) Cont rol f i l e onl y. Not val i d f or Ti mers and Count ers.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
214 Fi l e Inst ruct i ons
SWP - Swap
Instruction Type: output
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 to 128. For the string filetype, the length range is 1 to 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:
Example:
Source Val ue bef ore execut i ng SWP i nst ruct i on: 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 za b c d e f g
Source Val ue bef ore execut i ng SWP i nst ruct i on: b a d c f e h g j i l k n m p o r q t s v u x w zy a b c d e f g
The underlined characters show the 13 words where the low byte was swapped
with the high byte.
SWP
Swap
Source #ST10:1.DATA[0]
Lengt h 13
SWP
Execution Time for the SWP Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 Seri es B and hi gher 13.7 s + 2.2 s/ swapped word 0.0 s
M i croLogi x 1500 Seri es B and hi gher 11.7 s + 1.8 s/ swapped word 0.0 s
SWP Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
(1)
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Source
Lengt h
(1) See Import ant not e about i ndi rect addressi ng.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
SWP
Swap
Source #ST10:1.DATA[0]
Lengt h 13
SWP
215 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 15
Sequencer Instructions
Sequencer instructions are used to control automatic assembly machines or
processes that have a consistent and repeatable operation. They are typically time
based or event driven.
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.
The primary advantage of sequencer instructions is to conserve program memory.
These instructions monitor and control 16 (word) or 32 (long word) discrete
outputs at a time in a single rung.
You can use bit integer or double integer files with sequencer instructions.
SQC- Sequencer
Compare
Instruction Type: output
On a false-to-true rung transition, the SQC instruction is used to compare masked
source words or long words with the masked value at a reference address (the
sequencer file) for the control of sequential machine operations.
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.
Instruction Used To: Page
SQC - Sequencer Compare Compare 16-bi t dat a wi t h st ored dat a 215
SQO - Sequencer Out put Transf er 16-bi t dat a t o word addresses 218
SQL - Sequencer Load Load 16-bi t dat a i nt o a f i l e 221
EN
DN
FD
SQC
Sequencer Compare
Fi l e #B3:0
M ask N7:0
Source I:0.0
Cont rol R6:0
Lengt h 1<
Posi t i on 0<
SQC
Execution Time for the SQC Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 23.5 s 7.1 s
l ong w ord 26.3 s 7.1 s
M i croLogi x 1500 word 20.1 s 6.3 s
l ong w ord 22.7 s 6.3 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
216 Sequencer Inst ruct i ons
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.
Applications of the SQC instruction include machine diagnostics.
The following figure explains how the SQC instruction works.
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.
EN
DN
FD
SQC
Sequencer Compare
Fi l e #B10:11
M ask FFF0
Source I:3.0
Cont rol R6:21
Lengt h 4<
Posi t i on 2<
SQC
Input Word I:3.0
0010 0100 1001 1101
Mask Value FFF0
1111 1111 1111 0000
Sequencer Ref File #B10:11
Word Step
B10:11 0
B10:12 1
B10:13 0010 0100 1001 0000 2
B10:14 3
B10:15 4
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Sequencer Inst ruct i ons 217
This instruction uses the following operands:
File - This is the sequencer reference file. Its contents, on an
element-by-element basis, are masked and compared to the masked value
stored in source.
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 to 0xFFFF or 0 to 0xFFFFFFFF.
Source - This is the value that is compared to file.
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
3words:
Length - The length operand contains the number of steps in the sequencer
file (as well as Mask and/or Source if they are file data types). The length of
the sequencer can range from 1 to 256.
Position - This is the current location or step in the sequencer file (as well as
Mask and/or Source if they are file data types). It determines the next
location in the stack to receive the current comparison data. Position is a
component of the control register. The position can range from 0 to 255 for
words and 0 to 127 for long words. The position is incremented on each
false-to-true transition.
TIP If f i l e t ype i s word, t hen mask and source must be words. If f i l e t ype i s l ong
word, mask and source must be l ong words.
TIP If mask i s di rect or i ndi rect , t he posi t i on sel ect s t he l ocat i on i n t he
speci f i ed f i l e.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0
EN
(1)
(1) EN - Enabl e Bi t i s set by a f al se-t o-t rue rung t ransi t i on and i ndi cat es t hat t he i nst ruct i on i s enabl ed.
--
DN
(2)
(2) DN - Done Bi t i s set af t er t he i nst ruct i on has operat ed on t he l ast word i n t he sequencer f i l e. It i s reset on t he next
f al se-t o-t rue rung t ransi t i on af t er t he rung goes f al se.
--
ER
(3)
(3) ER - Error Bi t i s set when t he cont rol l er det ect s a negat i ve posi t i on val ue, or a negat i ve or zero l engt h val ue. When t he
ER bi t i s set , t he mi nor error bi t (S2:5/ 2) i s al so set .
not used
FD
(4)
(4) FD - Found bi t i s set when t he st at us of al l non-masked bi t s i n t he source address mat ch t hose of t he word i n t he
sequencer ref erence f i l e. Thi s bi t i s assessed each t i me t he SQC i nst ruct i on i s eval uat ed whi l e t he rung i s t rue.
not used
Word 1 Lengt h - cont ai ns t he number of st eps i n t he sequencer ref erence f i l e.
Word 2 Posi t i on - t he current posi t i on i n t he sequence
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
218 Sequencer Inst ruct i ons
Addressing Modes and File Types can be used as shown in the following table:
SQO- Sequencer Output
Instruction Type:output
On a false-to-true rung transition, the SQO instruction transfers masked source
reference words or long words to the destination for the control of sequential
machine operations. 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 to the destination address specified in the instruction.
Data is written to the destination word every time the instruction is executed.
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.
SQC Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Fi l e
Mask
Source
Cont rol
(2)
Lengt h
Posi t i on
(1) See Import ant not e about i ndi rect addressi ng.
(2) Cont rol f i l e onl y.
IMPORTANT You cannot use i ndi rect addressi ng w i t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
EN
DN
SQO
Sequencer Out put
Fi l e #B3:0
M ask N7:0
Dest N7:1
Cont rol R6:0
Lengt h 1<
Posi t i on 0<
SQO
Execution Time for the SQO Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 23.2 s 7.1 s
l ong word 26.6 s 7.1 s
M i croLogi x 1500 word 20.0 s 6.3 s
l ong word 23.1 s 6.3 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Sequencer Inst ruct i ons 219
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.
The following figure indicates how the SQO instruction works.
Destination O:14.0 External Outputs (O:14)
at Step 2
15 87 0 00
0000 0101 0000 1010 01 ON
02
Mask Value 0F0F 03 ON
15 87 0 04
0000 1111 0000 1111 05
06
Sequencer Output File #B10:1 07
Word Step 08 ON
B10:1 0000 0000 0000 0000 0 09
B10:2 1010 0010 1111 0101 1 10 ON
B10:3 1111 0101 0100 1010 2 Current Step 11
B10:4 0101 0101 0101 0101 3 12
B10:5 0000 1111 0000 1111 4 13
14
15
EN
DN
SQO
Sequencer Out put
Fi l e #B10:1
M ask 0F0F
Dest O14:0
Cont rol R6:20
Lengt h 4<
Posi t i on 2<
SQO
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
220 Sequencer Inst ruct i ons
This instruction uses the following operands:
File - This is the sequencer reference file. Its contents, on an
element-by-element, basis are masked and stored in the destination.
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 to 0xFFFF (word) or 0 to
0xFFFFFFFF (long word).
Destination - The destination operand is the sequencer location or file.
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
3words:
Length - The length operand contains the number of steps in the sequencer
file (as well as Mask and/or Destination if they are file data types). The
length of the sequencer can range from 1 to 256.
Position - This is the current location or step in the sequencer file (as well as
Mask and/or Destination if they are file data types). It determines the next
location in the stack to be masked and moved to the destination. Position is
a component of the control register. The position can range from 0 to 255.
Position is incremented on each false-to-true transition.
Addressing Modes and File Types can be used as shown in the following table:
TIP If f i l e t ype i s word, t hen mask and source must be words. If f i l e t ype i s l ong
word, mask and source must be l ong words.
TIP If mask i s di rect or i ndi rect , t he posi t i on sel ect s t he l ocat i on i n t he
speci f i ed f i l e.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0
EN
(1)
(1) EN - Enabl e Bi t i s set by a f al se-t o-t rue rung t ransi t i on and i ndi cat es t hat t he i nst ruct i on i s enabl ed.
--
DN
(2)
(2) DN - Done Bi t i s set af t er t he i nst ruct i on has operat ed on t he l ast word i n t he sequencer f i l e. It i s reset on t he next
f al se-t o-t rue rung t ransi t i on af t er t he rung goes f al se.
--
ER
(3)
(3) ER - Error Bi t i s set when t he cont rol l er det ect s a negat i ve posi t i on val ue, or a negat i ve or zero l engt h val ue. When t he
ER bi t i s set , t he mi nor error bi t (S2:5/ 2) i s al so set .
not used FD not used
Word 1 Lengt h - cont ai ns t he i ndex of t he l ast el ement i n t he sequencer ref erence f i l e
Word 2 Posi t i on - t he current posi t i on i n t he sequence
SQO Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
E
l
e
m
e
n
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
Fi l e
(2)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Sequencer Inst ruct i ons 221
SQL - Sequencer Load
Instruction Type: output
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.
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 -32768 to 32767 (word) or
-2,147,483,648 to 2,147,483,647 (long word).
M ask
(2)
Dest i nat i on
(2)
Cont rol
(3)
Lengt h
Posi t i on
(1) See Import ant not e about i ndi rect addressi ng.
(2) Fi l e Di rect and Fi l e Indi rect addressi ng al so appl i es.
(3) Cont rol f i l e onl y.
SQO Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
E
l
e
m
e
n
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
EN
DN
SQL
Sequencer Load
Fi l e #N7:0
Source I:0.0
Cont rol R6:0
Lengt h 1<
Posi t i on 0<
SQL
Execution Time for the SQL Instruction
Controller Data Size When Rung Is:
True False
M i croLogi x 1200 word 21.7 s 7.0 s
l ong w ord 24.3 s 7.1 s
M i croLogi x 1500 word 19.1 s 6.3 s
l ong w ord 21.1 s 6.3 s
TIP If f i l e t ype i s word, t hen mask and source must be words. If f i l e t ype i s l ong
word, mask and source must be l ong words.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
222 Sequencer Inst ruct i ons
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
3words:
Length - The length operand contains the number of steps in the sequencer
file (this is also the length of source if it is a file data type). The length of the
sequencer can range from 1 to 256.
Position - This is the current location or step in the sequencer file (as well as
source if it is a file data type). 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 to 255.
Addressing Modes and File Types can be used as shown in the following table:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word 0
EN
(1)
(1) EN - Enabl e Bi t i s set by a f al se-t o-t rue rung t ransi t i on and i ndi cat es t hat t he i nst ruct i on i s enabl ed.
--
DN
(2)
(2) DN - Done Bi t i s set af t er t he i nst ruct i on has operat ed on t he l ast word i n t he sequencer f i l e. It i s reset on t he next
f al se-t o-t rue rung t ransi t i on af t er t he rung goes f al se.
--
ER
(3)
(3) ER - Error Bi t i s set when t he cont rol l er det ect s a negat i ve posi t i on val ue, or a negat i ve or zero l engt h val ue. When t he
ER bi t i s set , t he mi nor error bi t (S2:5/ 2) i s al so set .
not used FD not used
Word 1 Lengt h - cont ai ns t he i ndex of t he l ast el ement i n t he sequencer ref erence f i l e
Word 2 Posi t i on - t he current posi t i on i n t he sequence
SQL Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
(1)
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Fi l e
(2)
Source
(2)
Cont rol
(3)
Lengt h
Posi t i on
(1) See Import ant not e about i ndi rect addressi ng.
(2) Fi l e Di rect and Fi l e Indi rect addressi ng al so appl i es.
(3) Cont rol f i l e onl y.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
223 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 16
ProgramControl Instructions
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.
J MP - J ump to Label
Instruction Type: output
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 to 999. The label is local to a
program file.
Instruction Used To: Page
JM P - Jump t o Label Jump f orward/ backward t o a correspondi ng
l abel i nst ruct i on
223
LBL - Label 224
JSR - Jump t o Subrout i ne Jump t o a desi gnat ed subrout i ne and ret urn 224
SBR - Subrout i ne Label 224
RET - Ret urn f rom Subrout i ne 225
SUS - Suspend Debug or di agnose your user program 225
TND - Temporary End Abort current l adder scan 225
END - Program End End a program or subrout i ne 226
M CR - M ast er Cont rol Reset Enabl e or i nhi bi t a mast er cont rol zone i n
your l adder program
226
JM P
Q2:0
Execution Time for the J MP Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 1.0 s 0.0 s
M i croLogi x 1500 1.0 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
224 Program Cont rol Inst ruct i ons
LBL - Label
Instruction Type: input
The LBL instruction is used in conjunction with a jump (JMP) instruction to
change the order of ladder execution. Jumps cause program execution to go to the
rung marked LBL label number.
The immediate data range for the label is from 0 to 999. The label is local to a
program file.
J SR - J ump to
Subroutine
Instruction Type: output
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 to 255.
SBR - Subroutine Label
Instruction Type: input
LBL
Q2:0
Execution Time for the LBL Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 1.0 s 1.0 s
M i croLogi x 1500 1.0 s 1.0 s
JSR
Jump To Subrout i ne
SBR Fi l e Number U:255
JSR
Execution Time for the J SR Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 8.4 s 0.0 s
M i croLogi x 1500 8.0 s 0.0 s
SBR
Subrout i ne
SBR
Execution Time for the SBR Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 1.0 s 1.0 s
M i croLogi x 1500 1.0 s 1.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Program Cont rol Inst ruct i ons 225
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.
RET - Return from
Subroutine
Instruction Type: output
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.
SUS - Suspend
Instruction Type: output
The SUS instruction is used to trap and identify specific conditions for program
debugging and system troubleshooting. This instruction causes the processor to
enter the suspend idle mode, causing all outputs to be de-energized. The suspend
ID and the suspend file (program file number or subroutine file number
identifying where the suspend instruction resides) are placed in the status file (S:7
and S:8).
The immediate data range for the suspend ID is from -32768 to 32767.
TND - Temporary End
Instruction Type: output
RET
Ret urn
RET
Execution Time for the RET Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 1.0 s 0.0 s
M i croLogi x 1500 1.0 s 0.0 s
SUS
Suspend
Suspend ID 1
SUS
TND
Execution Time for the TND Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 0.9 s 0.0 s
M i croLogi x 1500 1.0 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
226 Program Cont rol Inst ruct i ons
The TND instruction is used to denote a premature end-of-ladder program
execution. The TND instruction cannot be executed from a STI subroutine, HSC
subroutine, EII subroutine, or a user fault subroutine. This instruction may appear
more than once in a ladder program.
On a true rung, TND stops the processor from scanning the rest of the program
file. In addition, this instruction performs the output scan, input scan, and
housekeeping aspects of the processor scan cycle prior to resuming scanning at
rung 0 of the main program (file 2). If this instruction is executed in a nested
subroutine, it terminates execution of all nested subroutines.
END - ProgramEnd
Instruction Type: output
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.
MCR - Master Control
Reset
Instruction Type: output
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
setof 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
precededby 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.
END
M CR
Execution Time for the MCR Instructions
Controller Instruction When Rung Is:
True False
M i croLogi x 1200 M CR St art 1.2 s 1.2 s
M CR End 1.6 s 1.6 s
M i croLogi x 1500 M CR St art 0.8 s 0.8 s
M CR End 1.0 s 1.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Program Cont rol Inst ruct i ons 227
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
recipeapplications.
When you program MCR instructions, note that:
You must end the zone with an unconditional MCR instruction.
You cannot nest one MCR zone within another.
Do not jump into an MCR zone. If the zone is false, jumping into it activates
the zone.
TIP The M CR i nst ruct i on i s not a subst i t ut e f or a hard-wi red mast er cont rol rel ay
t hat provi des emergency st op capabi l i t y. You st i l l must i nst al l a hard-w i red
mast er cont rol rel ay t o provi de emergency I/ O power shut down.
If you st art i nst ruct i ons such as t i mers or count ers i n an M CR zone, i nst ruct i on
operat i on ceases when t he zone i s di sabl ed. Re-program cri t i cal operat i ons
out si de t he zone i f necessary.
0030
I:1
0
M CR
0031
0032
0033 M CR
Ladder Logi c wi t hi n M CR Zone
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
228 Program Cont rol Inst ruct i ons
Notes:
229 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 17
Input and Output Instructions
The input and output instructions allow you to selectively update data without
waiting for the input and output scans.
IIM - Immediate Input
with Mask
Instruction Type: output
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 = I0.1, word 1 of slot 0 is used, and so on.
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
Instruction Used To: Page
IIM - Immedi at e Input wi t h M ask Updat e dat a pri or t o t he normal i nput scan. 229
IOM - Immedi at e Out put wi t h
M ask
Updat e out put s pri or t o t he normal out put scan. 230
REF - I/ O Ref resh Int errupt t he program scan t o execut e t he
I/ O scan (wri t e out put s, servi ce
communi cat i ons, read i nput s)
231
IIM
Immedi at e Input w/ Mask
Sl ot I:0.0
M ask N7:0
Lengt h 1
IIM
TIP Thi s i nst ruct i on i s used f or embedded I/ O onl y. It i s not desi gned t o be used
wi t h expansi on I/ O.
Execution Time for the IIM Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 26.4 s 0.0 s
M i croLogi x 1500 22.5 s 0.0 s
IMPORTANT Sl ot 0 i s t he onl y val i d sl ot number t hat can be used wi t h t hi s i nst ruct i on.
IIM cannot be used wi t h expansi on I/ O.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
230 Input and Out put Inst ruct i ons
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 to 0xFFFF.
Length - This is the number of masked words to transfer to the
input data file.
Addressing Modes and File Types can be used as shown below:
IOM - Immediate Output
with Mask
Instruction Type: output
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.
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Real Input Input Word
M ask 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Input Dat a
Fi l e
Dat a i s Not Updat ed Updat ed t o M at ch Input Word
IIM Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Sl ot
Mask
Lengt h
IOM
Immedi at e Out put w/ Mask
Sl ot O:0.0
M ask N7:0
Lengt h 1
IOM
TIP Thi s i nst ruct i on i s used f or embedded I/ O onl y. It i s not desi gned t o be
used wi t h expansi on I/ O.
Execution Time for the IOM Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 22.3 s 0.0 s
M i croLogi x 1500 1764-LSP 18.4 s 0.0 s
M i croLogi x 1500 1764-LRP 19.4 s 0.0 s
IMPORTANT Sl ot 0 i s t he onl y val i d sl ot number t hat can be used wi t h t hi s i nst ruct i on.
IOM cannot be used wi t h expansi on I/ O.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Input and Out put Inst ruct i ons 231
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 to 0xFFFF.
Length - This is the number of masked words to transfer to the outputs.
Addressing Modes and File Types can be used as shown below:
REF - I/O Refresh
Instruction Type: output
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 push-button, DAT [MicroLogix 1500 only], and
comms housekeeping), and read inputs.
The REF instruction has no programming parameters. When it is evaluated
as true, the program scan is interrupted to execute the I/O scan and
service communication portions of the operating cycle. The scan then
resumes at the instruction following the REF instruction.
The REF instruction cannot be executed from an STI subroutine, HSC subroutine,
EII subroutine, or a user fault subroutine.
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Out put Dat a Out put Word
M ask 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Real Out put s Dat a i s Not Updat ed Updat ed t o M at ch Out put Word
IOM Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
E
l
e
m
e
n
t
Sl ot
M ask
Lengt h
REF
Execution Time for the REF Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 see p. 380 0.0 s
M i croLogi x 1500 see p. 386 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
232 Input and Out put Inst ruct i ons
TIP Usi ng an REF i nst ruct i on may resul t i n i nput dat a changi ng i n t he mi ddl e of
a program scan. Thi s condi t i on needs t o be eval uat ed when usi ng t he
REF i nst ruct i on.
ATTENTION: The wat chdog and scan t i mers are reset when execut i ng t he
REF i nst ruct i on. You must i nsure t hat t he REF i nst ruct i on i s not pl aced i nsi de a
non-t ermi nat i ng program l oop. Do not pl ace t he REF i nst ruct i on i nsi de a
program l oop unl ess t he program i s t horoughl y anal yzed.
233 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 18
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 233.
User Interrupt Instructions on page 237.
Using the Selectable Timed Interrupt (STI) Function File on page 242.
Using the Event Input Interrupt (EII) Function File on page 247.
See also: Using the High-Speed Counter and Programmable Limit Switch on page
87.
Information About Using
Interrupts
The purpose of this section is to explain some fundamental properties of the User
Interrupts, including:
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 1200 and MicroLogix 1500 support the
following User Interrupts:
User Fault Routine
Event Interrupts (4)
High-Speed Counter Interrupts
(1)
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:
(1) The M i croLogi x 1200 has one HSC Int errupt , HSC0. The M i croLogi x 1500 has t wo, HSC0 and HSC1.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
234 Usi ng Int errupt s
1. suspends its execution
2. performs a defined task based upon which interrupt occurred
3. returns to the suspended operation.
Specifically, if the controller program is executing normally and an interrupt
eventoccurs:
1. the controller stops its normal execution
2. determines which interrupt occurred
3. goes immediately to rung 0 of the subroutine specified for that
UserInterrupt
4. begins executing the User Interrupt subroutine (or set of subroutines if the
specified subroutine calls a subsequent subroutine)
5. completes the subroutine(s)
6. resumes normal execution from the point where the controller program was
interrupted
When Can the Controller Operation be Interrupted?
The Micrologix 1200 and 1500 controllers only allow interrupts to be serviced
during certain periods of a program scan. They are:
At the start of a ladder rung
Anytime during End of Scan
Between data words in an expansion I/O scan
The interrupt is only serviced by the controller at these opportunities. If the
interrupt is disabled, the pending bit is set at the next occurrence of one of the
three occasions listed above.
Program File 2
Program File 10
rung 0
rung 123
rung 275
Interrupt Operation Example
Program Fi l e 2 i s t he mai n cont rol program.
Program Fi l e 10 i s t he i nt errupt rout i ne.
An Int errupt Event occurs at rung 123.
Program Fi l e 10 i s execut ed.
Program Fi l e 2 execut i on resumes
i mmedi at el y af t er program f i l e 10 i s
scanned.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 235
Priority of User Interrupts
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.
If an interrupt occurs while a lower priority interrupt is being serviced (executed),
the currently executing interrupt routine is suspended, and the higher priority
interrupt is serviced. Then the lower priority interrupt is allowed to complete
before returning to normal processing.
If an interrupt occurs while a higher priority interrupt is being serviced (executed),
and the pending bit has been set for the lower priority interrupt, the currently
executing interrupt routine continues to completion. Then the lower priority
interrupt runs before returning to normal processing.
The priorities from highest to lowest are:
ATTENTION: If you enabl e i nt errupt s duri ng t he program scan vi a an OTL,
OTE, or UIE, t hi s i nst ruct i on (OTL, OTE, or UIE) must be t he l ast i nst ruct i on
execut ed on t he rung (l ast i nst ruct i on on l ast branch). It i s recommended t hi s
be t he onl y out put i nst ruct i on on t he rung.
User Faul t Rout i ne highest priority
Event Int errupt 0
Event Int errupt 1
Hi gh-Speed Count er Int errupt 0
Event Int errupt 2
Event Int errupt 3
Hi gh-Speed Count er Int errupt 1
(M i croLogi x 1500 onl y.)
Sel ect abl e Ti med Int errupt lowest priority
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
236 Usi ng Int errupt s
Interrupt Latency
Interrupt Latency is defined as the worst case amount of time elapsed from
whenan interrupt occurs to when the interrupt subroutine starts to execute. The
tables below show the interaction between an interrupt and the controller
operating cycle.
To determine the interrupt latency:
1. First determine the execution time for the longest executing rung in your
control program (maximum rung time). See MicroLogix 1200 Memory
Usage and Instruction Execution Time on page 375 or MicroLogix 1500
Memory Usage and Instruction Execution Time on page 381 for more
information.
2. Multiply the maximum rung time by the Communications Multiplier
corresponding to your configuration in the MicroLogix 1200 Scan Time
Worksheet on page 380, or MicroLogix 1500 Scan Time Worksheet on page
386.
Evaluate your results as follows:
User Fault Routine
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.
ProgramScan Activity When an Interrupt Can Occur
Input Scan Bet ween word updat es
Ladder Scan St art of Rung
Out put Scan Bet ween word updat es
Communi cat i ons Servi ce
Anyt i me
(1)(2)
(1) Communi cat i ons Servi ces i ncl udes 80 s t o get i nt o a subrout i ne
(2) Communi cat i on Servi ce i ncl udes 60 s f or a t i me t i ck.
Housekeepi ng Anyt i me
Controller If the time calculated in step 2is: Then the Interrupt Latency is:
M i croLogi x 1200 l ess t han 133 s 411 s
great er t han 133 s t he val ue cal cul at ed i n st ep 2
pl us 278 s
M i croLogi x 1500 l ess t han 100 s 360 s
great er t han 100 s t he val ue cal cul at ed i n st ep 2
pl us 260 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 237
Faults are classified as recoverable, non-recoverable, and non-user faults. A
complete list of faults is shown in Fault Messages and ErrorCodes on page 413.
The basic types of faults are described below:
St at us Fi l e Dat a Saved
The Arithmetic Flags (Status File word S:0) are saved on entry to the user fault
subroutine and re-written upon exiting the subroutine.
Creat i ng a User Faul t Subrout i ne
To use the user fault subroutine:
1. Create a subroutine file. Program Files 3 to 255 can be used.
2. Enter the file number in word S:29 of the status file.
Cont rol l er Operat i on
The occurrence of recoverable or non-recoverable faults causes the controller to
read S:29 and execute the subroutine number identified by S:29. If the fault is
recoverable, the routine can be used to correct the problem and clear the fault bit
S:1/13. The controller then continues in its current executing mode. The routine
does not execute for non-user faults.
User Interrupt
Instructions
Recoverable Non-Recoverable Non-User Fault
Recoverabl e Faul t s are caused by
t he user and may be recovered
f rom by execut i ng l ogi c i n t he
user f aul t rout i ne. The user can
at t empt t o cl ear t he M aj or Error
Hal t ed bi t , S:1/ 13.
Note:You may i ni t i at e a M SG
i nst ruct i on f rom t he cont rol l er t o
anot her devi ce t o i dent i f y t he
f aul t condi t i on of t he cont rol l er.
Non-Recoverabl e Faul t s are
caused by t he user, and
cannot be recovered f rom. The
user f aul t rout i ne execut es
when t hi s t ype of f aul t occurs.
However, t he f aul t cannot be
cl eared.
Note:You may i ni t i at e a M SG
i nst ruct i on t o anot her devi ce
t o i dent i f y t he f aul t condi t i on
of t he cont rol l er.
Non-User Faul t s are caused by
vari ous condi t i ons t hat cease
l adder program execut i on. The
user f aul t rout i ne does not
execut e when t hi s t ype of
f aul t occurs.
Instruction Used To: Page
INT - Int errupt Subrout i ne Use t hi s i nst ruct i on t o i dent i f y a program f i l e as an
i nt errupt subrout i ne (INT l abel ) versus a regul ar
subrout i ne (SBR l abel ). Thi s shoul d be t he f i rst
i nst ruct i on i n your i nt errupt subrout i ne.
238
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
238 Usi ng Int errupt s
INT - Interrupt
Subroutine
Instruction Type: input
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.
STS - Selectable Timed
Start
Instruction Type: output
The STS instruction can be used to start and stop the STI function or to
changethe time interval between STI user interrupts. The STI instruction has
oneoperand:
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 to 65,535 milliseconds.
The STS instruction applies the specified set point to the STI function as follows:
STS - Sel ect abl e Ti med
St art
Use t he STS (Sel ect abl e Ti med Int errupt St art )
i nst ruct i on t o t he st art t he STI t i mer f rom t he cont rol
program, rat her t han st art i ng aut omat i cal l y.
238
UID - User Int errupt Di sabl e Use t he User Int errupt Di sabl e (UID) and t he User
Int errupt Enabl e (UIE) i nst ruct i ons t o creat e zones i n
w hi ch I/ O i nt errupt s cannot occur.
239
UIE - User Int errupt Enabl e 240
UIF - User Int errupt Fl ush Use t he UIF i nst ruct i on t o remove sel ect ed pendi ng
i nt errupt s f rom t he syst em.
241
Instruction Used To: Page
INT
I/ O Int errupt
INT
Execution Time for the INT Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 1.0 s 1.0 s
M i croLogi x 1500 1.0 s 1.0 s
STS
Sel ect abl e Ti med St art
Ti me 1
STS
Execution Time for the STS Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 57.5 s 0.0 s
M i croLogi x 1500 50.7 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 239
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:
UID - User Interrupt
Disable
Instruction Type: output
The UID instruction is used to disable selected user interrupts. The table below
shows the types of interrupts with their corresponding disable bits:
STS Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 82.
Parameter
Data Files Function Files
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
D
L
S
-
D
a
t
a
L
o
g
Address
(1)
Mode
Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
P
L
S
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
E
l
e
m
e
n
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
Ti me
(1) See Import ant not e about i ndi rect addressi ng.
IMPORTANT You cannot use i ndi rect addressi ng wi t h: S, ST, M G, PD, RTC, HSC, PTO,
PWM , STI, EII, BHI, M M I, DAT, TPI, CS, IOS, and DLS f i l es.
UID
User Int errupt Di sabl e
Int errupt Types 5
UID
Execution Time for the UID Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 0.8 s 0.0 s
M i croLogi x 1500 0.8 s 0.0 s
Types of Interrupts Disabled by the UID Instruction
Interrupt Element Decimal
Value
Corresponding
Bit
EII - Event Input Int errupt s Event 0 64 bi t 6
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
240 Usi ng Int errupt s
To disable interrupt(s):
1. Select which interrupts you want to disable.
2. Find the Decimal Value for the interrupt(s) you selected.
3. Add the Decimal Values if you selected more than one type of interrupt.
4. Enter the sum into the UID instruction.
For example, to disable EII Event 1 and EII Event 3:
EII Event 1 = 32, EII Event 3 = 4
32 + 4 = 36 (enter this value)
UIE - User Interrupt
Enable
Instruction Type: output
The UIE instruction is used to enable selected user interrupts. The table below
shows the types of interrupts with their corresponding enable bits:
EII - Event Input Int errupt s Event 1 32 bi t 5
HSC - Hi gh-Speed Count er HSC0 16 bi t 4
EII - Event Input Int errupt s Event 2 8 bi t 3
EII - Event Input Int errupt s Event 3 4 bi t 2
HSC - Hi gh-Speed Count er
(1)
HSC1 2 bi t 1
STI - Sel ect abl e Ti med Int errupt s STI 1 bi t 0
Not e: Bi t s 7 t o 15 must be set t o zero.
(1) The M i croLogi x 1200 has one HSC Int errupt , HSC0. The M i croLogi x 1500 has t wo, HSC0 and HSC1.
Types of Interrupts Disabled by the UID Instruction
Interrupt Element Decimal
Value
Corresponding
Bit
UIE
User Int errupt Enabl e
Int errupt Types 4
UIE
Execution Time for the UIE Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 0.8 s 0.0 s
M i croLogi x 1500 0.8 s 0.0 s
Types of Interrupts Disabled by the UIE Instruction
Interrupt Element Decimal
Value
Corresponding
Bit
EII - Event Input Int errupt s Event 0 64 bi t 6
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 241
To enable interrupt(s):
1. Select which interrupts you want to enable.
2. Find the Decimal Value for the interrupt(s) you selected.
3. Add the Decimal Values if you selected more than one type of interrupt.
4. Enter the sum into the UIE instruction.
For example, to enable EII Event 1 and EII Event 3:
EII Event 1 = 32, EII Event 3 = 4
32 + 4 = 36 (enter this value)
UIF - User Interrupt
Flush
Instruction Type: output
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
EII - Event Input Int errupt s Event 1 32 bi t 5
HSC - Hi gh-Speed Count er HSC0 16 bi t 4
EII - Event Input Int errupt s Event 2 8 bi t 3
EII - Event Input Int errupt s Event 3 4 bi t 2
HSC - Hi gh-Speed Count er
(1)
HSC1 2 bi t 1
STI - Sel ect abl e Ti med Int errupt s STI 1 bi t 0
Not e: Bi t s 7 t o 15 must be set t o zero.
(1) The M i croLogi x 1200 has one HSC Int errupt , HSC0. The M i croLogi x 1500 has t wo, HSC0 and HSC1.
ATTENTION: If you enabl e i nt errupt s duri ng t he program scan vi a an OTL,
OTE, or UIE, t hi s i nst ruct i on must be t he l ast i nst ruct i on execut ed on t he rung
(l ast i nst ruct i on on l ast branch). It i s recommended t hi s be t he onl y out put
i nst ruct i on on t he rung.
Types of Interrupts Disabled by the UIE Instruction
Interrupt Element Decimal
Value
Corresponding
Bit
UIF
User Int errupt Fl ush
Int errupt Types 1
UIF
Execution Time for the UIF Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 12.3 s 0.0 s
M i croLogi x 1500 10.6 s 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
242 Usi ng Int errupt s
corresponding flush bits:
To flush interrupt(s):
1. Select which interrupts you want to flush.
2. Find the Decimal Value for the interrupt(s) you selected.
3. Add the Decimal Values if you selected more than one type of interrupt.
4. Enter the sum into the UIF instruction.
For example, to disable EII Event 1 and EII Event 3:
EII Event 1 = 32, EII Event 3 = 4
32 + 4 = 36 (enter this value)
Using the Selectable
Timed Interrupt (STI)
Function File
Types of Interrupts Disabled by the UIF Instruction
Interrupt Element Decimal
Value
Corresponding
Bit
EII - Event Input Int errupt s Event 0 64 bi t 6
EII - Event Input Int errupt s Event 1 32 bi t 5
HSC - Hi gh-Speed Count er HSC0 16 bi t 4
EII - Event Input Int errupt s Event 2 8 bi t 3
EII - Event Input Int errupt s Event 3 4 bi t 2
HSC - Hi gh-Speed Count er
(1)
(1) The M i croLogi x 1200 has one HSC Int errupt , HSC0. The M i croLogi x 1500 has t wo, HSC0 and HSC1.
HSC1 2 bi t 1
STI - Sel ect abl e Ti med Int errupt s STI 1 bi t 0
Not e: Bi t s 7 t o 15 must be set t o zero.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 243
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.
Example of where you would use the STI are:
PID type applications, where a calculation must be performed at a specific
time interval.
A motion application, where the motion instruction (PTO) needs to be
scanned at a specific rate to guarantee a consistent acceleration/deceleration
profile.
A block of logic that needs to be scanned more often.
How an STI is used is typically driven by the demands/requirements of the
application. It operates using the following sequence:
1. The user selects a time interval.
2. When a valid interval is set and the STI is properly configured, the controller
monitors the STI value.
3. When the time period has elapsed, the controllers normal operation is
interrupted.
4. The controller then scans the logic in the STI program file.
5. When the STI file scan is completed, the controller returns to where it was
prior to the interrupt and continues normal operation.
Selectable Time Interrupt (STI) Function File Sub-Elements Summary
Selectable Timed Interrupt Function File (STI:0)
Sub-Element Description Address Data Format Type User Program
Access
For More
Information
PFN - Program Fi l e Number STI:0.PFN word (INT) cont rol read onl y 244
ER - Error Code STI:0.ER word (INT) st at us read onl y 244
UIX - User Int errupt Execut i ng STI:0/ UIX bi nary (bi t ) st at us read onl y 244
UIE - User Int errupt Enabl e STI:0/ UIE bi nary (bi t ) cont rol read/ wri t e 245
UIL - User Int errupt Lost STI:0/ UIL bi nary (bi t ) st at us read/ wri t e 245
UIP - User Int errupt Pendi ng STI:0/ UIP bi nary (bi t ) st at us read onl y 245
TIE - Ti med Int errupt Enabl ed STI:0/ TIE bi nary (bi t ) cont rol read/ wri t e 246
AS - Aut o St art STI:0/ AS bi nary (bi t ) cont rol read onl y 246
ED - Error Det ect ed STI:0/ ED bi nary (bi t ) st at us read onl y 246
SPM - Set Poi nt M sec STI:0.SPM word (INT) cont rol read/ wri t e 246
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
244 Usi ng Int errupt s
STI Function File Sub-Elements
STI Program Fi l e Number (PFN)
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 to 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.
STI Error Code (ER)
Error codes detected by the STI sub-system are displayed in this register. The table
below explains the error codes.
STI User Int errupt Execut i ng (UIX)
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.
Sub-Element Description Address Data Format Type User Program
Access
PFN - Program Fi l e Number STI:0.PFN word (INT) cont rol read onl y
Sub-Element Description Address Data Format Type User Program
Access
ER - Error Code STI:0.ER word (INT) st at us read onl y
STI Error Code
Error
Code
Recoverable Fault
(Controller)
Description
1 Inval i d Program Fi l e
Number
Program f i l e number i s l ess t han 3, great er t han 255, or does not
exi st .
Sub-Element Description Address Data Format Type User Program
Access
UIX - User Int errupt Execut i ng STI:0/ UIX bi nary (bi t ) st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 245
STI User Int errupt Enabl e (UIE)
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.
STI User Int errupt Lost (UIL)
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.
STI User Int errupt Pendi ng (UIP)
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.
Sub-Element Description Address Data Format Type User Program
Access
UIE - User Int errupt Enabl e STI:0/ UIE bi nary (bi t ) cont rol read/ wri t e
Sub-Element Description Address Data Format Type User Program
Access
UIL - User Int errupt Lost STI:0/ UIL bi nary (bi t ) st at us read/ wri t e
Sub-Element Description Address Data Format Type User Program
Access
UIP - User Int errupt Pendi ng STI:0/ UIP bi nary (bi t ) st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
246 Usi ng Int errupt s
STI Ti med Int errupt Enabl ed (TIE)
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.
STI Aut o St art (AS)
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.
STI Error Det ect ed (ED)
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
This bit is automatically set and cleared by the controller.
STI Set Poi nt M i l l i seconds Bet ween Int errupt s (SPM )
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
Sub-Element Description Address Data Format Type User Program
Access
TIE - Ti med Int errupt Enabl ed STI:0/ TIE bi nary (bi t ) cont rol read/ wri t e
Sub-Element Description Address Data Format Type User Program
Access
AS - Aut o St art STI:0/ AS bi nary (bi t ) cont rol read onl y
Sub-Element Description Address Data Format Type User Program
Access
ED - Error Det ect ed STI:0/ ED bi nary (bi t ) st at us read onl y
Sub-Element
Description
Address Data Format Range Type User Program
Access
SPM - Set Poi nt
M sec
STI:0.SPM word (INT) 0 t o
65,535
cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 247
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
STSinstruction.
Using the Event Input
Interrupt (EII) Function
File
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 device.
Within the function file section of RSLogix 500, the user sees an EII folder. Within
the folder are four EII elements. Each of these elements (EII:0, EII:1, EII:2, and
EII:3) 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.
Event Input Interrupt (EII) Function File Sub-Elements Summary
TIP The mi ni mum val ue cannot be l ess t han t he t i me requi red t o scan t he STI
program f i l e (STI:0.PFN) pl us t he Int errupt Lat ency.
Event Input Interrupt Function File (EII:0)
Sub-Element Description Address Data Format Type User Program
Access
For More
Information
PFN - Program Fi l e Number EII:0.PFN word (INT) cont rol read onl y 248
ER - Error Code EII:0.ER word (INT) st at us read onl y 248
UIX - User Int errupt Execut i ng EII:0/ UIX bi nary (bi t ) st at us read onl y 249
UIE - User Int errupt Enabl e EII:0/ UIE bi nary (bi t ) cont rol read/ wri t e 249
UIL - User Int errupt Lost EII:0/ UIL bi nary (bi t ) st at us read/ wri t e 249
UIP - User Int errupt Pendi ng EII:0/ UIP bi nary (bi t ) st at us read onl y 250
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
248 Usi ng Int errupt s
EII Function File Sub-Elements
EII Program Fi l e Number (PFN)
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 to 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.
EII Error Code (ER)
Any ER (Error Code) detected by the EII sub-system is displayed in this register.
The table below explains the error codes.
EIE - Event Int errupt Enabl ed EII:0/ EIE bi nary (bi t ) cont rol read/ wri t e 250
AS - Aut o St art EII:0/ AS bi nary (bi t ) cont rol read onl y 250
ED - Error Det ect ed EII:0/ ED bi nary (bi t ) st at us read onl y 251
ES - Edge Sel ect EII:0/ ES bi nary (bi t ) cont rol read onl y 251
IS - Input Sel ect EII:0.IS word (INT) cont rol read onl y 251
Event Input Interrupt Function File (EII:0)
Sub-Element Description Address Data Format Type User Program
Access
For More
Information
Sub-Element Description Address Data Format Type User Program
Access
PFN - Program Fi l e Number EII:0.PFN word (INT) cont rol read onl y
Sub-Element Description Address Data Format Type User Program
Access
ER - Error Code EII:0.ER word (INT) st at us read onl y
EII Error Codes
Error
Code
Recoverable Fault
(Controller)
Description
1 Inval i d Program Fi l e
Number
Program f i l e number i s l ess t han 3, great er t han 255, or
does not exi st
2 Inval i d Input Sel ect i on Val i d numbers must be 0, 1, 2, 3, 4, 5, 6, or 7.
3 Input Sel ect i on Overl ap EIIs cannot share i nput s. Each EII must have a uni que
i nput .
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 249
EII User Int errupt Execut i ng (UIX)
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
mechanismclears 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.
EII User Int errupt Enabl e (UIE)
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.
EII User Int errupt Lost (UIL)
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.
Sub-Element Description Address Data Format Type User Program
Access
UIX - User Int errupt Execut i ng EII:0/ UIX bi nary (bi t ) st at us read onl y
Sub-Element Description Address Data Format Type User Program
Access
UIE - User Int errupt Enabl e EII:0/ UIE bi nary (bi t ) cont rol read/ w ri t e
Sub-Element Description Address Data Format Type User Program
Access
UIL - User Int errupt Lost EII:0/ UIL bi nary (bi t ) st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
250 Usi ng Int errupt s
EII User Int errupt Pendi ng (UIP)
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 pending bit.
EII Event Int errupt Enabl e (EIE)
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
powercycle.
EII Aut o St art (AS)
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.
Sub-Element Description Address Data Format Type User Program
Access
UIP - User Int errupt Pendi ng EII:0/ UIP bi nary (bi t ) st at us read onl y
Sub-Element Description Address Data Format Type User Program
Access
EIE - Event Int errupt Enabl ed EII:0/ EIE bi nary (bi t ) cont rol read/ wri t e
Sub-Element Description Address Data Format Type User Program
Access
AS - Aut o St art EII:0/ AS bi nary (bi t ) cont rol read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Usi ng Int errupt s 251
EII Error Det ect ed (ED)
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
This bit is automatically set and cleared by the controller.
EII Edge Sel ect (ES)
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.
EII Input Sel ect (IS)
The IS (Input Select) parameter is used to configure each EII to a specific input on
the controller. Valid inputs are 0 to 7, which correspond to I1:0.0/0 to I1:0.0/7.
This parameter is configured with the programming device and cannot be changed
from the control program.
Sub-Element Description Address Data Format Type User Program
Access
ED - Error Det ect ed EII:0/ ED bi nary (bi t ) st at us read onl y
Sub-Element Description Address Data Format Type User Program
Access
ES - Edge Sel ect EII:0/ ES bi nary (bi t ) cont rol read onl y
Sub-Element Description Address Data Format Type User Program
Access
IS - Input Sel ect EII:0.IS word (INT) cont rol read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
252 Usi ng Int errupt s
Notes:
253 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 19
Process Control Instruction
This chapter describes the MicroLogix 1200 and MicroLogix 1500 Proportional
Integral Derivative (PID) instruction. The PID instruction is an output instruction
that controls physical properties such as temperature, pressure, liquid level, or flow
rate using process loops.
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
page269.
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 242 for more information on
STIinterrupts.
PID closed loop control holds a process variable at a desired set point. A flow
rate/fluid level example is shown below.
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.
Set Poi nt
Fl ow Rat e
Error
Cont rol Val ve
PID
Equat i on
Process
Vari abl e
Level
Det ect or
Cont rol
Out put
Feed Forward Bi as
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
254 Process Cont rol Inst ruct i on
The PID Equation
The PID instruction uses the following algorithm:
Standard equation with dependent gains:
Standard Gains constants are:
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 1200 and 1500 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 1200 and
1500 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.
Term Range (Low to High) Reference
Cont rol l er Gai n K
C 0.01 t o 327.67 (di mensi onl ess)
(1)
(1) Appl i es t o M i croLogi x 1200 and 1500 PID range when Reset and Gai n Range (RG) bi t i s set t o 1. For more i nf ormat i on
on reset and gai n, see PLC 5 Gai n Range (RG) on page 265.
Proport i onal
Reset Term 1/ T
I 327.67 t o 0.01 (mi nut es per repeat )
(1)
Int egral
Rat e Term T
D 0.01 t o 327.67 (mi nut es)
(1)
Deri vat i ve
Output K
C
E ( )
1
T
I
----- E ( ) t d
T
D
d PV ( )
dt
--------------- + + bias + =
PD f i l e creat ed by
RSLogi x 500.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Process Cont rol Inst ruct i on 255
PID - Proportional
Integral Derivative
Instruction Type: output
It is recommended that you place the PID instruction on a rung without any
conditional logic. If conditional logic exists, the Control Variable output remains at
its last value, and the CVP CV% term and integral term are both cleared when the
rung is false.
The example below shows a PID instruction on a rung with RSLogix 500
programming software.
When programming, the setup screen provides access to the PID instruction
configuration parameters. The illustration below shows the RSLogix 500
setupscreen.
PID
PID
PID Fi l e PD8:0
Process Vari abl e N7:0
Cont rol Vari abl e N7:1
Set up Screen
PID
Execution Time for the PID Instruction
Controller When Rung Is:
True False
M i croLogi x 1200 295.8 s 11.0 s
M i croLogi x 1500 251.8 s 8.9 s
TIP In order t o st op and rest art t he PID i nst ruct i on, you need t o creat e a
f al se-t o-t rue rung t ransi t i on.
0047
B3:0
0
PID
PID
PID Fi l e PD8:0
Process Vari abl e N7:0
Cont rol Vari abl e N7:1
Set up Screen
PID
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
256 Process Cont rol Inst ruct i on
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.
Setpoint (SPS)
The SPS (Setpoint) is the desired control point of the process variable.
Process Variable (PV)
The PV (Process Variable) is the analog input variable.
Input Parameter Descriptions Address Data Format Range Type User
Program
Access
For More
Information
SPS - Set poi nt PD10:0.SPS word (INT)
0 t o 16383
(1)
cont rol read/ wri t e 256
PV - Process Vari abl e user def i ned word (INT) 0 t o 16383 cont rol read/ wri t e 256
M AXS - Set poi nt M axi mum PD10:0.M AXS word (INT) -32,768 t o +32,767 cont rol read/ wri t e 257
M INS - Set poi nt M i ni mum PD10:0.M INS word (INT) -32,768 t o +32,767 cont rol read/ wri t e 257
OSP - Ol d Set poi nt Val ue PD10:0.OSP word (INT) -32,768 t o +32,767 st at us read onl y 257
OL - Out put Li mi t PD10:0/ OL bi nary 1 = enabl ed
0 = di sabl ed
cont rol read/ wri t e 258
CVH - Cont rol Vari abl e Hi gh
Li mi t
PD10:0.CVH word (INT) 0 t o 100% cont rol read/ wri t e 258
CVL - Cont rol Vari abl e Low Li mi t PD10:0.CVL word (INT) 0 t o 100% cont rol read/ wri t e 258
(1) The range l i st ed i n t he t abl e i s f or when scal i ng i s not enabl ed. Wi t h scal i ng, t he range i s f rom mi ni mum scal ed (M INS) t o maxi mum scal ed (M AXS).
Input Parameter
Descriptions
Address Data Format Range Type User Program
Access
SPS - Set poi nt PD10:0.SPS word (INT)
0 t o 16383
(1)
(1) The range l i st ed i n t he t abl e i s f or when scal i ng i s not enabl ed. Wi t h scal i ng, t he range i s f rom mi ni mum scal ed
(M INS) t o maxi mum scal ed (M AXS).
cont rol read/ wri t e
Input Parameter
Descriptions
Address Data Format Range Type User Program
Access
PV - Process
Vari abl e
user def i ned word (INT) 0 t o 16383 cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Process Cont rol Inst ruct i on 257
Setpoint MAX (MAXS)
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.
Setpoint MIN (MINS)
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.
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.
Old Setpoint Value (OSP)
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.
Input
Parameter
Descriptions
Address Data
Format
Range Type User
Program
Access
M AXS - Set poi nt
M axi mum
PD10:0.M AXS word
(INT)
-32,768 t o +32,767 cont rol read/ wri t e
Input Parameter
Descriptions
Address Data
Format
Range Type User
Program
Access
M INS - Set poi nt
M i ni mum
PD10:0.M INS word
(INT)
-32,768 t o +32,767 cont rol read/ wri t e
TIP M i nS - M axS scal i ng al l ows you t o w ork i n engi neeri ng uni t s. The
deadband, error, and SPV are al so di spl ayed i n engi neeri ng uni t s. The
process vari abl e, PV, must be wi t hi n t he range of 0 t o 16383. Use of M i nS -
M axS does not mi ni mi ze PID PV resol ut i on.
Input Parameter
Descriptions
Address Data
Format
Range Type User
Program
Access
OSP - Ol d
Set poi nt Val ue
PD10:0.OSP word
(INT)
-32,768 t o +32,767 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
258 Process Cont rol Inst ruct i on
Output Limit (OL)
An enabled (1) value enables output limiting to the values defined in PD10:0.CVH
(Control Variable High) and PD10.0.CVL (Control Variable Low).
A disabled (0) value disables OL (Output Limiting).
Control Variable High Limit (CVH)
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.
Control Variable Low Limit (CVL)
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.
Output Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
OL - Out put Li mi t PD10:0/ OL bi nary 1 = enabl ed
0 = di sabl ed
cont rol read/ wri t e
Output Parameter
Descriptions
Address Data Format Range Type User Program
Access
CVH - Cont rol
Vari abl e Hi gh Li mi t
PD10:0.CVH word (INT) 0 t o 100% cont rol read/ wri t e
Output Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
CVL - Cont rol
Vari abl e Low Li mi t
PD10:0.CVL word
(INT)
0 t o 100% cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Process Cont rol Inst ruct i on 259
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.
Control Variable (CV)
The CV (Control Variable) is user-defined. See the ladder rung below.
Control Variable Percent (CVP)
CVP (Control Variable Percent) displays the control variable as a percentage. The
range is 0 to 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
Output Parameter Descriptions Address Data Format Range Type User Program
Access
For More
Information
CV - Cont rol Vari abl e User-def i ned w ord (INT) 0 t o 16,383 cont rol read/ wri t e 259
CVP - Cont rol Vari abl e Percent PD10:0.CVP w ord (INT) 0 t o 100 cont rol read/ wri t e 259
SPV - Scal ed Process Vari abl e PD10:0.SPV w ord (INT) 0 t o 16383 st at us read onl y 260
Output Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
CV - Cont rol Vari abl e User-def i ned word (INT) 0 t o 16,383 cont rol read/ wri t e
Output Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
CVP - Cont rol Vari abl e Percent PD10:0.CVP word (INT) 0 t o 100 cont rol st at us read
0000
PID
PID
PID Fi l e PD10:0
Process Vari abl e N7:0
Cont rol Vari abl e N7:1
Set up Screen
PID
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
260 Process Cont rol Inst ruct i on
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.
Scaled Process Variable (SPV)
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).
If the SPV is configured to be read in engineering units, then this parameter
corresponds to the value of the process variable in engineering units. See Analog I/
O Scaling on page 269 for more information on scaling.
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.
Input Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
SPV - Scal ed Process Vari abl e PD10:0.SPV word (INT) 0 t o 16383 st at us read onl y
Tuning Parameter
Descriptions
Address Data Format Range Type User
Program
Access
For More
Information
KC - Cont rol l er Gai n - K
c
PD10:0.KC word (INT) 0 t o 32,767 cont rol read/ wri t e 261
TI - Reset Term - T
i
PD10:0.Ti word (INT) 0 t o 32,767 cont rol read/ wri t e 261
TD - Rat e Term - T
d
PD 10:0.TD word (INT) 0 t o 32,767 cont rol read/ wri t e 262
TM - Ti me M ode PD10:0.TM bi nary 0 or 1 cont rol read/ wri t e 262
LUT - Loop Updat e Ti me PD10:0.LUT word (INT) 1 t o 1024 cont rol read/ wri t e 262
ZCD - Zero Crossi ng Deadband PD10:0.ZCD word (INT) 0 t o 32,767 cont rol read/ wri t e 263
FF - Feed Forward Bi as PD10:0.FF word (INT) -16,383 t o +16,383 cont rol read/ wri t e 263
SE - Scal ed Error PD10:0.SE word (INT) -32,768 t o +32,767 st at us read onl y 263
AM - Aut omat i c/ M anual PD10:0/ AM bi nary (bi t ) 0 or 1 cont rol read/ wri t e 264
CM - Cont rol M ode PD10:0/ CM bi nary (bi t ) 0 or 1 cont rol read/ wri t e 264
DB - PV i n Deadband PD10:0/ DB bi nary (bi t ) 0 or 1 st at us read/ wri t e 264
RG - PLC 5 Gai n Range PD10:0/ RG bi nary (bi t ) 0 or 1 cont rol read/ wri t e 265
SC - Set poi nt Scal i ng PD10:0/ SC bi nary (bi t ) 0 or 1 cont rol read/ wri t e 265
TF - Loop Updat e Too Fast PD10:0/ TF bi nary (bi t ) 0 or 1 st at us read/ wri t e 265
DA - Deri vat i ve Act i on Bi t PD10:0/ DA bi nary (bi t ) 0 or 1 cont rol read/ wri t e 266
UL - CV Upper Li mi t Al arm PD10:0/ UL bi nary (bi t ) 0 or 1 st at us read/ wri t e 266
LL - CV Lower Li mi t Al arm PD10:0/ LL bi nary (bi t ) 0 or 1 st at us read/ wri t e 266
SP - Set poi nt Out of Range PD10:0/ SP bi nary (bi t ) 0 or 1 st at us read/ wri t e 267
PV - PV Out of Range PD10:0/ PV bi nary (bi t ) 0 or 1 st at us read/ wri t e 267
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Process Cont rol Inst ruct i on 261
Controller Gain (K
c
)
Gain K
c
(word 3) is the proportional gain, ranging from 0 to 3276.7 (when RG=0),
or 0 to 327.67 (when RG=1). Set this gain to one-half the value needed to cause
the output to oscillate when the reset and rate terms (below) are set to zero.
Reset Term(T
i
)
Reset T
i
(word 4) is the Integral gain, ranging from 0 to 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.
DN - Done PD10:0/ DN bi nary (bi t ) 0 or 1 st at us read onl y 267
EN - Enabl e PD10:0/ EN bi nary (bi t ) 0 or 1 st at us read onl y 267
IS - Int egral Sum PD10:0.IS l ong word
(32-bi t INT)
-2,147,483,648 t o
2,147,483,647
st at us read/ wri t e 268
AD - Al t ered Deri vat i ve Term PD10:0.AD l ong word
(32-bi t INT)
-2,147,483,648 t o
2,147,483,647
st at us read onl y 268
Tuning Parameter
Descriptions
Address Data Format Range Type User
Program
Access
For More
Information
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
KC - Cont rol l er Gai n - K
c
PD10:0.KC word (INT) 0 t o 32,767 cont rol read/ w ri t e
TIP Cont rol l er gai n i s af f ect ed by t he reset and gai n range (RG) bi t . For
i nf ormat i on, see PLC 5 Gai n Range (RG) on page 265.
Tuning Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
TI - Reset Term - T
i
PD10:0.Ti word
(INT)
0 t o 32,767 cont rol read/ wri t e
TIP Reset t erm i s af f ect ed by t he reset and gai n range (RG) bi t . For i nf ormat i on,
see PLC 5 Gai n Range (RG) on page 265.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
262 Process Cont rol Inst ruct i on
Rate Term(T
d
)
Rate T
d
(word 5) is the Derivative term. The adjustment range is 0 to 327.67
minutes. Set this value to 1/8 of the integral gain T
i
.
Time Mode (TM)
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).
Loop Update Time (LUT)
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
TD - Rat e Term - T
d
PD 10:0.TD word (INT) 0 t o 32,767 cont rol read/ wri t e
TIP Thi s word i s not ef f ect ed by t he reset and gai n range (RG) bi t . For
i nf ormat i on, see PLC 5 Gai n Range (RG) on page 265.
Tuning Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
TM - Ti me M ode PD10:0.TM bi nary 0 or 1 cont rol read/ wri t e
TIP When usi ng t i med mode, your processor scan t i me shoul d be at l east t en
t i mes f ast er t han t he l oop updat e t i me t o prevent t i mi ng i naccuraci es or
di st urbances.
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
LUT - Loop Updat e Ti me PD10:0.LUT word (INT) 1 t o 1024 cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Process Cont rol Inst ruct i on 263
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 to 10.24 seconds.
Zero Crossing Deadband (ZCD)
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 to 16,383 when no scaling exists.
Feed Forward Bias (FF)
The feed forward bias is used to compensate for disturbances that may affect the
CV output.
Scaled Error (SE)
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 264.
Tuning Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
ZCD - Zero Crossi ng
Deadband
PD10:0.ZCD word (INT) 0 t o 32,767 cont rol read/ wri t e
Tuning Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
FF - Feed Forward
Bi as
PD10:0.FF word
(INT)
-16,383 t o +16,383 cont rol read/ wri t e
Tuning Parameter
Descriptions
Address Data
Format
Range Type User Program
Access
SE - Scal ed Error PD10:0.SE word (INT) -32,768 t o +32,767 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
264 Process Cont rol Inst ruct i on
Automatic / Manual (AM)
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.
Control Mode (CM)
Control mode, or forward-/reverse-acting, toggles the values E=SP-PV and
E=PV-SP.
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)
This bit is set (1) when the process variable is within the zero-crossing
deadbandrange.
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
AM - Aut omat i c/ M anual PD10:0/ AM bi nary (bi t ) 0 or 1 cont rol read/ wri t e
TIP Out put l i mi t i ng i s al so appl i ed when i n manual .
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
CM - Cont rol M ode PD10:0/ CM bi nary (bi t ) 0 or 1 cont rol read/ w ri t e
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
DB - PV i n Deadband PD10:0/ DB bi nary (bi t ) 0 or 1 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Process Cont rol Inst ruct i on 265
PLC 5 Gain Range (RG)
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.
Setpoint Scaling (SC)
The SC bit is cleared when setpoint scaling values are specified.
Loop Update Too Fast (TF)
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.
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
RG - PLC 5 Gai n Range PD10:0/ RG bi nary (bi t ) 0 or 1 cont rol read/ w ri t e
TIP The rat e mul t i pl i er (TD) i s not af f ect ed by t hi s sel ect i on.
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
SC - Set poi nt Scal i ng PD10:0/ SC bi nary (bi t ) 0 or 1 cont rol read/ wri t e
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
TF - Loop Updat e Too
Fast
PD10:0/ TF bi nary (bi t ) 0 or 1 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
266 Process Cont rol Inst ruct i on
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.
Derivative Action Bit (DA)
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.
CV Upper Limit Alarm(UL)
The control variable upper limit alarm bit is set when the calculated CV output
exceeds the upper CV limit.
CV Lower Limit Alarm(LL)
The control variable lower limit alarm bit is set (1) when the calculated CV output
is less than the lower CV limit.
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
DA - Deri vat i ve Act i on Bi t PD10:0/ DA bi nary (bi t ) 0 or 1 cont rol read/ wri t e
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
UL - CV Upper Li mi t Al arm PD10:0/ UL bi nary (bi t ) 0 or 1 st at us read/ wri t e
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
LL - CV Lower Li mi t Al arm PD10:0/ LL bi nary (bi t ) 0 or 1 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Process Cont rol Inst ruct i on 267
Setpoint Out Of Range (SP)
This bit is set (1) when the setpoint:
exceeds the maximum scaled value, or
is less than the minimum scaled value.
PV Out Of Range (PV)
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)
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).
Enable (EN)
The PID enabled bit is set (1) whenever the PID instruction is enabled. It follows
the rung state.
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
SP - Set poi nt Out of Range PD10:0/ SP bi nary (bi t ) 0 or 1 st at us read/ wri t e
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
PV - PV Out of Range PD10:0/ PV bi nary (bi t ) 0 or 1 st at us read/ wri t e
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
DN - Done PD10:0/ DN bi nary (bi t ) 0 or 1 st at us read onl y
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
EN - Enabl e PD10:0/ EN bi nary (bi t ) 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
268 Process Cont rol Inst ruct i on
Integral Sum(IS)
This is the result of the integration .
Altered Derivative Term(AD)
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.
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
IS - Int egral Sum PD10:0.IS l ong word
(32-bi t INT)
-2,147,483,648 t o
2,147,483,647
st at us read/ wri t e
Tuning Parameter
Descriptions
Address Data Format Range Type User Program
Access
AD - Al t ered
Deri vat i ve Term
PD10:0.AD l ong word
(32-bi t INT)
-2,147,483,648 t o
2,147,483,647
st at us read onl y
K
c
T
I
-------
E t d ( )
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
40
41
42
43
44
45
46
47
48
49
4A
4B
4C
4D
4E
4F
50
51
52
53
54
55
56
57
58
59
5A
5B
5C
5D
5E
5F
100
101
102
103
104
105
106
107
110
111
112
113
114
115
116
117
120
121
122
123
124
125
126
127
130
131
132
133
134
135
136
137
@
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
[
\
]
^
_
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
60
61
62
63
64
65
66
67
68
69
6A
6B
6C
6D
6E
6F
70
71
72
73
74
75
76
77
78
79
7A
7B
7C
7D
7E
7F
140
141
142
143
144
145
146
147
150
151
152
153
154
155
156
157
160
161
162
163
164
165
166
167
170
171
172
173
174
175
176
177
\
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
{
|
}
~
DEL
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
308 ASCII Inst ruct i ons
Notes:
309 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 21
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 309
SVC - Service Communications on page 310
MSG - Message on page 313
The Message Element on page 314
Timing Diagram for the MSG Instruction on page 320
MSG Instruction Ladder Logic on page 323
Local Messages on page 324
Configuring a Local Message on page 325
Local Messaging Examples on page 333
Remote Messages on page 346
Configuring a Remote Message on page 348
MSG Instruction Error Codes on page 351
The communication instructions read or write data to another station.
Messaging Overview
The communication architecture is comprised of three primary components:
Ladder Scan
Communications Buffers
Communication Queue
These three components determine when a message is transmitted by the
controller. For a message to transmit, it must be scanned on a true rung of logic.
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.
Instruction Used To: Page
SVC Int errupt t he program scan t o execut e t he servi ce communi cat i ons part
of t he operat i ng cycl e. The scan t hen resumes at t he i nst ruct i on
f ol l owi ng t he SVC i nst ruct i on.
310
M SG Transf er dat a f rom one devi ce t o anot her. 313
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
310 Communi cat i ons Inst ruct i ons
If a second message instruction is processed before the first message completes,
the second message and its data are placed in one of the three remaining
communication buffers. This process repeats whenever a message instruction is
processed, until all four buffers are in use.
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 channels
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.
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.
The controller initiates read and write messages through available communication
channels when configured for the following protocols:
DH-485
DF1 Full-Duplex
DF1 Half-Duplex Master
DF1 Half-Duplex Slave
Modbus RTU Master
For a description of valid communication protocols, see Protocol Configuration on
page 423.
SVC - Service
Communications
Instruction Type: output
TIP If a message i nst ruct i on was i n t he queue, t he dat a t hat i s act ual l y sent out
of t he cont rol l er may be di f f erent t han what was present when t he
message i nst ruct i on was f i rst processed.
SVC
Servi ce Communi cat i ons
Channel Sel ect 1
SVC
Execution Time for the SVC Instruction
Controller
When Rung Is:
(1)
True False
M i croLogi x 1200 208 s + 1.6 s per word 0.0 s
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 311
Under normal operation the controller processes communications once every time
it scans the control program. If you require the communications port to be
scanned more often, or if the ladder scan is long, you can add an SVC (Service
Communications) instruction to your control program. The SVC instruction is
used to improve communications performance/throughput, but also causes the
ladder scan to be longer.
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 312 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
Eventsubroutine.
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.
M i croLogi x 1500 1764-LSP or 1764-LRP wi t h
one channel sel ect ed
166 s + 1.4 s per word 0.0 s
M i croLogi x 1500 1764-LRP Processor wi t h bot h
channel s sel ect ed
327 s + 1.4 s per word 0.0 s
(1) Thi s val ue f or t he SVC i nst ruct i on i s f or when t he communi cat i ons servi ci ng f unct i on i s accessi ng a dat a f i l e. The t i me
i ncreases when accessi ng a f unct i on f i l e.
TIP The amount of communi cat i ons servi ci ng perf ormed i s cont rol l ed by t he
Communi cat i on Servi ci ng Sel ect i on Bi t (CSS) and M essage Servi ci ng
Sel ect i on Bi t (M SS) i n t he Channel 0 Communi cat i on Conf i gurat i on Fi l e.
Controller Channel Select Setting Channel(s) Serviced
M i croLogi x 1200 1 0
M i croLogi x 1500 wi t h 1764-LSP Processor 1 0
M i croLogi x 1500 wi t h 1764-LRP Processor 1 0
2 1
3 bot h 0 and 1
Execution Time for the SVC Instruction
Controller
When Rung Is:
(1)
True False
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
312 Communi cat i ons Inst ruct i ons
Communication Status Bits
The following communication status bits allow you to customize or monitor
communications servicing. See General Channel Status Block on page 67 for
additional status information.
Application Example
The SVC instruction is used when you want to execute a communication function,
such as transmitting a message, prior to the normal service communication portion
of the operating scan.
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 communications
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.
Communication Status Bits
Address Description
Channel 0
Channel 1
(1)
(1) Channel 1 i s val i d f or M i croLogi x 1500 1764-LRP onl y.
CS0:4/ 0 CS1:4/ 0 ICP - Incomi ng Command Pendi ng
CS0:4/ 1 CS1:4/ 1 M RP - Incomi ng M essage Repl y Pendi ng
CS0:4/ 2 CS1:4/ 2 M CP - Out goi ng M essage Command Pendi ng
CS0:4/ 4 CS1:4/ 4 CAB - Communi cat i ons Act i ve Bi t
TIP You may program t he SVC i nst ruct i on uncondi t i onal l y across t he rungs. Thi s
i s t he normal programmi ng t echni que f or t he SVC i nst ruct i on.
0000
CS0:4
M CP
SVC
Servi ce Communi cat i ons
Channel Sel ect 0001h
SVC
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 313
MSG - Message
Instruction Type: output
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.
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.
EN
DN
ER
M SG
Read/ Wri t e M essage
M SG Fi l e M G9:0
Set up Screen
M SG
Execution Time for the MSG Instruction
Controller Rung Condition When Rung Is:
True False
M i croLogi x
1200
St eady St at e True 20.0 s 6.0 s
Fal se-t o-True Transi t i on f or Reads 230.0 s
Fal se-t o-True Transi t i on f or Wri t es 264 s + 1.6 s per word
M i croLogi x
1500
1764-LSP
St eady St at e True 17.0 s 6.0 s
Fal se-t o-True Transi t i on f or Reads 205.0 s
Fal se-t o-True Transi t i on f or Wri t es 228 s + 1.4 s per word
M i croLogi x
1500
1764-LRP
St eady St at e True 17.0 s 6.0 s
Communi cat i ons vi a base uni t or 1764-LRP communi cat i ons port :
Fal se-t o-True Transi t i on f or Reads 234.0 s 6.0 s
Fal se-t o-True Transi t i on f or Wri t es 257 s + 1.4 s per word
Communi cat i ons vi a Compact I/ O communi cat i on modul e, i .e. 1769-SDN:
Fal se-t o-True Transi t i on f or Reads 206.0 s 6.0 s
Fal se-t o-True Transi t i on f or Wri t es 234 s + 1.4 s per word
TIP How qui ckl y t he message i s act ual l y sent t o t he dest i nat i on devi ce
depends on a number of i ssues, i ncl udi ng t he sel ect ed channel s
communi cat i on prot ocol , t he baud rat e of t he communi cat i ons port , t he
number of ret ri es needed (i f any), and t he dest i nat i on devi ce' s readi ness
t o recei ve t he message.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
314 Communi cat i ons Inst ruct i ons
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.
Message File Sub-Elements
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.
Each MSG File Element consists of Sub-Elements 0 through 24 as shown in the
following table.
Message File Element
Sub-
Element
Name Description Parameter Size User Program
Access
(1)
0 t o 1 Reserved Word read onl y
2 M essagi ng Type: 0 (f or PCCC), 1 (f or CIP), 2 (f or M odbus M ast er) Word read onl y
3 f or PCCC M essagi ng: bi t s 07-00 (CM D code), bi t s 15-08 (FNC code)
f or CIP M essagi ng: bi t s 07-00 (Servi ce Code), bi t s 15-08 (Suppl ement al
Obj ect Pat h Dat a Count )
f or M odbus M ast er: bi t s 07-00 (Funct i on Code), bi t s 15-08 (reserved)
deri ved Word read onl y
4 Int ernal Physi cal Address Word read onl y
5 M G11:0.RBL PCCC: Remot e Bri dge Li nk ID
CIP: Suppl ement al Obj ect Pat h Dat a byt es 0 and 1
M odbus M ast er: not used
Y Word read onl y
6 M G11:0.LBN PCCC: Local Bri dge Node Address
CIP: Suppl ement al Obj ect Pat h Dat a byt es 2 and 3
M odbus M ast er: not used
Y Word read onl y
7 M G11:0.RBN PCCC: Remot e Bri dge Node Address
CIP: Suppl ement al Obj ect Pat h Dat a byt es 4 and 5
M odbus M ast er: not used
Y Word read onl y
8 M G11:0.CHN Channel : bi t s 07-00 (0 f or Channel 0,1 f or Channel 1)
Sl ot : bi t s 15-08 (0 t o 16)
Y Word read/ wri t e
9 M G11:0.NOD Target Node Number Y Word read/ wri t e
10 M G11:0.M TO M essage t i meout set t i ng or preset i n seconds Y Word read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 315
The Target file information contained in Sub-Elements 12 through 15 of the MSG
File Element depend upon the message type, as shown in the tables below.
11 PCCC and CIP: Number of byt es t o read/ wri t e
M odbus M ast er: Number of M odbus el ement s t o read/ wri t e
Word read onl y
12 Target Locat i on i nf ormat i on (See t abl es on page 315 f or opt i ons) Y Word read onl y
13 M G11:0.TFN Y Word read/ wri t e
14 M G11:0.ELE Y Word read/ wri t e
15 Y Word read onl y
16 Cont rol bi t s (See Cont rol Bi t s t abl e on page 317 f or det ai l s) N 16-bi t s read/ wri t e
17 St at us bi t s and Range paramet er (See t abl e on page 317 f or det ai l s) M i xed 16-bi t s read onl y
18 M G11:0.ERR Error code (See Error Codes on page 351) N Word read onl y
19 Ti me si nce message st art ed i n seconds N Word read onl y
20 Reserved Word read onl y
21 Int ernal message st art t i me i n seconds N Word read onl y
22 Enhanced error i nf ormat i on. The l ow byt e i s t he same as el ement 18
(ERR). The hi gh byt e cont ai ns an addi t i onal error code. For comms
modul e messagi ng, t he hi gh byt e cont ai ns t he act ual error code ret urned
by t he comms modul e when ERR i s 0xE0. For M odbus M ast er, t he hi gh
byt e cont ai ns t he non-st andard M odbus except i on repl y ret urned by t he
sl ave when ERR i s 0x89. Codes ret urned wi t h ot her errors are f or i nt ernal
use onl y.
N Word read onl y
23 Onl y used f or M i croLogi x 1500 1764-LRP Seri es C and hi gher.
Ext ended St at us Error Code f rom expansi on I/ O communi cat i ons modul e.
24 Onl y used f or M i croLogi x 1500 1764-LRP Seri es C and hi gher.
Suppl ement al Rout i ng Pat h Dat a Address:
bi t s 7 t o 0: St art i ng El ement , bi t s 15 t o 8: Fi l e Number
(1) User access ref ers t o user program access (M SG Fi l e word or bi t used as an operand f or an i nst ruct i on i n a l adder program) or access vi a Comms whi l e i n any mode ot her
t han downl oad (vi a Programmi ng Sof t ware or M emory M odul e).
Message File Element
Sub-
Element
Name Description Parameter Size User Program
Access
(1)
Message File Target Location Information
Target Device =485CIF
Sub-
Element
Name Description Parameter Size User Program
Access
12 Reserved Y Word read onl y
13 M G11:0.TFN Target Fi l e Number Y Word read/ w ri t e
14 M G11:0.ELE Of f set i n el ement s i nt o CIF Y Word read/ w ri t e
15 Reserved Y Word read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
316 Communi cat i ons Inst ruct i ons
Message File Target Location Information
Target Device =500CPU or PLC 5
Sub-
Element
Address Description Parameter Size User Program
Access
12 Target Fi l e Type Y Word read onl y
13 M G11:0.TFN
Target Fi l e Number
(1)
Y Word read/ wri t e
14 M G11:0.ELE Target Fi l e El ement Number f or B,
S, N, F
(2)
, T, C, R, L, ST and RTC
(3)
f i l es; or Target Fi l e Sl ot Number
f or O and I f i l es.
Y Word read/ wri t e
15 Target Fi l e El ement Number f or O
and I f i l es.
Set t o zero f or any f i l e ot her t han
O or I.
Y Word read onl y
(1) The f i l e number f or RTC f unct i on f i l es i s set t o 0 by t he programmi ng sof t ware.
(2) The F f i l e i s onl y permi t t ed i n t he M SG i nst ruct i on f or M i croLogi x 1200 and 1500 Seri es C and hi gher cont rol l ers.
(3) RTC and ST are onl y permi t t ed i n t he M SG i nst ruct i on f or M i croLogi x 1200 and 1500 Seri es B and hi gher cont rol l ers.
Message File Target Location Information
Target Device =CIP Generic
MicroLogix 1500 1764-LRP Series C, FRN 6 and higher Processor only.
Sub-
Element
Name Description Parameter Size User Program
Access
12 Target Cl ass Y Word read onl y
13 M G11:0.TFN Target Inst ance Y Word read/ wri t e
14 M G11:0.ELE CIP Send Dat a Count Y Word read/ wri t e
15 Reserved Y Word read onl y
Message File Target Location Information
Target Device =Modbus Device
MicroLogix 1500 1764-LRP Series C, FRN 9 and higher Processor only.
Sub-
Element
Name Description Parameter Size User Program
Access
12 st art i ng bi t address f or coi l s
and i nput s
Y Word read onl y
13 M G11:0.TFN M odbus Target Dat a
Address - 1
Y Word read/ wri t e
14 Reserved Y Word read/ wri t e
15 Reserved Y Word read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 317
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.
Message File Sub-Element 16- Control Bits
Bit Address Description Parameter Size User Program
Access
15 M G11:0.0/ EN Enabl e
1=M SG enabl ed
0=M SG not enabl ed
N bi t read/ wri t e
9 t o 14 Reserved N bi t read/ wri t e
8 M G11:0.0/ TO Ti me Out
1=M SG t i me out by user
0=no user M SG t i me out
N bi t read/ wri t e
0 t o 7 Reserved N bi t read/ wri t e
Message File Sub-Element 17- Status Bits
Bit Address Description Parameter Size User
Program
Access
15 Reserved N bi t read onl y
14 M G11:0.0/ ST St art :
1 = M SG t ransmi t t ed and
acknowl edged by t arget devi ce
0 = M SG has not been recei ved by
t arget
N bi t read onl y
13 M G11:0.0/ DN Done
1 = M SG compl et ed successf ul l y
0 = M SG not compl et e
N bi t read onl y
12 M G11:0.0/ ER Error
1 = error det ect ed
0 = no error det ect ed
N bi t read onl y
11 Reserved N bi t read onl y
10 M G11:0.0/ EW Enabl ed and Wai t i ng:
1=M SG Enabl ed and Wai t i ng
0=M SG not Enabl ed and Wai t i ng
N bi t read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
318 Communi cat i ons Inst ruct i ons
Control Bits Parameters
Ignore i f Ti med Out (TO)
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.
1 t o 9 Reserved N bi t read onl y
0 M G11:0.0/ R For PCCC M essagi ng:
Range (1 = Local , 0 = Remot e)
For CIP M essagi ng:
Target (1 = Comms M odul e,
0 = Net work Devi ce)
For M odbus M essagi ng:
Range (1 = Local )
Y bi t read onl y
Address Data Format Range Type User ProgramAccess
M G11:0/ TO Bi nary On or Of f Cont rol Read / Wri t e
Message File Sub-Element 17- Status Bits
Bit Address Description Parameter Size User
Program
Access
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 319
An easier method is to use the message timeout variable described on page 331,
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, 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.
Enabl e (EN)
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.
Enabl ed and Wai t i ng (EW)
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 ProgramAccess
M G11:0/ EN Bi nary On or Of f Cont rol Read / Wri t e
IMPORTANT Do not set t hi s bi t f rom t he cont rol program.
Address Data Format Range Type User ProgramAccess
M G11:0/ EW Bi nary On or Of f St at us Read Onl y
Address Data Format Range Type User ProgramAccess
M G11:0/ ER Bi nary On or Of f St at us Read Onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
320 Communi cat i ons Inst ruct i ons
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)
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.
St art (ST)
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.
Timing Diagramfor the
MSG Instruction
The following section describes the timing diagram for a message instruction.
Address Data Format Range Type User ProgramAccess
M G11:0/ DN Bi nary On or Of f St at us Read Onl y
Address Data Format Range Type User ProgramAccess
M G11:0/ ST Bi nary On or Of f St at us Read Onl y
EN
EW
ST
DN
ER
TO
1
0
1
0
1
0
1
0
1
0
1
0
(1) Rung goes t rue.
(3) Target node
recei ves packet .
(5) Target node processes packet
successf ul l y and ret urns dat a (read)
or acknowl edges recei pt (wri t e).
(1) (2) (3)
(5) (6)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 321
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).
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),
andan error code (37H) is placed in the MG File to inform you of the
timeout error.
2. At the next end of scan, REF, or SVC instruction, the controller determines
if it should examine the communications queue for another instruction. The
controller bases its decision on the state of the channels Communication
Servicing Selection (CSS) and Message Servicing Selection (MSS) bits, the
network communication requests from other nodes, and whether previous
message instructions are already in progress. If the controller determines
that it should not access the queue, the message instruction remains as it
was. Either the EN and EW bits remain set (1) or only the EN bit is set (1)
until the next end of scan, REF, or SVC instruction.
If the controller determines that it has an instruction in the queue, it unloads
the communications queue entries into the message buffers until all four
message buffers are full. If an invalid message is unloaded from the
communications queue, the ER bit in the MG file is set (1), and a code is
placed in the MG file to inform you of an error. When a valid message
instruction is loaded into a message buffer, the EN and EW bits for this
message are set (1).
The controller then exits the end of scan, REF, or SVC portion of the scan.
The controllers 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.
TIP The cont rol program does not have access t o t he message buf f ers or t he
communi cat i ons queue.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
322 Communi cat i ons Inst ruct i ons
Once the ST bit is set (1), the controller waits for a reply from the
targetnode. The target node is not required to respond within any given
time frame.
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).
No response may be caused by:
the target node is not there
the message became corrupted in transmission
the response was corrupted in response transmission
A NAK may be caused by:
target node is busy
target node received a corrupt message
the message is too large
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 nodes
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 323 for examples using the
messageinstruction.
TIP If t he Target Node f aul t s or power cycl es duri ng t he message t ransact i on,
you wi l l never recei ve a repl y. Thi s i s why you shoul d use a M essage
Ti meout val ue i n your M SG i nst ruct i on.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 323
MSG Instruction Ladder
Logic
Enabling the MSG Instruction for Continuous Operation
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.
Enabling the MSG Instruction Via User Supplied Input
This is an example of controlling when the message instruction operates. Input
I:1/0 could be any user-supplied bit to control when messages are sent. Whenever
I:1/0 is set and message MG11:0 is not enabled, the message instruction on rung
0001 is enabled.
0000 EN
DN
ER
M SG
Read/ Wri t e M essage
M SG Fi l e M G11:0
Set up Screen
M SG
0001
M G11:0
DN
M G11:0
ER
U
M G11:0
EN
0002 END
M essage Done Bi t
M essage Error Bi t
M essage Enabl e Bi t
0000
I:1
0
M G11:0
EN
L
B3:0
0
0001
B3:0
0
EN
DN
ER
M SG
Read/ Wri t e M essage
M SG Fi l e M G11:0
Set up Screen
M SG
0002
M G11:0
DN
M G11:0
ER
U
B3:0
0
0003 END
M essage Done Bi t
M essage Error Bi t
The message i nst ruct i on i s enabl ed wi t h each
f al se-t o-t rue t ransi t i on of bi t B3:0/ 0
User Suppl i ed
Input
M essage
Enabl e Bi t
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
324 Communi cat i ons Inst ruct i ons
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 346.
Local Networks
The following three examples represent different types of local networks.
Exampl e 1 - Local DH-485 Net work wi t h AIC+ (1761-NET-AIC) Int erf ace
Exampl e 2 - Local Devi ceNet Net work wi t h Devi ceNet Int erf ace (1761-NET-DNI)
A-B PanelView
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
AIC+ AIC+ AIC+
AIC+
DH-485Network
SLC 5/ 04
Panel Vi ew 550
M i croLogi x 1500 M i croLogi x 1000 M i croLogi x 1200
Personal
Comput er
AIC+
AIC+
DANGER
DANGER DANGER DANGER DANGER
DANGER
A-B PanelView
DNI DNI DNI
DNI
DeviceNet Network
Master
Panel Vi ew 550
Mi croLogi x 1500 M i croLogi x 1000 Mi croLogi x 1200
Personal
Comput er
DNI
DNI
SLC 5/ 03 wi t h 1747-SDN
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 325
Exampl e 3 - Local DF1 Hal f -Dupl ex Net work
Configuring a Local
Message
Message Setup Screen
The rung below shows a MSG instruction preceded by conditional logic. Access
the message setup screen by double-clicking Setup Screen.
Rockwel l Sof t ware RSLi nx 2.0 (or
hi gher), SLC 5/ 03, SLC 5/ 04, and
SLC 5/ 05, or PLC-5 processors
conf i gured f or DF1 Hal f -Dupl ex
M ast er.
RS-232
M i croLogi x
1500 (Sl ave)
SLC 5/ 04 (Sl ave)
Mi croLogi x
1000 (Sl ave)
SLC 5/ 03 wi t h 1747-KE
Int erf ace M odul e (Sl ave)
Mi croLogi x
1200 (Sl ave)
M odem
TIP It i s recommended t hat i sol at i on (1761-NET-AIC) be provi ded bet ween t he
cont rol l er and t he modem.
0000
B3:0
0
EN
DN
ER
M SG
Read/ Wri t e M essage
M SG Fi l e M G11:0
Set up Screen
M SG
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
326 Communi cat i ons Inst ruct i ons
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.
This Controller Parameters
Channel
The MicroLogix 1200 and MicroLogix 1500 1764-LSP support Channel 0
messaging only. The MicroLogix 1500 1764-LRP supports three different
pathways for messaging. Channels 0 and 1 are RS-232 ports and are functionally
identical to Channel 0 on the MicroLogix 1200 and MicroLogix 1500 1764-LSP
controllers. The 1764-LRP also supports backplane communications through the
Expansion Communication Port (ECP) as illustrated below. ECP messaging is
supported through the 1769-SDN DeviceNet scanner and 1769-SM1 DPI/
SCANport communications modules.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 327
When ECP is chosen, you are able to select which slot position (1 to 16) the
communications module resides in. The 1764-LRP processor can support up to
two communications modules with full messaging functionality.
If Channel 0 or Channel 1 is selected with that channel configured for Modbus
RTU Master, then the next line will display Modbus Command. Otherwise, the
next line displays Communication Command.
Communi cat i on Command
The controller supports six (seven for MicroLogix 1500 1764-LRP Series C and
higher) different types of communications commands. If the target device
supports any of these command types, the controller should be capable of
exchanging data with the device. Supported commands include:
TIP You can use mul t i pl e communi cat i ons modul es i n a 1764-LRP M i croLogi x
1500 syst em, but you can onl y message t hrough t he f i rst t wo. A
communi cat i ons modul e physi cal l y posi t i oned af t er t he f i rst t wo can onl y
be used f or I/ O scanni ng.
Communication Command Types
Communication
Command
Description Used For
500CPU Read The t arget devi ce i s compat i bl e wi t h and support s t he
SLC 500 command set (al l M i croLogi x cont rol l ers).
readi ng dat a
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
328 Communi cat i ons Inst ruct i ons
M odbus Command
500CPU Wri t e The t arget devi ce i s compat i bl e wi t h and support s t he
SLC 500 command set (al l M i croLogi x cont rol l ers).
sendi ng dat a
485CIF Read
(1)
The t arget devi ce i s compat i bl e wi t h and support s t he
485CIF (PLC2).
readi ng dat a
485CIF Wri t e
(1)
The t arget devi ce i s compat i bl e wi t h and support s t he
485CIF (PLC2).
sendi ng dat a
PLC5 Read The t arget devi ce i s compat i bl e wi t h and support s t he
PLC5 command set .
readi ng dat a
PLC5 Wri t e The t arget devi ce i s compat i bl e wi t h and support s t he
PLC5 command set .
sendi ng dat a
CIP Generi c
(2)
The t arget devi ce i s compat i bl e wi t h and support s t he CIP
command set on Devi ceNet (1769-SDN) or DPI/ SCANport
(1769-SM 1).
Sendi ng and
recei vi ng dat a
(1) See Import ant not e bel ow.
(2) Mi croLogi x 1500 1764-LRP Seri es C, FRN 6 and hi gher f or Devi ceNet messagi ng and DPI/ SCANport messagi ng.
IMPORTANT The Common Int erf ace Fi l e (CIF) i n t he M i croLogi x 1200, 1500, and SLC 500
processors i s Fi l e 9. The CIF i n t he M i croLogi x 1000 cont rol l er i s Int eger Fi l e 7.
Communication Command Types
Communication
Command
Description Used For
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 329
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:
Dat a Tabl e Address
This variable defines the starting address in the local controller. Valid file types for
the Data Table Address are shown below:
Modbus
(1)
Command Types
(1) M i croLogi x 1200 Seri es C, FRN 8 and hi gher; and M i croLogi x 1500 Seri es C, FRN 9 and hi gher.
Modbus Command Used For
01 Read Coi l St at us readi ng bi t s
02 Read Input St at us readi ng bi t s
03 Read Hol di ng Regi st ers readi ng words
04 Read Input Regi st ers readi ng words
05 Wri t e Si ngl e Coi l wri t i ng 1 bi t
06 Wri t e Si ngl e Regi st er wri t i ng 1 word
15 Wri t e M ul t i pl e Coi l wri t i ng mul t i pl e bi t s
16 Wri t e M ul t i pl e Regi st ers wri t i ng mul t i pl e w ords
Message Read Message Write
Bi t (B)
Ti mer (T)
Count er (C)
Cont rol (R)
Int eger (N)
Fl oat i ng Poi nt (F)
(1)
Long Word (L)
(1) Appl i es t o M i croLogi x 1200 Seri es C and l at er, and 1500 Seri es C and l at er onl y. M essage Type must be 500CPU or
PLC5. The Local Fi l e Type and Target Fi l e Type must bot h be Fl oat i ng Poi nt .
Out put (O)
Input (I)
Bi t (B)
Ti mer (T)
Count er (C)
Cont rol (R)
Int eger (N)
Fl oat i ng Poi nt (F)
(1)
Long Word (L)
St ri ng (ST)
(2)(3)
Real -Ti me Cl ock (RTC)
(2)(4)
(2) Appl i es t o M i croLogi x 1200 Seri es B and l at er, and 1500 Seri es B and l at er onl y.
(3) 485CIF wri t e ST-t o-485CIF onl y.
(4) 500CPU wri t e RTC-t o-Int eger or RTC-t o-RTC onl y.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
330 Communi cat i ons Inst ruct i ons
Si ze i n El ement s
This variable defines the amount of data (in elements) to exchange with the
targetdevice.
The maximum amount of data that can be transferred via a MSG instruction is
103words (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.
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
RTC files can be written to integer files (MicroLogix 1200 Series B and later, and
1500 Series B and later only).
TIP Onl y Bi t (B) and Int eger (N) f i l e t ypes are val i d f or M odbus Command
messages. M odbus bi t commands requi re a st art i ng bi t address f or t he
Dat a Tabl e Address.
TIP Input , out put , st ri ng, and RTC f i l e t ypes are not val i d f or read messages.
TIP The t abl e bel ow i s not i nt ended t o i l l ust rat e f i l e compat i bi l i t y, onl y t he
maxi mum number of el ement s t hat can be exchanged i n each case.
Message Type File Type Element Size MaximumNumber
of Elements per Message
485CIF O, I, B, N 1-word 103
L 2-word 51
T, C, R 3-word 34
ST 42-word 2 (wri t e onl y)
500CPU O, I, B, N 1-word 103
F
(1)
, L
2-word 51
T, C, R 3-word 34
RTC 8-word 1 (wri t e onl y)
PLC5 O, I, B, N 1-word 103
F
(1)
, L
2-word 51
T 5-word 20
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 331
Target Device Parameters
M essage Ti meout
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.
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.
CIP B, N 1-word 126
F, L 2-words 63
M odbus
Commands
(2)
B, N (command 5) 1-bi t 1
B, N (command 6) 1-word 1
B, N
(commands 1, 2, and 15)
1-bi t 1920 M odbus bi t el ement s (120
words)
(Commands 1 and 2 are read
onl y, 15 i s wri t e onl y.)
B, N
(commands 3, 4, and 16)
mul t i -regi st er 120 M odbus regi st er el ement s
(120 words)
(Commands 3 and 4 are read
onl y, 16 i s wri t e onl y.)
(1) Appl i es t o M i croLogi x 1200 Seri es C and l at er, and 1500 Seri es C and l at er onl y. M essage Type must be 500CPU or
PLC5. The Local Fi l e Type and Target Fi l e Type must bot h be Fl oat i ng Poi nt .
(2) M i croLogi x 1200 Seri es C, FRN 8 and hi gher; M i croLogi x 1500 Seri es C, FRN 9 and hi gher.
Message Type File Type Element Size MaximumNumber
of Elements per Message
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
332 Communi cat i ons Inst ruct i ons
Dat a Tabl e Address/ Of f set
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 to 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 ControlLogix processors use byte offset.
M odbus - M B Dat a Address (1-65536)
Modbus addressing is limited to 16 bits per memory group, each with a range of 1
to 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.
Message Type Local File Type Target File Type
500CPU and PLC5
O, I, B, N, F
(1)
, L
(1) Appl i es t o M i croLogi x 1200 Seri es C and l at er, and 1500 Seri es C and l at er onl y. M essage Type must be 500CPU or
PLC5. The Local Fi l e Type and Target Fi l e Type must bot h be Fl oat i ng Poi nt .
O, I, S, B, N, F
(1)
, L
T T
C C
R R
RTC
(2)
(2) 500CPU wri t e RTC-t o-Int eger or RTC-t o-RTC onl y. Appl i es t o M i croLogi x 1200 Seri es B and l at er, and 1500 Seri es B
and l at er onl y.
N, RTC
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 333
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.
Local / Sl ave Node Address
This is the destination device's node number if the devices are on a DH-485 (using
1761-NET-AIC), DeviceNet (using 1761-NET-DNI), DF1, or Modbus network.
Local / Remot e
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 (using 1761-NET-ENI), 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
communicationbridges.
Local Messaging
Examples
Five examples of local messaging are shown in this section:
500CPU message type
485CIF message type
PLC5 message type
CIP Generic message type over DeviceNet via 1747-SDN
Modbus RTU Message type
TIP M odbus prot ocol may not be consi st ent l y i mpl ement ed i n al l devi ces. The
M odbus speci f i cat i on cal l s f or t he addressi ng range t o st art at 1; however,
some devi ces st art addressi ng at 0.
The M odbus Dat a Address i n t he M essage Set up Screen may need t o be
i ncrement ed by one t o properl y access a M odbus sl aves memory,
dependi ng on t hat sl aves i mpl ement at i on of memory addressi ng.
TIP To i ni t i at e a broadcast message on a DH-485, DF1 Hal f -Dupl ex, or DF1
Radi o M odem net work, set t he l ocal node address t o -1.
To i ni t i at e a broadcast message on a M odbus net work, set t he sl ave node
address t o 0. Do not i ni t i at e more t han one M odbus broadcast message at a
t i me. When sequent i al l y t ri ggeri ng mul t i pl e M odbus broadcast messages,
i nsert at l east 10 msec. del ay i n bet ween each message.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
334 Communi cat i ons Inst ruct i ons
A summary of the message instruction configuration parameters is shown in the
following table.
Parameter Description
Thi s Cont rol l er Channel Ident i f i es t he communi cat i on channel . Al w ays Channel 0 (or Channel 1 or Expansi on
Communi cat i ons Port f or M i croLogi x 1500 1764-LRP Processor onl y.)
Communi cat i on
Command
(500CPU, 485CIF, PLC5,
and ECP message t ypes)
Speci f i es t he t ype of message. Val i d t ypes are:
500CPU Read
500CPU Wri t e
485CIF Read
485CIF Wri t e
PLC5 Read
PLC5 Wri t e
CIP Generi c
M odbus Command Speci f i es t he t ype of message. Val i d t ypes are:
01 Read Coi l St at us
02 Read Input St at us
03 Read Hol di ng Regi st ers
04 Read Input Regi st ers
05 Wri t e Si ngl e Coi l
06 Wri t e Si ngl e Regi st er
15 Wri t e M ul t i pl e Coi l s
16 Wri t e M ul t i pl e Regi st ers
Dat a Tabl e Address For a Read, t hi s i s t he st art i ng address w hi ch recei ves dat a. Val i d f i l e t ypes are B, T, C, R, N,
and L (f or M odbus commands, B and N onl y).
For a Wri t e, t hi s i s t he st art i ng address whi ch i s sent t o t he t arget devi ce. Val i d f i l e t ypes are
O, I, B, T, C, R, N, L, ST
(1)(2)
, and RTC
(2)(3)
(f or M odbus commands, B and N onl y).
Si ze i n el ement s Def i nes t he l engt h of t he message i n el ement s.
1-word el ement s; val i d si ze: 1 t o 103.
2-word el ement s; val i d si ze: 1 t o 51.
8-word RTC el ement s; val i d si ze: 1
42-word St ri ng el ement s; val i d si ze 1 t o 2
Ti mer (500CPU and 485CIF), Count er, and Cont rol el ement s; val i d si ze: 1 t o 34.
PLC-5 Ti mer el ement s; val i d si ze: 1 t o 20
M odbus bi t el ement s: 1 t o 1920
M odbus regi st er el ement s: 1 t o 120
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 335
Example 1 - Local Read froma 500CPU
M essage Inst ruct i on Set up
In this example, the controller reads 10 elements from the targets (Local Node 2)
N7 file, starting at word N7:50. The 10 words are placed in the controllers 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.
Target Devi ce M essage Ti meout Def i nes t he amount of t i me t he cont rol l er wai t s f or t he repl y bef ore t he message errors. A
t i meout of 0 seconds means t hat t he cont rol l er wai t s i ndef i ni t el y f or a repl y. Val i d range i s
f rom 0 t o 255 seconds.
Dat a Tabl e Address
(500CPU and PLC5
message t ypes)
For a Read, t hi s i s t he address i n t he processor whi ch i s t o ret urn dat a.
Val i d f i l e t ypes are S, B, T, C, R, N, and L.
For a Wri t e, t hi s i s t he address i n t he processor whi ch recei ves dat a.
Val i d f i l e t ypes are I, O, S, B, T, C, R, N, L, and RTC
(2)(4)
.
Dat a Tabl e Of f set
(485CIF message t ypes)
Thi s i s t he w ord of f set val ue i n t he common i nt erf ace f i l e (byt e of f set f or PLC devi ce) i n t he
t arget processor, whi ch i s t o send t he dat a.
M B Dat a Address Speci f i es t he M odbus address i n t he t arget devi ce. Val i d range i s f rom 1 t o 65,536.
Local Sl ave Node
Address
Speci f i es t he node number of t he devi ce t hat i s recei vi ng t he message. Val i d range i s 0 t o 31
f or DH-485 prot ocol , 0 t o 254 f or DF1 prot ocol , 0 t o 63 f or Devi ceNet , or 0 t o 247 f or M odbus.
Local / Remot e Speci f i es whet her t he message i s l ocal or remot e. (M odbus messages are l ocal onl y.)
(1) Appl i es t o M i croLogi x 1200 Seri es B and l at er, and 1500 Seri es B and l at er.
(2) 485CIF wri t e ST-t o-485CIF onl y.
(3) 500CPU wri t e RTC-t o-Int eger or RTC-t o-RTC onl y.
Parameter Description
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
336 Communi cat i ons Inst ruct i ons
Val i d Fi l e Type Combi nat i ons
Valid transfers between file types are shown below for MicroLogix messaging:
Example 2 - Local Read froma 485CIF
M essage Inst ruct i on Set up
In this example, the controller reads five elements (words) from the target devices
(Local Node 2) CIF file, starting at word 20 (or byte 20 for non-SLC 500 devices).
The five elements are placed in the controllers 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.
Local Data Types Communication Type Target Data Types
O
(1)
, I
(1)
, B, N, L
(1) Out put and i nput dat a t ypes are not val i d l ocal dat a t ypes f or read messages.
<---> read/ wri t e O, I, S, B, N, L
T <---> read/ wri t e T
C <---> read/ wri t e C
R <---> read/ wri t e R
RTC
(2)
(2) 500CPU wri t e RTC-t o-Int eger or RTC-t o-RTC onl y. Appl i es t o M i croLogi x 1200 Seri es B
and l at er, and 1500 Seri es B and l at er onl y.
---> wri t e N, RTC
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 337
Val i d Fi l e Type Combi nat i ons
Valid transfers between file types are shown below for MicroLogix messaging:
Example 3 - Local Read froma PLC-5
M essage Inst ruct i on Set up
In this example, the controller reads 10 elements from the target devices (Local
Node 2) N7 file, starting at word N7:50. The 10 words are placed in the controllers
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.
Local Data Types Communication Type Target Data Types
O
(1)
, I
(1)
, B, N, L
(1) Out put and i nput dat a t ypes are not val i d l ocal dat a t ypes f or read messages.
<---> read/ wri t e 485CIF
T <---> read/ wri t e 485CIF
C <---> read/ wri t e 485CIF
R <---> read/ wri t e 485CIF
ST
(2)
(2) Appl i es t o M i croLogi x 1200 Seri es B and l at er, and 1500 Seri es B and l at er onl y.
---> wri t e 485CIF
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
338 Communi cat i ons Inst ruct i ons
Val i d Fi l e Type Combi nat i ons
Valid transfers between file types are shown below for MicroLogix messaging:
Example 4 - Configuring a Local DeviceNet Message
This section describes how to configure a local message using the scanner and a
MicroLogix 1500 1764-LRP processor. An example network is shown below:
Local Data Types Communication Type Target Data Types
O
(1)
, I
(1)
, B, N, L
(1) Out put and i nput dat a t ypes are not val i d l ocal dat a t ypes f or read messages.
<---> read/ wri t e O, I, S, B, N, L
T <---> read/ wri t e T
C <---> read/ wri t e C
R <---> read/ wri t e R
DANGER DANGER
PC wi t h RSNet Worx
f or Devi ceNet sof t ware
Seri es 9000
Phot oeye
Redi STATION
DeviceNet Network
1770-KFD PC
Communi cat i on
M odul e
Mi croLogi x 1500 Cont rol l er I/ O
Bank wi t h 1769-SDN M odul e
M i croLogi x 1000 Cont rol l er
Connect ed vi a 1761-NET-DNI
M i croLogi x 1200 Cont rol l er
Connect ed vi a 1761-NET-DNI
1305 Dri ve Connect ed vi a 1203-GU6
Enhanced Devi ceNet Communi cat i ons M odul e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 339
M essage Set up Screen
Rung 0 shows a standard RSLogix 500 message (MSG) instruction preceded by
conditional logic.
1. Access the message setup screen by double-clicking Setup Screen.
2. The RSLogix 500 Message Setup Screen appears. This screen is used to
setup or monitor message parameters for This Controller, Target
Device, and Control Bits. Descriptions of each of these sections follow.
Thi s Cont rol l er Paramet ers
Channel
The 1764-LRP supports three different pathways for messaging, channels 0 and 1
are RS-232 ports and are functionally identical to MicroLogix 1200 and MicroLogix
1500 1764-LSP controllers. The 1764-LRP also supports backplane communications
through the Expansion Communication Port (ECP) as illustratedbelow.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
340 Communi cat i ons Inst ruct i ons
When ECP is chosen, you are able to select which slot position (1 to 16) the
scanner resides in. The 1764-LRP processor can support up to two 1769-SDN
scanner modules with full messaging functionality.
CIP Generic Communication Command
The 1764-LRP processor supports the six standard types of communications
commands (same as all other MicroLogix 1200 and 1500 controllers) and CIP
Generic on the Expansion Comms Port. When any of the six standard commands
are chosen, you can initiate standard messages to destination devices connected to
DeviceNet products that support PCCC messaging (including MicroLogix and
SLC controllers using 1761-NET-DNIs, 1203-GU6 drive interface, and other
MicroLogix 1500 controllers using 1769-SDN scanner modules). You can initiate
reads, writes, program upload/download and online monitoring across DeviceNet.
This is functionally identical to DH-485 and DH+ networking.
TIP You can use mul t i pl e 1769-SDN scanner modul es i n a 1764-LRP M i croLogi x
1500 syst em, but you can onl y message t hrough t he f i rst t wo. A scanner
physi cal l y posi t i oned af t er t he f i rst t wo can onl y be used f or I/ O scanni ng.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 341
CIP stands for Common Industrial Protocol. CIP is a newer and more versatile
protocol than PCCC. It is an open protocol that is supported by newer
Allen-Bradley controllers and third-party products.
CIP messaging is the native messaging format for DeviceNet. All DeviceNet
devices are compliant with CIP messaging. The MicroLogix 1500 1764-LRP
processor (Series C) has an enhanced message instruction that provides simple,
easy to use CIP messaging.
Selecting CIP Generic configures the message instruction to communicate with
DeviceNet devices that do not support PCCC messaging. When CIP Generic is
chosen, you will notice that a number of message parameters change and many
new ones become available depending upon the service selected.
Data Table Address (Receive and Send)
This value identifies the data file location within the 1764-LRP controller that will
receive data from the DeviceNet device, and/or the starting data file location that
will be sent to the destination DeviceNet device.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
342 Communi cat i ons Inst ruct i ons
Size in Bytes (Receive and Send)
Since all data transmitted on DeviceNet is byte based, you must enter the number
of bytes that will be received and sent. You must make sure that enough memory is
available in the destination device. Word elements within 1764-LRP controllers
contain 2 bytes each. These include Bit and Integer data files. Long word and
Floating point elements contain 4 bytes each.
For receive, the Size in bytes entered must be greater than or equal to the number
of bytes than the DeviceNet device will return. DeviceNet devices return a fixed
number of bytes depending on the Class and Service. If more data is returned than
expected, the message will error and no data will be written. If less data is returned
than expected, the data will be written and the remainder of the bytes will be filled
with zeros.
In the example screen shown below, N7:0 will receive 2 bytes (1 word) of data.
Target Devi ce
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 343
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 351). The amount of time that is acceptable
should be based on application requirements and network capacity/loading.
Target Type
You can select either Module or Network Device. If you need to message to a
device on DeviceNet, select Network Device. If you need to message to a
DeviceNet parameter on the scanner, select Module. This allows the control
program access to module parameters.
Local Node address
This is the target devices DeviceNet node number.
Service
DeviceNet uses services to provide specific messaging functions. A number of
standard services with their corresponding parameters have been preconfigured
for ease of use.
TIP Not e, many modul e paramet ers are not edi t abl e, and some can onl y be
edi t ed when t he modul e i s i n Idl e M ode.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
344 Communi cat i ons Inst ruct i ons
If you need to use a service that is not available, select one of the Generic services.
The Generic service allows you to enter specific service code parameters.
Information on what services a target device supports is usually provided in the
devices documentation.
Example 5 - Configuring a Modbus Message
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 449.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 345
M essage Set up Screen
Rung 0 shows a standard RSLogix 500 message (MSG) instruction preceded by
conditional logic.
1. Access the message setup screen by double-clicking Setup Screen.
2. The RSLogix 500 Message Setup Screen appears. This screen is used to
setup or monitor message parameters for This Controller, Target
Device, and Control Bits. Descriptions of each of these sections follow.
Thi s Cont rol l er Paramet ers
If a Channel configured for Modbus Master is selected in the Channel field of
theMessage Setup Screen, the following Modbus Command options will
becomeavailable:
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)
0000
B3:0
0
EN
DN
ER
M SG
Read/ Wri t e M essage
M SG Fi l e M G11:0
Set up Screen
M SG
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
346 Communi cat i ons Inst ruct i ons
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 Devi ce
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 351). 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 Modbus Data Address is 1. The Range is 1 to 65,536.
Slave Node Address (decimal)
The default Slave Node Address is 1. The Range is 0 to 247. Zero is the Modbus
broadcast address and is only valid for Modbus write commands (5, 6, 15 and 16).
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
DH-485 and DH+ Net works
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
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 347
1500. The MicroLogix 1500 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.
This functionality is also available on Ethernet by replacing the SLC 5/04 at
DH-485 node 17 with an SLC 5/05 processor.
DH-485and DH+Networks
Devi ceNet and Et hernet Net works
The illustration below shows a DeviceNet network using DeviceNet Interfaces
(1761-NET-DNI) connected to an Ethernet network using an SLC 5/05. In this
configuration, controllers on the DeviceNet network can reply to requests from
devices on the Ethernet network, but cannot initiate communications to devices
on Ethernet.
TIP The M i croLogi x 1000 can respond t o remot e message request s, but i t
cannot i ni t i at e t hem.
TIP The M i croLogi x 1200 capabi l i t i es are t he same as t he M i croLogi x 1500 i n
t hi s exampl e.
A-B PanelView
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE
CABLE
EXTERNAL
AIC+ AIC+ AIC+
AIC+
DH-485Network
SLC 5/ 04
Panel Vi ew 550
M i croLogi x 1500 Mi croLogi x 1000 Mi croLogi x 1200 SLC 5/ 04
AIC+
AIC+
SLC 5/ 04 PLC-5
DH+Network
Node 17
Node 19
Node 51 Node 40
Node 12
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
348 Communi cat i ons Inst ruct i ons
DeviceNet and Ethernet Networks
Configuring a Remote
Message
You configure for remote capability in the RSLogix 500 Message Setup screen.
Example Configuration Screen and Network
The message configuration shown below is for the MicroLogix 1500 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.
A-B PanelView
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE
CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE
CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE
CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM
SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
DNI DNI DNI
DNI
DeviceNet Network
SLC 5/ 03
Panel Vi ew 550
M i croLogi x 1500 M i croLogi x 1000 M i croLogi x 1200 SLC 5/ 05
DNI
DNI
SLC 5/ 05 PLC-5E
Ethernet Network
TIP The M i croLogi x 1200 capabi l i t i es are t he same as t he M i croLogi x 1500 i n
t hi s exampl e.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 349
DH-485and DH+Example Network
This Controller Parameters
See Target Device Parameters on page 331.
A-B PanelView
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE
CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE CABLE
EXTERNAL
TERM
ABCOM SHLD
CHS GND
TX
TX PWR
TX
DC SOURCE
CABLE
EXTERNAL
AIC+ AIC+ AIC+
AIC+
DH-485Network
SLC 5/ 03
Panel Vi ew 550
M i croLogi x 1500 M i croLogi x 1000 Mi croLogi x 1200 SLC 5/ 04
AIC+
AIC+
SLC 5/ 04 PLC-5
DH+Network
Node 17
Node 23octal (19decimal)
Node 63octal (51decimal) Node 40octal (32decimal)
Node 12
Node 5 Node 22
Node 11 Node 10
Link ID =100
Link ID =1
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
350 Communi cat i ons Inst ruct i ons
Control Bits Parameters
See Control Bits Parameters on page 318.
Target Device Parameters
M essage Ti meout
See Message Timeout on page 331.
Dat a Tabl e Address
See Data Table Address/Offset on page 332.
Local Bri dge Address
This variable defines the bridge address on the local network. In the example,
DH-485 node 12 (MicroLogix 1500 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 sends the message to local node 17.
Remot e Bri dge Address
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.
Remot e St at i on Address
This variable is the final destination address of the message instruction. In this
example, integer file 50 elements 0 to 4 of the SLC 5/04 on Link ID 100 at node
63 (octal) receives data from the MicroLogix 1500 controller at node 12 on
LinkID 1.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 351
Remot e Bri dge Li nk ID
This variable is a user-assigned value that defines the remote network as a number.
This number must be used by any device initiating remote messaging to that
network. In the example, any controller on Link ID 1 sending data to a device on
Link ID 100 must use the remote bridge link ID of the passthru device. In this
example, the SLC 5/04 on Link ID1, node 17 is the passthru device.
Passt hru Li nk ID
Set the Passthru 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.
MSG Instruction Error
Codes
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
programming software.
Error Code Description of Error Condition
02H Target node i s busy. NAK No M emory ret ri es by l i nk l ayer exhaust ed.
03H Target node cannot respond because message i s t oo l arge.
04H Target node cannot respond because i t does not underst and t he command paramet ers OR t he cont rol bl ock may have been
i nadvert ent l y modi f i ed.
05H Local processor i s of f -l i ne (possi bl e dupl i cat e node si t uat i on).
06H Target node cannot respond because request ed f unct i on i s not avai l abl e.
07H Target node does not respond.
08H Target node cannot respond.
09H Local modem connect i on has been l ost .
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
352 Communi cat i ons Inst ruct i ons
0BH Target node does not accept t hi s t ype of M SG i nst ruct i on.
0CH Recei ved a mast er l i nk reset (one possi bl e source i s f rom t he DF1 mast er).
0FH DCOM M but t on was act i vat ed whi l e an ASCII i nst ruct i on was wai t i ng t o execut e.
10H Target node cannot respond because of i ncorrect command paramet ers or unsupport ed command.
12H Local channel conf i gurat i on prot ocol error exi st s.
13H Local M SG conf i gurat i on error i n t he Remot e M SG paramet ers.
15H Local channel conf i gurat i on paramet er error exi st s.
16H Target or Local Bri dge address i s hi gher t han t he maxi mum node address.
17H Local servi ce i s not support ed.
18H Broadcast i s not support ed.
20H PCCC Descri pt i on: Host has a probl em and wi l l not communi cat e.
21H Bad M SG f i l e paramet er f or bui l di ng message.
30H PCCC Descri pt i on: Remot e st at i on host i s not t here, di sconnect ed, or shut down.
37H M essage t i med out i n l ocal processor.
39H Local communi cat i on channel reconf i gured whi l e M SG act i ve.
3AH STS i n t he repl y f rom t arget i s i nval i d.
40H PCCC Descri pt i on: Host coul d not compl et e f unct i on due t o hardware f aul t .
45H M SG repl y cannot be processed. Ei t her Insuf f i ci ent dat a i n M SG read repl y or bad net w ork address paramet er.
50H Target node i s out of memory.
60H Target node cannot respond because f i l e i s prot ect ed.
70H PCCC Descri pt i on: Processor i s i n Program M ode.
80H PCCC Descri pt i on: Compat i bi l i t y mode f i l e mi ssi ng or communi cat i on zone probl em.
81H M odbus Error 1: Il l egal Funct i on
82H M odbus Error 2: Il l egal Dat a Address
83H M odbus Error 3: Il l egal Dat a Val ue
84H M odbus Error 4: Sl ave Devi ce Fai l ure
85H M odbus Error 5: Acknowl edge
86H M odbus Error 6: Sl ave Devi ce Busy
87H M odbus Error 7: Negat i ve Acknowl edge
88H M odbus Error 8: M emory Pari t y Error
89H M odbus Error: Non-st andard repl y. Act ual code ret urned can be f ound i n t he upper byt e of sub-el ement 22.
90H PCCC Descri pt i on: Remot e st at i on cannot buf f er command.
B0H PCCC Descri pt i on: Remot e st at i on probl em due t o downl oad.
C0H PCCC Descri pt i on: Cannot execut e command due t o act i ve IPBs.
D0H One of t he f ol l owi ng:
No IP address conf i gured f or t he net work.
Bad command - unsol i ci t ed message error.
Bad address - unsol i ci t ed message error.
No pri vi l ege - unsol i ci t ed message error.
D1H M axi mum connect i ons used - no connect i ons avai l abl e.
D2H Inval i d i nt ernet address or host name.
D3H No such host / Cannot communi cat e wi t h t he name server.
D4H Connect i on not compl et ed bef ore userspeci f i ed t i meout .
D5H Connect i on t i med out by t he net work.
Error Code Description of Error Condition
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 353
0BH Target node does not accept t hi s t ype of M SG i nst ruct i on.
0CH Recei ved a mast er l i nk reset (one possi bl e source i s f rom t he DF1 mast er).
0FH DCOM M but t on was act i vat ed whi l e an ASCII i nst ruct i on was wai t i ng t o execut e.
10H Target node cannot respond because of i ncorrect command paramet ers or unsupport ed command.
12H Local channel conf i gurat i on prot ocol error exi st s.
13H Local M SG conf i gurat i on error i n t he Remot e M SG paramet ers.
15H Local channel conf i gurat i on paramet er error exi st s.
16H Target or Local Bri dge address i s hi gher t han t he maxi mum node address.
17H Local servi ce i s not support ed.
18H Broadcast i s not support ed.
20H PCCC Descri pt i on: Host has a probl em and wi l l not communi cat e.
21H Bad M SG f i l e paramet er f or bui l di ng message.
30H PCCC Descri pt i on: Remot e st at i on host i s not t here, di sconnect ed, or shut down.
37H M essage t i med out i n l ocal processor.
39H Local communi cat i on channel reconf i gured whi l e M SG act i ve.
3AH STS i n t he repl y f rom t arget i s i nval i d.
40H PCCC Descri pt i on: Host coul d not compl et e f unct i on due t o hardware f aul t .
45H M SG repl y cannot be processed. Ei t her Insuf f i ci ent dat a i n M SG read repl y or bad net work address paramet er.
50H Target node i s out of memory.
60H Target node cannot respond because f i l e i s prot ect ed.
70H PCCC Descri pt i on: Processor i s i n Program M ode.
80H PCCC Descri pt i on: Compat i bi l i t y mode f i l e mi ssi ng or communi cat i on zone probl em.
81H M odbus Error 1: Il l egal Funct i on
82H M odbus Error 2: Il l egal Dat a Address
83H M odbus Error 3: Il l egal Dat a Val ue
84H M odbus Error 4: Sl ave Devi ce Fai l ure
85H M odbus Error 5: Acknowl edge
86H M odbus Error 6: Sl ave Devi ce Busy
87H M odbus Error 7: Negat i ve Acknowl edge
88H M odbus Error 8: M emory Pari t y Error
89H M odbus Error: Non-st andard repl y. Act ual code ret urned can be f ound i n t he upper byt e of sub-el ement 22.
90H PCCC Descri pt i on: Remot e st at i on cannot buf f er command.
B0H PCCC Descri pt i on: Remot e st at i on probl em due t o downl oad.
C0H PCCC Descri pt i on: Cannot execut e command due t o act i ve IPBs.
D0H One of t he f ol l owi ng:
No IP address conf i gured f or t he net work.
Bad command - unsol i ci t ed message error.
Bad address - unsol i ci t ed message error.
No pri vi l ege - unsol i ci t ed message error.
D1H M axi mum connect i ons used - no connect i ons avai l abl e.
D2H Inval i d i nt ernet address or host name.
D3H No such host / Cannot communi cat e wi t h t he name server.
D4H Connect i on not compl et ed bef ore userspeci f i ed t i meout .
D5H Connect i on t i med out by t he net work.
Error Code Description of Error Condition
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
354 Communi cat i ons Inst ruct i ons
0BH Target node does not accept t hi s t ype of M SG i nst ruct i on.
0CH Recei ved a mast er l i nk reset (one possi bl e source i s f rom t he DF1 mast er).
0FH DCOM M but t on was act i vat ed whi l e an ASCII i nst ruct i on was wai t i ng t o execut e.
10H Target node cannot respond because of i ncorrect command paramet ers or unsupport ed command.
12H Local channel conf i gurat i on prot ocol error exi st s.
13H Local M SG conf i gurat i on error i n t he Remot e M SG paramet ers.
15H Local channel conf i gurat i on paramet er error exi st s.
16H Target or Local Bri dge address i s hi gher t han t he maxi mum node address.
17H Local servi ce i s not support ed.
18H Broadcast i s not support ed.
20H PCCC Descri pt i on: Host has a probl em and wi l l not communi cat e.
21H Bad M SG f i l e paramet er f or bui l di ng message.
30H PCCC Descri pt i on: Remot e st at i on host i s not t here, di sconnect ed, or shut down.
37H M essage t i med out i n l ocal processor.
39H Local communi cat i on channel reconf i gured whi l e M SG act i ve.
3AH STS i n t he repl y f rom t arget i s i nval i d.
40H PCCC Descri pt i on: Host coul d not compl et e f unct i on due t o hardware f aul t .
45H M SG repl y cannot be processed. Ei t her Insuf f i ci ent dat a i n M SG read repl y or bad net w ork address paramet er.
50H Target node i s out of memory.
60H Target node cannot respond because f i l e i s prot ect ed.
70H PCCC Descri pt i on: Processor i s i n Program M ode.
80H PCCC Descri pt i on: Compat i bi l i t y mode f i l e mi ssi ng or communi cat i on zone probl em.
81H M odbus Error 1: Il l egal Funct i on
82H M odbus Error 2: Il l egal Dat a Address
83H M odbus Error 3: Il l egal Dat a Val ue
84H M odbus Error 4: Sl ave Devi ce Fai l ure
85H M odbus Error 5: Acknowl edge
86H M odbus Error 6: Sl ave Devi ce Busy
87H M odbus Error 7: Negat i ve Acknowl edge
88H M odbus Error 8: M emory Pari t y Error
89H M odbus Error: Non-st andard repl y. Act ual code ret urned can be f ound i n t he upper byt e of sub-el ement 22.
90H PCCC Descri pt i on: Remot e st at i on cannot buf f er command.
B0H PCCC Descri pt i on: Remot e st at i on probl em due t o downl oad.
C0H PCCC Descri pt i on: Cannot execut e command due t o act i ve IPBs.
D0H One of t he f ol l owi ng:
No IP address conf i gured f or t he net work.
Bad command - unsol i ci t ed message error.
Bad address - unsol i ci t ed message error.
No pri vi l ege - unsol i ci t ed message error.
D1H M axi mum connect i ons used - no connect i ons avai l abl e.
D2H Inval i d i nt ernet address or host name.
D3H No such host / Cannot communi cat e wi t h t he name server.
D4H Connect i on not compl et ed bef ore userspeci f i ed t i meout .
D5H Connect i on t i med out by t he net work.
Error Code Description of Error Condition
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 355
0BH Target node does not accept t hi s t ype of M SG i nst ruct i on.
0CH Recei ved a mast er l i nk reset (one possi bl e source i s f rom t he DF1 mast er).
0FH DCOM M but t on was act i vat ed whi l e an ASCII i nst ruct i on was wai t i ng t o execut e.
10H Target node cannot respond because of i ncorrect command paramet ers or unsupport ed command.
12H Local channel conf i gurat i on prot ocol error exi st s.
13H Local M SG conf i gurat i on error i n t he Remot e M SG paramet ers.
15H Local channel conf i gurat i on paramet er error exi st s.
16H Target or Local Bri dge address i s hi gher t han t he maxi mum node address.
17H Local servi ce i s not support ed.
18H Broadcast i s not support ed.
20H PCCC Descri pt i on: Host has a probl em and wi l l not communi cat e.
21H Bad M SG f i l e paramet er f or bui l di ng message.
30H PCCC Descri pt i on: Remot e st at i on host i s not t here, di sconnect ed, or shut down.
37H M essage t i med out i n l ocal processor.
39H Local communi cat i on channel reconf i gured whi l e M SG act i ve.
3AH STS i n t he repl y f rom t arget i s i nval i d.
40H PCCC Descri pt i on: Host coul d not compl et e f unct i on due t o hardware f aul t .
45H M SG repl y cannot be processed. Ei t her Insuf f i ci ent dat a i n M SG read repl y or bad net work address paramet er.
50H Target node i s out of memory.
60H Target node cannot respond because f i l e i s prot ect ed.
70H PCCC Descri pt i on: Processor i s i n Program M ode.
80H PCCC Descri pt i on: Compat i bi l i t y mode f i l e mi ssi ng or communi cat i on zone probl em.
81H M odbus Error 1: Il l egal Funct i on
82H M odbus Error 2: Il l egal Dat a Address
83H M odbus Error 3: Il l egal Dat a Val ue
84H M odbus Error 4: Sl ave Devi ce Fai l ure
85H M odbus Error 5: Acknowl edge
86H M odbus Error 6: Sl ave Devi ce Busy
87H M odbus Error 7: Negat i ve Acknowl edge
88H M odbus Error 8: M emory Pari t y Error
89H M odbus Error: Non-st andard repl y. Act ual code ret urned can be f ound i n t he upper byt e of sub-el ement 22.
90H PCCC Descri pt i on: Remot e st at i on cannot buf f er command.
B0H PCCC Descri pt i on: Remot e st at i on probl em due t o downl oad.
C0H PCCC Descri pt i on: Cannot execut e command due t o act i ve IPBs.
D0H One of t he f ol l owi ng:
No IP address conf i gured f or t he net work.
Bad command - unsol i ci t ed message error.
Bad address - unsol i ci t ed message error.
No pri vi l ege - unsol i ci t ed message error.
D1H M axi mum connect i ons used - no connect i ons avai l abl e.
D2H Inval i d i nt ernet address or host name.
D3H No such host / Cannot communi cat e wi t h t he name server.
D4H Connect i on not compl et ed bef ore userspeci f i ed t i meout .
D5H Connect i on t i med out by t he net work.
Error Code Description of Error Condition
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
356 Communi cat i ons Inst ruct i ons
0BH Target node does not accept t hi s t ype of M SG i nst ruct i on.
0CH Recei ved a mast er l i nk reset (one possi bl e source i s f rom t he DF1 mast er).
0FH DCOM M but t on was act i vat ed whi l e an ASCII i nst ruct i on was wai t i ng t o execut e.
10H Target node cannot respond because of i ncorrect command paramet ers or unsupport ed command.
12H Local channel conf i gurat i on prot ocol error exi st s.
13H Local M SG conf i gurat i on error i n t he Remot e M SG paramet ers.
15H Local channel conf i gurat i on paramet er error exi st s.
16H Target or Local Bri dge address i s hi gher t han t he maxi mum node address.
17H Local servi ce i s not support ed.
18H Broadcast i s not support ed.
20H PCCC Descri pt i on: Host has a probl em and wi l l not communi cat e.
21H Bad M SG f i l e paramet er f or bui l di ng message.
30H PCCC Descri pt i on: Remot e st at i on host i s not t here, di sconnect ed, or shut down.
37H M essage t i med out i n l ocal processor.
39H Local communi cat i on channel reconf i gured whi l e M SG act i ve.
3AH STS i n t he repl y f rom t arget i s i nval i d.
40H PCCC Descri pt i on: Host coul d not compl et e f unct i on due t o hardware f aul t .
45H M SG repl y cannot be processed. Ei t her Insuf f i ci ent dat a i n M SG read repl y or bad net w ork address paramet er.
50H Target node i s out of memory.
60H Target node cannot respond because f i l e i s prot ect ed.
70H PCCC Descri pt i on: Processor i s i n Program M ode.
80H PCCC Descri pt i on: Compat i bi l i t y mode f i l e mi ssi ng or communi cat i on zone probl em.
81H M odbus Error 1: Il l egal Funct i on
82H M odbus Error 2: Il l egal Dat a Address
83H M odbus Error 3: Il l egal Dat a Val ue
84H M odbus Error 4: Sl ave Devi ce Fai l ure
85H M odbus Error 5: Acknowl edge
86H M odbus Error 6: Sl ave Devi ce Busy
87H M odbus Error 7: Negat i ve Acknowl edge
88H M odbus Error 8: M emory Pari t y Error
89H M odbus Error: Non-st andard repl y. Act ual code ret urned can be f ound i n t he upper byt e of sub-el ement 22.
90H PCCC Descri pt i on: Remot e st at i on cannot buf f er command.
B0H PCCC Descri pt i on: Remot e st at i on probl em due t o downl oad.
C0H PCCC Descri pt i on: Cannot execut e command due t o act i ve IPBs.
D0H One of t he f ol l owi ng:
No IP address conf i gured f or t he net work.
Bad command - unsol i ci t ed message error.
Bad address - unsol i ci t ed message error.
No pri vi l ege - unsol i ci t ed message error.
D1H M axi mum connect i ons used - no connect i ons avai l abl e.
D2H Inval i d i nt ernet address or host name.
D3H No such host / Cannot communi cat e wi t h t he name server.
D4H Connect i on not compl et ed bef ore userspeci f i ed t i meout .
D5H Connect i on t i med out by t he net work.
Error Code Description of Error Condition
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Communi cat i ons Inst ruct i ons 357
D7H Connect i on ref used by dest i nat i on host .
D8H Connect i on was broken.
D9H Repl y not recei ved bef ore userspeci f i ed t i meout .
DAH No net w ork buf f er space avai l abl e.
E0H Expansi on I/ O Communi cat i on M odul e Error. The error code ret urned can be f ound i n t he upper byt e of sub-el ement 22.
E1H PCCC Descri pt i on: Il l egal Address Format , a f i el d has an i l l egal val ue.
E2H PCCC Descri pt i on: Il l egal Address f ormat , not enough f i el ds speci f i ed.
E3H PCCC Descri pt i on: Il l egal Address f ormat , t oo many f i el ds speci f i ed.
E4H PCCC Descri pt i on: Il l egal Address, symbol not f ound.
E5H PCCC Descri pt i on: Il l egal Address Format , symbol i s 0 or great er t han t he maxi mum number of charact ers support by t hi s
devi ce.
E6H PCCC Descri pt i on: Il l egal Address, address does not exi st , or does not poi nt t o somet hi ng usabl e by t hi s command.
E7H Target node cannot respond because l engt h request ed i s t oo l arge.
E8H PCCC Descri pt i on: Cannot compl et e request , si t uat i on changed (f i l e si ze, f or exampl e) duri ng mul t i packet operat i on.
E9H PCCC Descri pt i on: Dat a or f i l e i s t oo l arge. M emory unavai l abl e.
EAH PCCC Descri pt i on: Request i s t oo l arge; t ransact i on si ze pl us w ord address i s t oo l arge.
EBH Target node cannot respond because t arget node deni es access.
ECH Target node cannot respond because request ed f unct i on i s current l y unavai l abl e.
EDH PCCC Descri pt i on: Resource i s al ready avai l abl e; condi t i on al ready exi st s.
EEH PCCC Descri pt i on: Command cannot be execut ed.
EFH PCCC Descri pt i on: Overf l ow; hi st ogram overf l ow.
F0H PCCC Descri pt i on: No access.
F1H Local processor det ect s i l l egal t arget f i l e t ype.
F2H PCCC Descri pt i on: Inval i d paramet er; i nval i d dat a i n search or command bl ock.
F3H PCCC Descri pt i on: Address ref erence exi st s t o del et ed area.
F4H PCCC Descri pt i on: Command execut i on f ai l ure f or unknown reason; PLC-3 hi st ogram overf l ow.
F5H PCCC Descri pt i on: Dat a conversi on error.
F6H PCCC Descri pt i on: The scanner i s not abl e t o communi cat e wi t h a 1771 rack adapt er. Thi s coul d be due t o t he scanner not
scanni ng, t he sel ect ed adapt er not bei ng scanned, t he adapt er not respondi ng, or an i nval i d request of a DCM BT (bl ock
t ransf er) .
F7H PCCC Descri pt i on: The adapt er i s not abl e t o communi cat e wi t h a modul e.
F8H PCCC Descri pt i on: The 1771 modul e response was not val i d si ze, checksum, et c.
F9H PCCC Descri pt i on: Dupl i cat ed Label .
FAH Target node cannot respond because anot her node i s f i l e owner (has sol e f i l e access).
FBH Target node cannot respond because anot her node i s program owner (has sol e access t o al l f i l es).
FCH PCCC Descri pt i on: Di sk f i l e i s wri t e prot ect ed or ot herwi se i naccessi bl e (of f -l i ne onl y).
FDH PCCC Descri pt i on: Di sk f i l e i s bei ng used by anot her appl i cat i on; updat e not perf ormed (of f -l i ne onl y).
FFH Local communi cat i on channel i s shut down.
Error Code Description of Error Condition
TIP For 1770-6.5.16 DF1 Prot ocol and Command Set Ref erence M anual
users: The M SG error code ref l ect s t he STS f i el d of t he repl y t o your
M SG i nst ruct i on.
-Codes E0 t o EF represent EXT STS codes 0 t o F.
-Codes F0 t o FC represent EXT STS codes 10 t o 1C.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
358 Communi cat i ons Inst ruct i ons
Notes:
359 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Chapter 22
Recipe (MicroLogix 1500 only) and Data Logging
(MicroLogix 1500 1764-LRP Processor only)
This chapter describes how to use the Recipe and Data Logging functions.
RCP - Recipe
(MicroLogix 1500 only)
Instruction Type: output
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.
When you create a recipe file, you chose whether to store the recipe data in User
Program memory or Data Log Queue memory.
This section contains the following topics:
Recipe File and Programming Example on page 361
Example Queue 0 on page 365
Example Queue 5 on page 366
Retrieval Tools on page 373
Information for Creating Your Own Application on page 373
The following reasons may help you chose which type of memory to use:
The advantage to using User Program memory is that you can save the
recipe data to the controllers memory module. If you use Data Log Queue,
you cannot save the recipe data to the controllers memory module.
Execution Time for the RCP Instruction
Controller Operation When Rung Is:
True False
M i croLogi x 1500 Load 30.7 s + 7.9 s/ word
+ 13.8 s/ l ong word or f l oat i ng poi nt
0.0 s
St ore 28.5 s + 8.5 s/ word
+ 15.1 s/ l ong word or f l oat i ng poi nt
0.0 s
IMPORTANT The Dat a Log Queue opt i on can onl y be used wi t h 1764-LRP M i croLogi x
1500 Seri es C or hi gher cont rol l ers. If you are usi ng a 1764-LSP M i croLogi x
1500 cont rol l er, you must sel ect User Program.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
360 Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y)
The advantage to using Data Log Queue memory is that the recipe data will
not consume User Program space. If you are not using the data logging
function, choosing Data Log Queue memory allows you more memory (up
to 48K bytes) for RCP files. You can use the Data Log Queue for data logging and
recipe data, but the total cannot exceed 48K bytes.
If you choose to use the Data Log Queue for one RCP file, all the RCP files
in your project will also use the Data Log Queue memory space.
See step 2, Create a RCP File on page 361 for the recipe file procedure.
The RCP instruction uses the following parameters:
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:
RCP Instruction Valid Addressing Modes and File Types
For def i ni t i ons of t he t erms used i n t hi s t abl e see Usi ng t he Inst ruct i on Descri pt i ons on page 4-2.
Parameter
Data Files Function Files
P
L
S
-
P
r
o
g
r
a
m
m
a
b
l
e
L
/
S
C
S
-
C
o
m
m
s
I
O
S
-
I
/
O
Address Mode Address Level
OISBT
,
C
,
R
NFS
T
LM
G
,
P
D
R
T
C
H
S
C
P
T
O
,
P
W
M
S
T
I
E
I
I
B
H
I
M
M
I
D
A
T
T
P
I
I
m
m
e
d
i
a
t
e
D
i
r
e
c
t
I
n
d
i
r
e
c
t
B
i
t
W
o
r
d
L
o
n
g
W
o
r
d
F
l
o
a
t
i
n
g
P
o
i
n
t
E
l
e
m
e
n
t
Reci pe Number
Fi l e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y) 361
Recipe File and Programming Example
Conf i guri ng t he RCP f i l e
1. Using RSLogix 500, locate and select RCP Configuration Files. Right-click and
select New.
2. Create a RCP File.
File - This is the number identifying the RCP file. It is the Recipe File
Numberused 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
20characters.
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.
User Program - You can allocate User Program (ladder logic) memory for
recipe operations. Once User Program memory is assigned for recipe use, it
cannot be used for ladder logic.
Like your ladder logic, the recipe data stored in User Program memory can
be saved to the controllers memory module (1764-MM1, -MM2,
-MM1RTC, -MM2RTC).
TIP User Program memory can be changed back f rom reci pe operat i ons t o
l adder l ogi c.
IMPORTANT When User Program memory i s used f or reci pe dat a, t he usage i s as f ol l ows:
1K words of User Program memory =
5K words of reci pe dat a memory
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
362 Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y)
Data Log Queue - For 1764-LRP processors, you can store recipe data in the
data log memory space (48K bytes).
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.
5. Change the Current Recipe from 0 to 1. Notice the addresses were
duplicated, but the data was not.
6. Enter the data for Recipe 1 as shown below.
IMPORTANT Whi l e reci pe dat a st ored i n User Program memory can be saved t o t he
cont rol l ers memory modul e, reci pe dat a st ored i n Dat a Log Queue memory
cannot be saved t o a memory modul e. Dat a Log Queue memory i s
bat t ery-backed, but cannot be saved t o a memory modul e.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y) 363
7. Change from Recipe 1 to Recipe 2 and enter the following data.
The Recipes are now configured.
8. Create the following ladder logic.
Appl i cat i on Expl anat i on of Operat i on
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
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
364 Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y)
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.
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 1764-LRP processor via
communications. This chapter explains how Data Logging is configured and used.
This section contains the following topics:
Queues and Records on page 364
Configuring Data Log Queues on page 368
DLG - Data Log Instruction on page 370
Data Log Status File on page 370
Retrieving (Reading) Records on page 372
Queues and Records
The 1764-LRP processor has 48K bytes (48 x 1024) of additional memory for data
logging purposes. Within this memory, you can define up to 256 (0 to 255) data
logging queues. Each queue is configurable by size (maximum number of records
stored), and by length (each record is 1 to 80 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.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y) 365
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.
Example Queue 0
This queue is used to show how to calculate the string length of each record and
maximum number of records.
St ri ng Lengt h of Record
The size of a record is limited so that the length of the maximum formatted string
does not exceed 80 characters. The following table can be used to determine the
formatted string length.
Data Files Function Files ProgramFiles
1
2
0
3
4to 255
STI
EII
HSC
PTO
PWM
RTC
3
4
2
5
6to 255
Q1
Q2
Q0
Q3
Q4to 255
Specialty Files
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
Data Memory Consumed Formatted String Size
del i mi t er 0 byt es 1 charact er
word 2 byt es 6 charact ers
l ong w ord 4 byt es 11 charact ers
dat e 2 byt es 10 charact ers
t i me 2 byt es 8 charact ers
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
366 Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y)
For queue 0, the formatted string length is 59 characters, as shown below:
= 10 + 1 + 8 + 1 + 6 + 1 + 11 + 1 + 6 + 1 + 6 + 1 + 6
= 59 charact ers
Number of Records
Using Queue 0 as an example, each record consumes:
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 2730. The
maximum number of records is calculated by:
M axi mum Number of Records = Dat a Log Fi l e Si ze/ Record Si ze
= 48K byt es/ 18 byt es
= (48)(1024)/ 18
= 2730 records
Example Queue 5
Data Date Time N7:11 L14:0 T4:5.ACC I1:3.0 I1:2.1
Charact ers 10 1 8 1 6 1 11 1 6 1 6 1 6
Record Field Memory Consumption
Dat e 2 byt es
Ti me 2 byt es
N7:11 2 byt es
L14:0 4 byt es
T4:5.ACC 2 byt es
I1:3.0 2 byt es
B3:2 2 byt es
Int egri t y Check 2 byt es
Total 18bytes
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
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y) 367
St ri ng Lengt h of Record
The size of a record is limited so that the length of the maximum formatted string
does not exceed 80 characters. The following table can be used to determine the
formatted string length.
For queue 5, the formatted string length is 29 characters, as shown below:
= 8 + 1 + 6 + 1 + 6 + 1 + 6 = 29 charact ers
Number of Records
Using Queue 5 as an example, each record consumes:
Each record consumes 10 bytes. So if only one queue was configured, the
maximum number of records that could be stored would be 4915. The maximum
number of records is calculated by:
M axi mum Number of Records = Dat a Log Fi l e Si ze/ Record Si ze
= 48K byt es/ 10 byt es
= (48)(1024)/ 10
= 4915 records
Data Memory Consumed Formatted String Size
del i mi t er 0 byt es 1 charact er
word 2 byt es 6 charact ers
l ong w ord 4 byt es 11 charact ers
dat e 2 byt es 10 charact ers
t i me 2 byt es 8 charact ers
Data Time N7:11 I1:3.0 I1:2.1
Charact ers 8 1 6 1 6 1 6
Record Field Memory Consumption
Ti me 2 byt es
N7:11 2 byt es
I1:3.0 2 byt es
I1:2.1 2 byt es
Int egri t y Check 2 byt es
Total 10bytes
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
368 Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y)
Configuring Data Log
Queues
Data Logging is configured using RSLogix 500 programming software version
V4.00.00 or later.
1. Open a 1764-LRP 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 Project tree:
2. The Data Log Que window appears. Double-click on Data
LogConfiguration.
Doubl e-cl i ck
Conf i gurat i on t o
access Dat a Log
Conf i gurat i on.
Appearance of Dat a
Log Que Conf i gurat i on
wi ndow bef ore
creat i ng a queue.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y) 369
3. The Data Log Que dialog box appears as shown below. Use this dialog box
to enter the queue information.
Enter the following 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.
Data Log Queue
Configuration Parameter
Description
Number of Records Def i nes t he number of records (dat a set s) i n t he queue.
Separat or Charact er Choose t he charact er t o act as t he separat or f or t he dat a i n t hi s
queue (t ab, comma, or space). The separat or charact er may be t he
same or di f f erent f or each queue conf i gured.
Dat e St amp (opt i onal )
i f sel ect ed, t he dat e i s recorded i n mm/ dd/ yyyy f ormat
(1)
.
(1) If t he real -t i me cl ock i s not present on t he cont rol l er and Dat e St amp and Ti me St amp are sel ect ed (enabl ed), t he dat e
i s recorded as 00/ 00/ 0000 and t he t i me as 00:00:00.
Ti me St amp (opt i onal )
i f sel ect ed, t he t i me i s recorded i n hh:mm:ss f ormat
(1)
.
Address t o Log Ent er t he address of an i t em t o be recorded and cl i ck on Accept t o
add t he address t o t he Current Address Li st . The address can be
any 16 or 32-bi t pi ece of dat a.
Current Address Li st Thi s i s t he l i st of i t ems t o be recorded. Record si ze can be up t o 80
byt es. You can use t he Del et e but t on t o remove i t ems f rom t hi s l i st .
See page 365 f or i nf ormat i on on record si ze.
A record consi st s of conf i gured Dat e St amp, Ti me St amp, Current Address Li st , and Separat or
Charact ers.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
370 Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y)
DLG - Data Log
Instruction
Instruction Type: output
The DLG instruction triggers the saving of a record. The DLG instruction has
oneoperand:
Queue Number - Specifies which data log queue captures a record.
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.
DLG
Dat a Log
queue number 0
DLG
Execution Time for the DLG Instruction
Controller When Rung Is:
True False
M i croLogi x 1500 1764-LRP 67.5 s + 11.8 s/ dat e st amp
+ 12.4 s/ t i me st amp
+ 9.1 s/ word l ogged
+ 16.2 s/ l ong word l ogged
6.7 s
IMPORTANT You must conf i gure a dat a l og queue bef ore programmi ng a DLG i nst ruct i on
i nt o your l adder program.
Dat a Log
queue number 0
DLG
Data Log Status (DLS) File Elements
Control Element
Word 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
0
EN
(1)
0
DN
(2)
OV
(3)
0 0 0 0 0 0 0 0 0 0 0 0
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y) 371
Dat a Loggi ng Enabl e (EN)
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.
Dat a Loggi ng Done (DN)
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.
Dat a Loggi ng Overf l ow (OV)
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.
Fi l e Si ze (FSZ)
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 St ored (RST)
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.
1 FSZ = Fi l e Si ze (number of records al l ocat ed)
2 RST = Records St ored (number of records recorded)
(1) EN = Enabl e Bi t
(2) DN = Done Bi t
(3) OV = Overf l ow Bi t
Data Log Status (DLS) File Elements
Control Element
Word 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
372 Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y)
DLS information can be used in the following types of instructions:
Retrieving (Reading)
Records
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 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.
The data is retrieved as an ASCII string with the following format:
<date><UDS><time><UDS><1
st
Data><UDS><2
nd
Data><UDS><UDS><Last Data><NUL>
where:
<dat e> = mm/ dd/ yyyy - ASCII charact ers (dat e i s opt i onal )
<t i me> = hh:mm:ss - ASCII charact ers (t i me i s opt i onal )
<UDS> = User Def i ned Separat or (TAB, COM MA, or SPACE)
<X Dat a> = ASCII deci mal represent at i on of t he val ue of t he dat a
<NUL> = record st ri ng i s nul l t ermi nat ed
If t he Real Ti me Cl ock modul e i s not present i n t he cont rol l er, <dat e> i s f ormat t ed as 00/ 00/ 0000,
and <t i me> i s f ormat t ed as 00:00:00.
The Communi cat i ons Devi ce det ermi nes t he number of set s of dat a t hat have been recorded but not
ret ri eved. See t he Dat a Log St at us Fi l e on page 370.
The cont rol l er perf orms a t he dat a i nt egri t y check f or each record. If t he dat a i nt egri t y check i s
i nval i d, a f ai l ure response i s sent t o t he Communi cat i ons Devi ce. The dat a set i s del et ed as soon as
t he f ai l ure response i s queued f or t ransmi ssi on.
TIP If a queue i s f ul l and anot her record i s saved, t he ol dest record i s
over-wri t t en. Queue behavi or i s t he same as a FIFO st ack f i rst i n, f i rst
out . If a queue i s f ul l and an addi t i onal record i s saved, t he f i rst record i s
del et ed.
Instruction Type Operand
Rel ay (Bi t ) Dest i nat i on Out put Bi t
Compare Source A
Source B
Low Li mi t (LIM i nst ruct i on)
Test (LIM i nst ruct i on)
Hi gh Li mi t (LIM i nst ruct i on)
Source (M EQ i nst ruct i on)
M ask (M EQ i nst ruct i on)
Compare (M EQ i nst ruct i on)
M at h Source A
Source B
Input (SCP i nst ruct i on)
Logi cal Source A
Source B
M ove Source
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y) 373
Accessing the Retrieval
File
You can use a dedicated retrieval tool or create your own application.
Retrieval Tools
There are a number of retrieval tools designed for use with Palm OS,
Windows CE, Windows 9x, and Windows NT. You can download these free
tools from our web site. Visit http://www.ab.com/micrologix.
Information for Creating Your Own Application
Cont rol l er Recei ves Communi cat i ons Packet
TIP For easy use wi t h M i crosof t Excel , use t he TAB charact er as t he separat or
charact er.
Command Structure
DST SRC CM D 0f STS TNS FNC A2 Byt e Si ze Fi l e No. Fi l e Tpe El e. No. S/ El e. No.
Field Function Description
DST Dest i nat i on Node
SRC Source Node
CM D Command Code
STS St at us Code Set t o zero (0)
TNS Transact i on Number Al w ays 2 byt es
FNC Funct i on Code
Byt e Si ze Number of byt es t o be read Format t ed st ri ng l engt h (see equat i on bel ow)
Fi l e Number Al w ays set t o zero (0)
Fi l e Type M ust be A5 (hex)
El ement Number Queue number Det ermi nes t he queue t o be read (0 t o 255)
Sub/ El ement Number Al w ays set t o zero (0)
Equation
Record Fi el d 1 + Record Fi el d 2 + Record Fi el d 3 + Record Fi el d 7 = Format t ed
St ri ng Lengt h
Record Field Sizes
Data Type MaximumSize
Word 7 byt es (charact ers)
Long Word 12 byt es (charact ers)
Dat e Fi el d 11 byt es (charact ers)
Ti me Fi el d 9 byt es (charact ers)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
374 Reci pe (M i croLogi x 1500 onl y) and Dat a Loggi ng (Mi croLogi x 1500 1764-LRP Processor onl y)
Cont rol l er Responds wi t h Repl y
If the data integrity check fails, the record is deleted and an error is sent with STS
of 0xF0 and ext STS of 0x0E.
For more information on writing a DF1 protocol, refer to Allen-Bradley
publication 1770-6.5.16, DF1 Protocol and Command Set Reference Manual (available
from www.theautomationbookstore.com).
Conditions that Will
Erase the Data Retrieval
File
The following conditions will cause previously logged data to be lost:
Program download from RSLogix 500 to controller.
Memory Module transfer to controller except for Memory Module autoload of the
same program.
Full Queue - when a queue is full, new records are recorded over the existing
records, starting at the beginning of the file. You can put the following rung
in your ladder program to prevent this from happening:
TIP The f ormat t ed st ri ng l engt h cannot exceed 80 byt es i n l engt h.
TIP The l ast byt e wi l l be a zero val ue represent i ng t he t ermi nat or charact er.
Reply Structure
SRC DST CM D 4f STS TNS DATA EXT STS
Field Function Description
SRC Source Node
DST Dest i nat i on Node
CM D Command Code
STS St at us Code
TNS Transact i on Number Al ways 2 byt es
DATA Format t ed st ri ng
IMPORTANT The dat a i n t he ret ri eval f i l e can onl y be read once. Then i t i s erased f rom
t he processor.
B3:1
1
LEQ
Less Than or Eql (A<=B)
Source A DLS0:5.RST
Source B DLS0:5.FSZ
LEQ DLG
Dat a Log
queue number 5
DLG
375 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Appendix A
MicroLogix 1200 Memory Usage and Instruction
Execution Time
This appendix contains a complete list of the MicroLogix 1200 programming
instructions. The list shows the memory usage and instruction execution time for
each instruction. Execution times using indirect addressing and a scan time
worksheet are also provided.
Programming
Instructions Memory
Usage and Execution
Time
The table below lists the execution times and memory usage for the programming
instructions. These values depend on whether you are using word or long word as the
data format
MicroLogix 1200Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction
Mnemonic
Word Long Word
Execution Time in s Memory
Usage in
Words
Execution Time in s Memory
Usage in
Words
False True False True
ASCII Test Buffer for Line
(1)
ABL 12.5 115 + 8.6/ char. 3.3 Long Word addressi ng l evel does not appl y.
ASCII Number of Characters in
Buffer
(1)
ACB 12.1 103.1 3.3
Absolute Value ABS 0.0 3.8
ASCII String to Integer
(1)
ACI 0.0 17.6 + 7.2/ char. 1.5 0.0 24.6 + 11.6/ char. 1.5
ASCII Clear Buffer ACL 0.0 cl ear:
bot h 249.1
recei ve 28.9
t ransmi t 33.6
1.2 Long Word addressi ng l evel does not appl y.
ASCII String Concatenate
(1)
ACN 0.0 22.6 + 11.5/
char.
2.0
Add ADD 0.0 2.7 3.3 0.0 11.9 3.5
ASCII String Extract
(1)
AEX 0.0 14.8 + 2.9/ char. 2.5 Long Word addressi ng l evel does not appl y.
ASCII Handshake Lines
(1)
AHL 11.9 109.4 5.3
ASCII Integer to String AIC 0.0 29.3 +5.2/ char. 1.4 0.0 82.0 1.6
And AND 0.0 2.2 2.8 0.0 9.2 3.0
ASCII Read Characters
(1)
ARD 11.8 132.3 + 49.7/
char.
4.3 Long Word addressi ng l evel does not appl y.
ASCII Read Line
(1)
ARL 11.7 139.7 + 50.1/
char.
4.3
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
376 M i croLogi x 1200 M emory Usage and Inst ruct i on Execut i on Ti me
ASCII String Search
(1)
ASC 0.0 16.2 + 4.0/
mat chi ng char.
6.0 Long Word addressi ng l evel does not appl y.
ASCII String Compare
(1)
ASR 0.0 9.2 + 4.0/
mat chi ng char.
1.8
ASCII Write with Append AWA 14.1 268 + 12/ char. 3.4
ASCII Write AWT 14.1 268 + 12/ char. 3.4
Bit Shift Left BSL 1.3 32 + 1.3/ word 3.8
Bit Shift Right BSR 1.3 32 + 1.3/ word 3.8
Clear CLR 0.0 1.3 1.0 0.0 6.3 1.0
File Copy COP 0.0 19 + 0.8/ word 2.0 Long Word addressi ng l evel does not appl y.
Copy Word CPW 0.0 18.3 + 0.8/ word
Count Down CTD 9.0 9.0 2.4
Count Up CTU 9.2 9.0 2.4
Decode 4-to-1of 16 DCD 0.0 1.9 1.9
Divide DIV 0.0 12.2 2.0 0.0 42.8 3.5
Encode 1-of-16to 4 ENC 0.0 7.2 1.5 Long Word addressi ng l evel does not appl y.
Equal EQU 1.1 1.3 1.3 1.9 2.8 2.6
FIFO Load FFL 11.1 11.3 3.4 11.2 11.7 3.9
FIFO Unload FFU 10.4 33 + 0.8/ word 3.4 10.4 36 + 1.5/ l ong word 3.4
Fill File FLL 0.0 14 + 0.6/ word 2.0 0.0 15 + 1.2/ l ong word 2.5
Convert fromBCD FRD 0.0 14.1 1.5 Long Word addressi ng l evel does not appl y.
Gray Code GCD 0.0 9.5
Greater Than or Equal To GEQ 1.1 1.3 1.3 2.7 2.8 2.9
Greater Than GRT 1.1 1.3 1.3 2.7 2.8 2.4
High-Speed Load HSL 0.0 46.7 7.3 0.0 47.3 7.8
Immediate Input with Mask IIM 0.0 26.4 3.0 Long Word addressi ng l evel does not appl y.
Interrupt Subroutine INT 1.0 1.0 0.3
Immediate Output with Mask IOM 0.0 22.3 3.0
J ump J MP 0.0 1.0 0.5
J ump to Subroutine J SR 0.0 8.4 1.5
Label LBL 1.0 1.0 0.5
Less Than or Equal To LEQ 1.1 1.3 1.3 2.7 2.8 2.9
Less Than LES 1.1 1.3 1.3 2.7 2.8 2.9
LIFO Load LFL 10.4 25.5 3.4 10.4 31.6 3.9
LIFO Unload LFU 10.4 29.1 3.4 10.4 31.6 3.4
Limit LIM 6.1 6.4 2.3 13.6 14.4 4.0
Master Control Reset MCR (Start) 1.2 1.2 1.0 Long Word addressi ng l evel does not appl y.
MCR (End) 1.6 1.6 1.5
Masked Comparison for Equal MEQ 1.8 1.9 1.8 3.1 3.9 3.5
Move MOV 0.0 2.4 2.5 0.0 8.3 2.0
MicroLogix 1200Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction
Mnemonic
Word Long Word
Execution Time in s Memory
Usage in
Words
Execution Time in s Memory
Usage in
Words
False True False True
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M i croLogi x 1200 Memory Usage and Inst ruct i on Execut i on Ti me 377
Message, Steady State MSG 6.0 20.0 2.9 Long Word addressi ng l evel does not appl y.
Message, False-to-True
Transition for Reads
230.0
Message, False-to-True
Transition for Writes
264 + 1.6/ word
Multiply MUL 0.0 6.8 2.0 0.0 31.9 3.5
Masked Move MVM 0.0 7.8 2.0 0.0 11.8 3.0
Negate NEG 0.0 2.9 3.0 0.0 12.1 3.0
Not Equal NEQ 1.1 1.3 1.3 2.7 2.5 2.5
Not NOT 0.0 2.4 2.5 0.0 9.2 2.5
One Shot ONS 1.9 2.6 3.5 Long Word addressi ng l evel does not appl y.
Or OR 0.0 2.2 2.8 0.0 9.2 3.0
One Shot Falling OSF 3.7 2.8 5.4 Long Word addressi ng l evel does not appl y.
One Shot Rising OSR 3.0 3.4 5.4
Output Enable OTE 1.1 1.4 1.6
Output Latch OTL 0.0 1.0 0.6
Output Unlatch OTU 0.0 1.1 0.6
Proportional Integral Derivative PID 11.0 295.8 2.4
Pulse Train Output
(1)
PTO 24.4 85.6 1.9
Pulse Width Modulation
(1)
PWM 24.7 126.6 1.9
Reset Accumulator RAC Word addressi ng l evel does not appl y. 0.0 21.2 2.0
I/O Refresh REF 0.0 see p. 380 0.5 Long Word addressi ng l evel does not appl y.
Reset RES 0.0 5.9 1.0
Return RET 0.0 1.0 0.3
Real Time Clock Adjust RTA 3.7 4.7 (556.2
f al se-t o-t rue-
t ransi t i on)
Retentive Timer On RTO 2.4 18.0 3.4
Subroutine SBR 1.0 1.0 0.3
Scale SCL 0.0 10.5 2.5
Scale with Parameters SCP 0.0 31.5 3.8 0.0 52.2 6.0
Sequencer Compare SQC 7.1 23.5 3.9 7.1 26.3 4.4
Sequencer Load SQL 7.0 21.7 3.4 7.1 24.3 3.9
Sequencer Output SQO 7.1 23.2 3.9 7.1 26.6 4.4
Square Root SQR 0.0 26.0 1.5 0.0 30.9 2.5
Selectable Timed Interrupt Start STS 0.0 57.5 1.0 Long Word addressi ng l evel does not appl y.
Subtract SUB 0.0 3.4 3.3 0.0 12.9 3.5
Suspend SUS n/ a n/ a 1.5 Long Word addressi ng l evel does not appl y.
Service Communications SVC 0.0 208 + 1.6/
word
(2)
1.0
Swap
(1)
SWP 0.0 13.7 + 2.2/
swapped word
1.5
Temporary End TND 0.0 0.9 0.5
MicroLogix 1200Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction
Mnemonic
Word Long Word
Execution Time in s Memory
Usage in
Words
Execution Time in s Memory
Usage in
Words
False True False True
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
378 M i croLogi x 1200 M emory Usage and Inst ruct i on Execut i on Ti me
Indirect Addressing
The following sections describe how indirect addressing affects the execution time
of instructions for the Micrologix 1200 controllers. 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
filetypes:
Input (I) and Output (O)
Bit (B), Integer (N)
Timer (T), Counter (C), and Control (R)
Execut i on Ti mes f or t he Indi rect Addresses
For most types of instructions that contain an indirect address(es), look up the
form of the indirect address in the table below and add that time to the execution
time of the instruction.
[*] indicates that an indirect reference is substituted.
Convert to BCD TOD 0.0 17.2 1.8 Long Word addressi ng l evel does not appl y.
Off-Delay Timer TOF 13.0 2.9 3.9
On-Delay Timer TON 3.0 18.0 3.9
User Interrupt Disable UID 0.0 0.8 0.9
User Interrupt Enable UIE 0.0 0.8 0.9
User Interrupt Flush UIF 0.0 12.3 0.9
Examine if Closed XIC 0.8 0.9 1.0
Examine if Open XIO 0.8 0.9 1.0
Exclusive Or XOR 0.0 3.0 2.8 0.0 9.9 3.0
(1) Onl y val i d f or M i croLogi x 1200 Seri es B Cont rol l ers.
(2) Thi s val ue f or t he SVC i nst ruct i on i s f or when t he communi cat i ons servi ci ng f unct i on i s accessi ng a dat a f i l e. The t i me i ncreases when
accessi ng a f unct i on f i l e.
MicroLogix 1200Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction
Mnemonic
Word Long Word
Execution Time in s Memory
Usage in
Words
Execution Time in s Memory
Usage in
Words
False True False True
MicroLogix 1200Instruction Execution Time Using Indirect Addressing
Address Form Operand Time (s) Address Form Operand Time (s)
O:1.[* ] 5.8 B3:1/ [* ] 6.8
O:[* ].0 15.0 B3:[* ]/ [* ] 7.6
O:[* ].[* ] 15.1 B[* ]:1/ [* ] 25.9
B3:[* ] 5.8 B[* ]:[* ]/ [* ] 26.2
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M i croLogi x 1200 Memory Usage and Inst ruct i on Execut i on Ti me 379
Execut i on Ti me Exampl e Word Level Inst ruct i on Usi ng and Indi rect Address
ADD Instruction Addressing
Source A: N7:[*]
Source B: T4:[*].ACC
Destination: N[*]:[*]
ADD Instruction Times
ADD Instruction: 2.7 s
Source A: 5.8 s
Source B: 6.5 s
Destination: 24.5 s
Total = 36.5 s
Execut i on Ti me Exampl e Bi t Inst ruct i on Usi ng an Indi rect Address
XIC B3/[*]
XIC: 0.9 s + 5.8 s = 6.7 s True case
XIC: 0.9 s + 5.8 s = 6.7 s False case
B[* ]:1 24.3 L8:[* ]/ 2 6.5
B[* ]:[* ] 24.5 L[* ]:1/ 2 24.6
L8:[* ] 6.1 L[* ]:[* ]/ 2 25.3
L[* ]:1 24.4 L8:1/ [* ] 6.8
L[* ]:[* ] 24.3 L8:[* ]/ [* ] 7.7
T4:[* ] 6.0 L[* ]:1/ [* ] 26.0
T[* ]:1 24.0 L[* ]:[* ]/ [* ] 25.9
T[* ]:[* ] 24.2 T4:[* ]/ DN 6.6
T4:[* ].ACC 6.5 T[* ]:1/ DN 24.4
T[* ]:1.ACC 24.4 T[* ]:[* ]/ DN 24.9
T[* ]:[* ].ACC 24.9 T4:[* ].ACC/ 2 7.4
O:1.[* ]/ 2 6.3 T[* ]:1.ACC/ 2 24.4
O:[* ].0/ 2 15.2 T[* ]:[* ].ACC/ 2 25.9
O:[* ].[* ]/ 2 15.9 T4:1/ [* ] 6.5
O:1.0/ [* ] 6.8 T4:[* ]/ [* ] 8.3
O:1.[* ]/ [* ] 7.6 T[* ]:1/ [* ] 26.1
O:[* ].0/ [* ] 16.6 T[* ]:[* ]/ [* ] 26.8
O:[* ].[* ]/ [* ] 16.9 T4:1.ACC/ [* ] 6.9
B3:[* ]/ 2 6.3 T4:[* ].ACC/ [* ] 8.9
B[* ]:1/ 2 24.5 T[* ]:1.ACC/ [* ] 26.1
B[* ]:[* ]/ 2 25.3 T[* ]:[* ].ACC/ [* ] 27.3
MicroLogix 1200Instruction Execution Time Using Indirect Addressing
Address Form Operand Time (s) Address Form Operand Time (s)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
380 M i croLogi x 1200 M emory Usage and Inst ruct i on Execut i on Ti me
MicroLogix 1200 Scan
Time Worksheet
Calculate the scan time for your control program using the worksheet below.
Communications Multiplier Table
Input Scan (sumof below)
Overhead (i f expansi on I/ O i s used) = 55 s
Expansi on Input Words X 10 s (or X 14 s i f Forci ng i s used) =
Number of modul es wi t h Input words X 80 s =
Input Scan Sub-Tot al =
ProgramScan
Add execut i on t i mes of al l i nst ruct i ons i n your program when execut ed t rue =
Program Scan Sub-Tot al =
Output Scan (sumof below)
Overhead (i f expansi on I/ O used) = 30 s
Expansi on Out put Words X 3 s (or X 7 s i f Forci ng i s used) =
Out put Scan Sub-Tot al =
Communications Overhead
(1)
Worst Case =1470 s
Typi cal Case = 530 s
Use t hi s number i f t he communi cat i ons port i s conf i gured, but not communi cat i ng t o
any ot her devi ce.
= 200 s
Use t hi s number i f t he communi cat i ons port i s i n Shut down mode. = 0 s
Communi cat i ons Overhead Sub-Tot al =
SystemOverhead
Add t hi s number i f your syst em i ncl udes a 1762-RTC or 1762-M M 1RTC. = 100 s
Housekeepi ng Overhead = 270 s
Syst em Overhead Sub-Tot al =
Totals
Sum of al l sub-t ot al s
M ul t i pl y by Communi cat i ons M ul t i pl i er f rom Tabl e X
Tot al Est i mat ed Scan Ti me =
(1) Communi cat i ons Overhead i s a f unct i on of t he devi ce connect ed t o t he cont rol l er. Thi s wi l l not occur every scan.
Protocol
Multiplier at Various Baud Rates
38.4K 19.2K 9.6K 4.8K 2.4K 1.2K 600 300
Inactive
(1)
DF1 Ful l -Dupl ex 1.50 1.27 1.16 1.12 1.10 1.09 1.09 1.08 1.00
DF1 Hal f Dupl ex 1.21 1.14 1.10 1.09 1.08 1.08 1.08 1.07 1.01
DH-485 N/ A 1.16 1.11 N/ A N/ A N/ A N/ A N/ A 1.10 at 19.2K
1.07 at 9.6K
M odbus 1.22 1.13 1.10 1.09 1.09 1.09 1.09 1.09 1.00
ASCII 1.55 1.33 1.26 1.22 1.21 1.19 1.19 1.18 1.01
Shut Down 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
(1) Inact i ve i s def i ned as No M essagi ng and No Dat a M oni t ori ng. For DH-485 prot ocol , i nact i ve means t hat t he cont rol l er i s not connect ed t o a net work.
381 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Appendix B
MicroLogix 1500 Memory Usage and Instruction
Execution Time
This appendix contains a complete list of the MicroLogix 1500 programming
instructions. The list shows the memory usage and instruction execution time for
each instruction. Execution times using indirect addressing and a scan time
worksheet are also provided.
Programming
Instructions Memory
usage and Execution
Time
The tables below lists the execution times and memory usage for the programming
instructions. These values depend on whether you are using word or long word as the
data format.
MicroLogix 1500Controllers -
Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction
Mnemonic
Word Long Word
Execution Time in s Memory
Usage in
Words
Execution Time in s Memory
Usage in
Words
False True False True
ASCII Test Buffer for Line
(1)
ABL 11.4 94 + 7.6/ char. 3.3 Long Word addressi ng l evel does not appl y.
Absolute Value ABS 0.0 3.1
ASCII Number of Characters in
Buffer
(1)
ACB 11.0 84.2 3.3 Long Word addressi ng l evel does not appl y.
ASCII String to Integer
(1)
ACI 0.0 14.2 + 6.3/
char.
1.5 0.0 20.3 + 9.5/ char. 1.5
ASCII Clear Buffer
(1)
ACL 0.0 cl ear:
bot h 203.9
recei ve 24.7
t ransmi t 29.1
1.2 Long Word addressi ng l evel does not appl y.
ASCII String Concatenate
(1)
ACN 0.0 17.9 + 10.2/
char.
2.0
Add ADD 0.0 2.5 3.3 0.0 10.4 3.5
ASCII String Extract
(1)
AEX 0.0 12.4 + 2.6/
char.
2.5 Long Word addressi ng l evel does not appl y.
ASCII Handshake Lines
(1)
AHL 10.8 89.3 5.3
ASCII Integer to String
(1)
AIC 0.0 25 + 4.3/ char. 1.4 0.0 68.7 1.6
And AND 0.0 2.0 2.8 0.0 7.9 3.0
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
382 M i croLogi x 1500 M emory Usage and Inst ruct i on Execut i on Ti me
ASCII Read Characters
(1)
ARD 10.7 108 + 44/ char. 4.3 Long Word addressi ng l evel does not appl y.
ASCII Read Line
(1)
ARL 10.6 114 + 44.3/
char.
4.3
ASCII String Search
(1)
ASC 0.0 13.4 + 3.5/
mat chi ng
char.
6.0
ASCII String Compare
(1)
ASR 0.0 7.5 + 3.5/
mat chi ng
char.
1.8 Long Word addressi ng l evel does not appl y.
ASCII Write with Append
(1)
AWA 12.5 236 + 10.6/
char.
3.4
ASCII Write
(1)
AWT 12.8 237 + 10.6/
char.
3.4
Bit Shift Left BSL 1.4 26.4 + 1.06/
w ord
3.8
Bit Shift Right BSR 1.4 26.1 + 1.07/
w ord
3.8
Clear CLR 0.0 1.2 1.0 0.0 5.5 1.0
File Copy COP 0.0 15.9 + 0.67/
w ord
2.0 Long Word addressi ng l evel does not appl y.
Copy Word CPW 0.0 15.8 + 0.7/
w ord
Count Down CTD 8.5 7.5 2.4
Count Up CTU 8.5 6.4 2.4
Decode 4-to-1of 16 DCD 0.0 0.9 1.9
Divide DIV 0.0 10.3 2.0 0.0 36.7 3.5
Data Log DLG 6.7 67.5 + 11.8/
dat e st amp
+12.4/ t i me
st amp
+9.1/ word
l ogged
2.4 6.7 67.5 + 11.8/ dat e
st amp
+12.4/ t i me st amp
+16.2/ l ong word
l ogged
2.4
Encode 1-of-16to 4 ENC 0.0 6.8 1.5 Long Word addressi ng l evel does not appl y.
Equal EQU 1.1 1.2 1.3 1.9 2.6 2.6
FIFO Load FFL 9.8 10.0 3.4 9.7 10.9 3.9
FIFO Unload FFU 9.7 27.7 + 0.65/
w ord
3.4 9.7 29.4 + 1.25/ l ong
word
3.4
Fill File FLL 0.0 12.1 + 0.43/
w ord
2.0 0.0 12.3 + 0.8/ l ong
word
2.5
Convert fromBCD FRD 0.0 12.3 1.5 Long Word addressi ng l evel does not appl y.
Gray Code GCD 0.0 9.5
Greater Than or Equal To GEQ 1.1 1.2 1.3 2.5 2.6 2.9
MicroLogix 1500Controllers -
Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction
Mnemonic
Word Long Word
Execution Time in s Memory
Usage in
Words
Execution Time in s Memory
Usage in
Words
False True False True
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M i croLogi x 1500 Memory Usage and Inst ruct i on Execut i on Ti me 383
Greater Than GRT 1.1 1.2 1.3 2.5 2.6 2.4
High-Speed Load HSL 0.0 39.7 7.3 0.0 40.3 7.8
Immediate Input with Mask IIM 0.0 22.5 3.0 Long Word addressi ng l evel does not appl y.
Interrupt Subroutine INT 1.0 1.0 0.3
Immediate Output with Mask IOM 0.0 19.4 3.0
J ump J MP 0.0 1.0 0.5
J ump to Subroutine J SR 0.0 8.0 1.5
Label LBL 1.0 1.0 0.5
Less Than or Equal To LEQ 1.1 1.2 1.3 2.5 2.6 2.9
Less Than LES 1.1 1.2 1.3 2.5 2.6 2.9
LIFO Load LFL 9.7 22.2 3.4 9.7 27.4 3.9
LIFO Unload LFU 9.7 25.6 3.4 9.7 27.4 3.4
Limit LIM 5.3 5.5 2.3 11.7 12.2 4.0
Master Control Reset MCR (Start) 0.8 0.8 1.0 Long Word addressi ng l evel does not appl y.
MCR (End) 1.0 1.0 1.5
Masked Comparison for Equal MEQ 1.7 1.7 1.8 2.9 3.5 3.5
Move MOV 0.0 2.3 2.5 0.0 6.8 2.0
Message, Steady State MSG 6.0 17.0 2.9 Long Word addressi ng l evel does not appl y.
Message, False-to-True
Transition for Reads
198.0
Message, False-to-True
Transition for Writes
226 + 1.4/
word
Multiply MUL 0.0 5.8 2.0 0.1 27.6 3.5
Masked Move MVM 0.0 7.2 2.0 0.0 10.0 3.0
Negate NEG 0.0 1.9 3.0 0.0 10.4 3.0
Not Equal NEQ 1.1 1.2 1.3 2.5 2.3 2.5
Not NOT 0.0 2.4 2.5 0.0 8.1 2.5
One Shot ONS 1.7 2.2 3.5 Long Word addressi ng l evel does not appl y.
Or OR 0.0 2.0 2.8 0.0 7.9 3.0
One Shot Falling OSF 3.4 2.7 5.4 Long Word addressi ng l evel does not appl y.
One Shot Rising OSR 2.8 3.2 5.4
Output Enable OTE 0.0 1.2 1.6
Output Latch OTL 0.0 0.9 0.6
Output Unlatch OTU 0.0 0.9 0.6
Proportional Integral Derivative PID 8.9 251.8 2.4
Pulse Train Output PTO 21.1 72.6 1.9
Pulse Width Modulation PWM 21.1 107.4 1.9
Reset Accumulator RAC Word addressi ng l evel does not
appl y.
0.0 17.8 2.0
MicroLogix 1500Controllers -
Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction
Mnemonic
Word Long Word
Execution Time in s Memory
Usage in
Words
Execution Time in s Memory
Usage in
Words
False True False True
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
384 M i croLogi x 1500 M emory Usage and Inst ruct i on Execut i on Ti me
I/O Refresh REF 0.0 see p. 386 0.5 Long Word addressi ng l evel does not appl y.
Reset RES 0.0 4.8 1.0
Return RET 0.0 1.0 0.3
Real Time Clock Adjust RTA 2.6 4.1 (426.8
f al se-t o-t rue-
t ransi t i on)
Retentive Timer On RTO 2.2 15.8 3.4
Subroutine SBR 1.0 1.0 0.3
Scale SCL 0.0 8.7 2.5
Scale with Parameters SCP 0.0 27.0 3.8 0.0 44.7 6.0
Sequencer Compare SQC 6.3 20.1 3.9 6.3 22.7 4.4
Sequencer Load SQL 6.3 19.1 3.4 6.3 21.1 3.9
Sequencer Output SQO 6.3 20.0 3.9 6.3 23.1 4.4
Square Root SQR 0.0 22.3 1.5 0.0 26.0 2.5
Selectable Timed Interrupt Start STS 0.0 50.7 1.0 Long Word addressi ng l evel does not appl y.
Subtract SUB 0.0 2.9 3.3 0.0 11.2 3.5
Suspend SUS N/ A N/ A 1.5 Long Word addressi ng l evel does not appl y.
Service Communications
(service one channel)
SVC
(2)
0.0 166 + 1.4/
w ord
1.0
Service Communications
(service two channels)
0.0 327 + 1.4/
w ord
1.0
Swap
(1)
SWP 0.0 11.7 + 1.8/
swapped
w ord
1.5
Temporary End TND 0.0 1.0 0.5
Convert to BCD TOD 0.0 14.3 1.8
Off-Delay Timer TOF 10.9 2.5 3.9
On-Delay Timer TON 2.5 15.5 3.9
User Interrupt Disable UID 0.0 0.8 0.9
User Interrupt Enable UIE 0.0 0.8 0.9
User Interrupt Flush UIF 0.0 10.6 0.9
Examine if Closed XIC 0.0 0.9 1.0
Examine if Open XIO 0.0 0.9 1.0
Exclusive Or XOR 0.0 2.3 2.8 0.0 8.9 3.0
(1) Onl y val i d f or M i croLogi x 1500 Seri es B Processors.
(2) Thi s val ue f or t he SVC i nst ruct i on i s f or when t he communi cat i ons servi ci ng f unct i on i s accessi ng a dat a f i l e. The t i me i ncreases when accessi ng a f unct i on f i l e.
MicroLogix 1500Controllers -
Memory Usage and Instruction Execution Time for Programming Instructions
Programming Instruction Instruction
Mnemonic
Word Long Word
Execution Time in s Memory
Usage in
Words
Execution Time in s Memory
Usage in
Words
False True False True
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M i croLogi x 1500 Memory Usage and Inst ruct i on Execut i on Ti me 385
Indirect Addressing
The following sections describe how indirect addressing affects the execution time
of instructions in the Micrologix 1500 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
filetypes:
Input (I) and Output (O)
Bit (B), Integer (N)
Timer (T), Counter (C), and Control (R)
Execut i on Ti mes f or t he Indi rect Addresses
For most types of instructions that contain an indirect address(es), look up the
form of the indirect address in the table below and add that time to the execution
time of the instruction.
[*] indicates that an indirect reference is substituted.
MicroLogix 1500Controllers
Instruction Execution Time Using Indirect Addressing
Address
Form
Operand
Time (s)
Address
Form
Operand
Time (s)
Address
Form
Operand
Time (s)
O:1.[* ] 4.8 O:[* ].[* ]/ 2 13.3 L[* ]:1/ [* ] 21.6
O:[* ].0 12.3 O:1.0/ [* ] 5.9 L[* ]:[* ]/ [* ] 21.9
O:[* ].[* ] 12.4 O:1.[* ]/ [* ] 6.5 T4:[* ]/ DN 5.7
B3:[* ] 4.8 O:[* ].0/ [* ] 14.1 T[* ]:1/ DN 20.4
B[* ]:1 19.9 O:[* ].[* ]/ [* ] 14.5 T[* ]:[* ]/ DN 20.7
B[* ]:[* ] 20.1 B3:[* ]/ 2 5.4 T4:[* ].ACC/ 2 6.4
L8:[* ] 5.2 B[* ]:1/ 2 20.4 T[* ]:1.ACC/ 2 20.4
L[* ]:1 20.4 B[* ]:[* ]/ 2 21.0 T[* ]:[* ].ACC/ 2 21.6
L[* ]:[* ] 20.1 B3:1/ [* ] 5.9 T4:1/ [* ] 5.9
T4:[* ] 4.9 B3:[* ]/ [* ] 6.5 T4:[* ]/ [* ] 7.1
T[* ]:1 19.7 B[* ]:1/ [* ] 21.6 T[* ]:1/ [* ] 21.8
T[* ]:[* ] 19.8 B[* ]:[* ]/ [* ] 22.3 T[* ]:[* ]/ [* ] 22.4
T4:[* ].ACC 5.1 L8:[* ]/ 2 5.5 T4:1.ACC/ [* ] 6.0
T[* ]:1.ACC 19.9 L[* ]:1/ 2 20.4 T4:[* ].ACC/ [* ] 7.5
T[* ]:[* ].ACC 20.5 L[* ]:[* ]/ 2 21.0 T[* ]:1.ACC/ [* ] 21.8
O:1.[* ]/ 2 5.4 L8:1/ [* ] 5.9 T[* ]:[* ].ACC/ [* ] 22.9
O:[* ].0/ 2 12.8 L8:[* ]/ [* ] 6.5
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
386 M i croLogi x 1500 M emory Usage and Inst ruct i on Execut i on Ti me
Execut i on Ti me Exampl e Word Level Inst ruct i on Usi ng an Indi rect Address
Execut i on Ti me Exampl e Bi t Inst ruct i on Usi ng an Indi rect Address
XIC B3/[*]
XIC: 0.9 s + 4.8 s = 5.7 s True case
XIC: 0.0 s + 4.8 s = 4.8 s False case
MicroLogix 1500 Scan
Time Worksheet
Calculate the scan time for your control program using the worksheet below.
ADD Instruction Addressing ADD Instruction Times
ADD Inst ruct i on: 2.5 s
Source A: N7:[* ] Source A: 4.8 s
Source B: T4:[* ].ACC Source B: 5.1 s
Dest i nat i on: N[* ]:[* ] Dest i nat i on: 20.1 s
Total =32.5s
Input Scan (sumof below)
Overhead (i f expansi on I/ O i s used) = 53 s
Expansi on Input Words X 3 s (or X 7.5 s i f Forci ng i s used) =
Number of modul es wi t h Input words X 10 s =
Input Scan Sub-Tot al =
ProgramScan
Add execut i on t i mes of al l i nst ruct i ons i n your program when execut ed t rue =
Program Scan Sub-Tot al =
Output Scan (sumof below)
Overhead (i f expansi on I/ O used) = 29 s
Expansi on Out put Words X 2 s (or X 6.5 s i f Forci ng i s used) =
Out put Scan Sub-Tot al =
Communications Overhead
(1)
Worst Case = 1100 s
Typi cal Case = 400 s
Use t hi s number i f t he communi cat i ons port i s conf i gured, but not communi cat i ng t o
any ot her devi ce
= 150 s
Use t hi s number i f t he communi cat i ons port i s i n Shut down mode = 0 s
Pi ck one of t he f our numbers f or Channel 0
Pi ck one of t he f our numbers f or Channel 1
Communi cat i ons Overhead Sub-Tot al =
SystemOverhead
Add t hi s number i f your syst em i ncl udes a 1764-RTC, 1764-M M 1RTC, or M M 2RTC. = 80 s
Add t hi s number i f your syst em i ncl udes a 1764-DAT = 530 s
Housekeepi ng Overhead = 240 s 240
Syst em Overhead Sub-Tot al =
Totals
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
M i croLogi x 1500 Memory Usage and Inst ruct i on Execut i on Ti me 387
Communications Multiplier Table
Sum of al l
M ul t i pl y by Communi cat i ons M ul t i pl i er f rom Tabl e X
Ti me Ti ck M ul t i pl i er (X1.02)
Tot al Est i mat ed Scan Ti me =
(1) Communi cat i ons Overhead i s a f unct i on of t he devi ce connect ed t o t he cont rol l er. Thi s wi l l not occur every scan.
Protocol
Multiplier at Various Baud Rates
38.4K 19.2K 9.6K 4.8K 2.4K 1.2K 600 300
Inactive
(1)
DF1 Ful l Dupl ex 1.39 1.20 1.13 1.10 1.09 1.08 1.08 1.08 1.00
DF1 Hal f Dupl ex 1.18 1.12 1.09 1.08 1.07 1.07 1.06 1.06 1.01
DH-485 N/ A 1.14 1.10 N/ A N/ A N/ A N/ A N/ A 1.06 at 19.2K
1.09 at 9.6K
M odbus
(2)
1.21 1.12 1.09 1.08 1.08 1.08 1.08 1.08 1.00
ASCII
(2)
1.52 1.33 1.24 1.20 1.19 1.18 1.18 1.17 1.00
Shut Down 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
(1) Inact i ve i s def i ned as No M essagi ng and No Dat a M oni t ori ng. For DH-485 prot ocol , i nact i ve means t hat t he cont rol l er i s not connect ed t o a net work.
(2) Appl i es t o M i croLogi x 1500 Seri es B Processors onl y.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
388 M i croLogi x 1500 M emory Usage and Inst ruct i on Execut i on Ti me
Notes:
389 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Appendix C
SystemStatus File
The status file lets you monitor how your controller works and lets you direct
howyou want it to work. This is done by using the status file to set up control
bitsand monitor both hardware and programming device faults and other
statusinformation.
Status File Overview
The status file (S:) contains the following words:
IMPORTANT Do not wri t e t o reserved words i n t he st at us f i l e. If you i nt end wri t i ng t o
st at us f i l e dat a, i t i s i mperat i ve t hat you f i rst underst and t he f unct i on f ul l y.
Address Function Page
S:0 Ari t hmet i c Fl ags 390
S:1 Cont rol l er M ode 391
S:2 STI M ode 396
S:2/ 9 M emory M odul e Program Compare 396
S:2/ 15 M at h Overf l ow Sel ect i on 397
S:3H Wat chdog Scan Ti me 397
S:4 Free Runni ng Cl ock 398
S:5 M i nor Error Bi t s 399
S:6 M aj or Error Code 402
S:7 Suspend Code 402
S:8 Suspend Fi l e 402
S:9 Act i ve Nodes (Nodes 0 t o 15) 403
S:10 Act i ve Nodes (Nodes 16 t o 31) 403
S:13, S:14 M at h Regi st er 403
S:15L Node Address 404
S:15H Baud Rat e 404
S:22 M axi mum Scan Ti me 404
S:29 User Faul t Rout i ne Fi l e Number 405
S:30 STI Set Poi nt 405
S:31 STI Fi l e Number 405
S:33 Channel 0 Communi cat i ons 405
S:35 Last 100 Sec Scan Ti me 407
S:36/ 10 Dat a Fi l e Overwri t e Prot ect i on Lost 407
S:37 RTC Year 407
S:38 RTC M ont h 408
S:39 RTC Day of M ont h 408
S:40 RTC Hours 408
S:41 RTC M i nut es 409
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
390 Syst em St at us Fi l e
Status File Details
Arithmetic Flags
The arithmetic flags are assessed by the processor following the execution of any
math, logical, or move instruction. The state of these bits remains in effect until the
next math, logical, or move instruction in the program is executed.
Carry Fl ag
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.
OverFl ow Fl ag
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 Fl ag
S:42 RTC Seconds 409
S:53 RTC Day of Week 409
S:57 OS Cat al og Number 410
S:58 OS Seri es 410
S:59 OS FRN 410
S:60 Processor Cat al og Number 410
S:61 Processor Seri es 410
S:62 Processor Revi si on 411
S:63 User Program Funct i onal i t y Type 411
S:64L Compi l er Revi si on - Bui l d Number 411
S:64H Compi l er Revi si on - Rel ease 411
Address Function Page
Address Data Format Range Type User ProgramAccess
S:0/ 0 bi nary 0 or 1 st at us read/ w ri t e
Address Data Format Range Type User ProgramAccess
S:0/ 1 bi nary 0 or 1 st at us read/ w ri t e
Address Data Format Range Type User ProgramAccess
S:0/ 2 bi nary 0 or 1 st at us read/ w ri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 391
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
executionresumes.
Si gn Fl ag
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
executionresumes.
Controller Mode
User Appl i cat i on M ode
Bits 0 through 4 function as follows:
Address Data Format Range Type User ProgramAccess
S:0/ 3 bi nary 0 or 1 st at us read/ wri t e
Address Data Format Range Type User ProgramAccess
S:1/ 0 t o S:1/ 4 bi nary 0 t o 1 1110 st at us read onl y
S:1/0to S:1/4 Mode
ID
Controller Mode
Use by MicroLogix Controller
(1)
S:1/4 S:1/3 S:1/2 S:1/1 S:1/0 1200 1500
0 0 0 0 0 0 remot e downl oad i n progress
0 0 0 0 1 1 remot e program mode
0 0 0 1 1 3 remot e suspend mode (operat i on hal t ed by execut i on
of t he SUS i nst ruct i on)
0 0 1 1 0 6 remot e run mode
0 0 1 1 1 7 remot e t est cont i nuous mode
0 1 0 0 0 8 remot e t est si ngl e scan mode
1 0 0 0 0 16 downl oad i n progress N/ A
1 0 0 0 1 17 program mode N/ A
1 1 0 1 1 27 suspend mode (operat i on hal t ed by execut i on of t he
SUS i nst ruct i on)
N/ A
1 1 1 1 0 30 run mode N/ A
(1) Val i d modes are i ndi cat ed by t he ( ) symbol . N/ A i ndi cat es an i nval i d mode f or t hat cont rol l er.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
392 Syst em St at us Fi l e
Forces Enabl ed
This bit is always set (1) by the controller to indicate that forces are enabled.
Forces Inst al l ed
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.
Faul t Overri de At Power-Up
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
(MicroLogix 1500 only) and the Power-Up Mode Behavior Selection bit (S:1/12).
See also:FO - Fault Override on page 62.
St art up Prot ect i on Faul t
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.
Address Data Format Range Type User ProgramAccess
S:1/ 5 bi nary 1 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:1/ 6 bi nary 0 or 1 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:1/ 8 bi nary 0 or 1 cont rol read onl y
Address Data Format Range Type User ProgramAccess
S:1/ 9 bi nary 0 or 1 cont rol read onl y
TIP When execut i ng t he st art up prot ect i on f aul t rout i ne, S:6 (maj or error f aul t
code) cont ai ns t he val ue 0016H.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 393
Load M emory M odul e On Error Or Def aul t Program
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
memorymodule 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.
The mode of the controller after the transfer takes place is determined by the
controller mode switch (MicroLogix 1500 only) and the Power-Up Mode Behavior
Selection bit (S:1/12).
See also:LE - Load on Error on page 62.
Load M emory M odul e Al ways
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
memorymodule 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 (MicroLogix 1500 only) and the Power-Up Mode Behavior
Selection bit (S:1/12).
See also:LA - Load Always on page 62.
Power-Up M ode Behavi or
If Power-Up Mode Behavior is clear (0 = Last State), the mode at power-up is
dependent upon the:
position of the mode switch (MicroLogix 1500 only)
state of the Major Error Halted flag (S:1/13)
mode at the previous power down
Address Data Format Range Type User ProgramAccess
S:1/ 10 bi nary 0 or 1 cont rol read onl y
TIP If you cl ear t he cont rol l er memory, t he cont rol l er l oads t he def aul t program.
Address Data Format Range Type User ProgramAccess
S:1/ 11 bi nary 0 or 1 cont rol read onl y
Address Data Format Range Type User ProgramAccess
S:1/ 12 bi nary 0 or 1 cont rol read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
394 Syst em St at us Fi l e
If Power Up Mode Behavior is set (1 = Run), the mode at power-up is dependent
upon the:
position of the mode switch (MicroLogix 1500 only)
state of the Major Error Halted flag (S:1/13)
The following table shows the Power-Up Mode under various conditions
See also:MB - Mode Behavior on page 62.
IMPORTANT If you want t he cont rol l er t o power-up and ent er t he Run mode, regardl ess
of any previ ous f aul t condi t i ons, you must al so set t he Faul t Overri de bi t
(S:1/ 8) so t hat t he M aj or Error Hal t ed f l ag i s cl eared bef ore det ermi ni ng t he
power up mode.
MicroLogix 1200 Major Error
Halted
Power-Up
Mode Behavior
Mode at Last Power-Down Power-Up Mode
Remote Fal se Last St at e REM Downl oad, Downl oad, REM Program,
Program or Any Test mode
REM Program
REM Suspend or Suspend REM Suspend
REM Run or Run REM Run
Run Dont Care REM Run
True Dont Care Dont Care REM Program w / Faul t
MicroLogix 1500-
Mode Switch Position
at Power-Up
Major Error
Halted
Power-Up
Mode Behavior
Mode at Last Power-Down Power-Up Mode
Program Fal se Dont Care Dont Care Program
True Program w/ Faul t
Remote Fal se Last St at e REM Downl oad, Downl oad, REM Program,
Program or Any Test mode
REM Program
REM Suspend or Suspend REM Suspend
REM Run or Run REM Run
Run Dont Care REM Run
True Dont Care Dont Care REM Program w / Faul t
Run Fal se Last St at e REM Suspend or Suspend Suspend
Any M ode except REM Suspend or Suspend Run
Run Dont Care Run
True Dont Care Dont Care
Run w/ Faul t
(1)
(1) Run w/ Faul t i s a f aul t condi t i on, j ust as i f t he cont rol l er were i n t he Program / w Faul t mode (out put s are reset and t he cont rol l er program i s not bei ng execut ed). However,
t he cont rol l er ent ers Run mode as soon as t he M aj or Error Hal t ed f l ag i s cl eared.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 395
M aj or Error Hal t ed
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.
Fut ure Access (OEM Lock)
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 53 for more information.
Fi rst Scan Bi t
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..
Address Data Format Range Type User ProgramAccess
S:1/ 13 bi nary 0 or 1 st at us read/ wri t e
ATTENTION: If you cl ear t he M aj or Error Hal t ed bi t (S:1/ 13) w hen t he
cont rol l er mode swi t ch (M i croLogi x 1500 onl y) i s i n t he RUN posi t i on, t he
cont rol l er i mmedi at el y ent ers t he RUN mode.
Address Data Format Range Type User ProgramAccess
S:1/ 14 bi nary 0 or 1 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:1/ 15 bi nary 0 or 1 st at us read/ wri t e
TIP The Fi rst Scan bi t (S:1/ 15) i s set duri ng execut i on of t he st art -up prot ect i on
f aul t rout i ne. Ref er t o S:1/ 9 f or more i nf ormat i on.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
396 Syst em St at us Fi l e
STI Mode
STI Pendi ng
This address is duplicated at STI:0/UIP. See Using the Selectable Timed Interrupt
(STI) Function File on page 242 for more information.
STI Enabl ed
This address is duplicated at STI:0/TIE. See Using the Selectable Timed Interrupt
(STI) Function File on page 242 for more information.
STI Execut i ng
This address is duplicated at STI:0/UIX. SeeUsing the Selectable Timed Interrupt
(STI) Function File on page 242 for more information.
Memory Module ProgramCompare
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.
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:2/ 0 bi nary 0 or 1 st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:2/ 1 bi nary 0 or 1 cont rol read/ wri t e
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:2/ 2 bi nary 0 or 1 cont rol read onl y
Address Data Format Range Type User ProgramAccess
S:2/ 9 bi nary 0 or 1 cont rol read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 397
An RTC module does not support program compare. If program compare is
enabled and an RTC-only module is installed, the controller does not enter an
executing mode.
See also:LPC - Load Program Compare on page 62.
Math Overflow Selection
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.
To provide protection from inadvertent alteration of your selection, program an
unconditional OTL instruction at address S:2/14 to ensure the new math overflow
operation. Program an unconditional OTU instruction at address S:2/14 to ensure
the original math overflow operation.
Watchdog Scan Time
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.
Address Data Format Range Type User ProgramAccess
S:2/ 14 bi nary 0 or 1 cont rol read/ wri t e
Address Data Format Range Type User ProgramAccess
S:3H Byt e 2 t o 255 cont rol read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
398 Syst em St at us Fi l e
If the program scan time value equals the watchdog value, a watchdog major error
is generated (code 0022H).
Free Running Clock
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 Runni ng Cl ock Compari son f or SLC 500 and M i croLogi x Cont rol l ers
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 1200 and MicroLogix 1500: 100 s/bit (0.0001 seconds/bit)
The following table illustrates the differences.
Address Data Format Range Type User ProgramAccess
S:4 bi nary 0 t o FFFF st at us read/ w ri t e
Free Running Clock Cycle Times (all Times are in Seconds)
Bit SLC 500and MicroLogix 1000 MicroLogix 1200and MicroLogix 1500
On/Off Time Cycle Time On/Off Time Cycle Time
S:4/ 0 0.010 0.020 0.0001 0.0002
S:4/ 1 0.020 0.040 0.0002 0.0004
S:4/ 2 0.040 0.080 0.0004 0.0008
S:4/ 3 0.080 0.160 0.0008 0.0160
S:4/ 4 0.160 0.320 0.0016 0.0320
S:4/ 5 0.320 0.640 0.0032 0.0640
S:4/ 6 0.640 1.280 0.0064 0.1280
S:4/ 7 1.280 2.560 0.0128 0.2560
S:4/ 8 2.560 5.120 0.0256 0.5120
S:4/ 9 5.120 10.240 0.0512 0.1024
S:4/ 10 10.240 20.480 0.1024 0.2048
S:4/ 11 20.480 40.960 0.2048 0.4096
S:4/ 12 40.960 81.92 0.4096 0.8192
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 399
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 1500, 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.
Minor Error Bits
Overf l ow Trap Bi t
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.
Cont rol Regi st er Error
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.
S:4/ 13 81.92 163.84 0.8192 1.6384
S:4/ 14 163.84 327.68 1.6384 3.2768
S:4/ 15 327.68 655.36 3.2768 6.5536
Address Data Format Range Type User ProgramAccess
S:5/ 0 bi nary 0 or 1 st at us read/ wri t e
Address Data Format Range Type User ProgramAccess
S:5/ 2 bi nary 0 or 1 st at us read/ wri t e
Free Running Clock Cycle Times (all Times are in Seconds)
Bit SLC 500and MicroLogix 1000 MicroLogix 1200and MicroLogix 1500
On/Off Time Cycle Time On/Off Time Cycle Time
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
400 Syst em St at us Fi l e
M aj or Error Det ect ed i n User Faul t Rout i ne
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.
M emory M odul e Boot
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.
M emory M odul e Password M i smat ch
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).
SeePassword Protection on page 52 for more information.
STI Lost
This address is duplicated at STI:0/UIL. SeeUsing the Selectable Timed Interrupt
(STI) Function File on page 242 for more information.
Address Data Format Range Type User ProgramAccess
S:5/ 3 bi nary 0 or 1 st at us read/ w ri t e
Address Data Format Range Type User ProgramAccess
S:5/ 8 bi nary 0 or 1 st at us read/ w ri t e
Address Data Format Range Type User ProgramAccess
S:5/ 9 bi nary 0 or 1 st at us read/ w ri t e
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:5/ 10 bi nary 0 or 1 st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 401
Ret ent i ve Dat a Lost (M i croLogi x 1200 onl y)
This bit is set (1) whenever retentive data is lost. This bit remains set until you clear
(0) it. The controller validates retentive data at power up. If user data is invalid, the
controller sets the Retentive Data Lost indicator. The data in the controller are the
values that were in the program when the program was last transferred to the
controller. If the Retentive Data Lost bit is set, a fault occurs when entering an
executing mode, but only if the Fault Override bit (S:1/8) is not set.
Processor Bat t ery Low (M i croLogi x 1500 onl y)
This bit is set (1) when the battery is low.
See also: RTC Battery Operation on page 58.
Input Fi l t er Sel ect i on M odi f i ed
This bit is set (1) whenever the discrete input filter selection in the control program
is not compatible with the hardware.
ASCII St ri ng M ani pul at i on Error
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 bit applies to the MicroLogix 1200 and 1500 Series B Controllers.
Address Data Format Range Type User ProgramAccess
S:5/ 11 bi nary 0 or 1 st at us read/ wri t e
Address Data Format Range Type User ProgramAccess
S:5/ 11 bi nary 0 or 1 st at us read onl y
IMPORTANT Inst al l a repl acement bat t ery i mmedi at el y. See your hardware manual f or
more i nf ormat i on.
Address Data Format Range Type User ProgramAccess
S:5/ 13 bi nary 0 or 1 st at us read/ wri t e
Address Data Format Range Type User ProgramAccess
S:5/ 15 bi nary 0 or 1 st at us read
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
402 Syst em St at us Fi l e
Major Error Code
This register displays a value which can be used to determine what caused a fault to
occur. SeeIdentifying Controller Faults on page 413 to learn more about
troubleshooting faults.
Suspend Code
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.
Use the SUS instruction with startup troubleshooting, or as runtime diagnostics
for detection of system errors.
Suspend File
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.
Use the SUS instruction with startup troubleshooting, or as runtime diagnostics
for detection of system errors.
Address Data Format Range Type User ProgramAccess
S:6 w ord 0 t o FFFF st at us read/ w ri t e
Address Data Format Range Type User ProgramAccess
S:7 w ord -32,768 t o
+32,767
st at us read/ w ri t e
Address Data Format Range Type User ProgramAccess
S:8 w ord 0 t o 255 st at us read/ w ri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 403
Active Nodes (Nodes 0 to 15)
This address is duplicated in the Communications Status File (CSx:0.27). See
Active Node Table Block on page 78 for more information.
Active Nodes (Nodes 16 to 31)
This address is duplicated in the Communications Status File (CSx:0.28). See
Active Node Table Block on page 78 for more information.
Math Register
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.
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:9 word 0 t o FFFF st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:10 word 0 t o FFFF st at us read onl y
Address Data Format Range Type User ProgramAccess
S:13
(l ow byt e)
word -32,768 t o
+32,767
st at us read/ wri t e
S:14
(hi gh byt e)
word -32,768 t o
+32,767
st at us read/ wri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
404 Syst em St at us Fi l e
Node Address
This address is duplicated in the Communications Status File (CSx:0.5/0 through
CSx:0.5/7). SeeGeneral Channel Status Block on page 67 for more information.
Baud Rate
This address is duplicated in the Communications Status File (CSx:0.5/8 through
CSx:0.5/15). SeeGeneral Channel Status Block on page 67 for more information.
MaximumScan Time
This word indicates the maximum observed interval between consecutive
program scans.
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.
Address
(1)
(1) Thi s byt e can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:15 (l ow byt e) byt e 0 t o 255 st at us read onl y
Address
(1)
(1) Thi s byt e can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:15 (hi gh byt e) byt e 0 t o 255 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:22 w ord 0 t o 32,767 st at us read/ w ri t e
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 405
User Fault Routine File Number
This register is used to control which subroutine executes when a User Fault
isgenerated.
STI Set Point
This address is duplicated at STI:0/SPM. SeeUsing the Selectable Timed Interrupt
(STI) Function File on page 242 for more information.
STI File Number
This address is duplicated at STI:0/PFN. SeeUsing the Selectable Timed Interrupt
(STI) Function File on page 242 for more information.
Channel 0 Communications
Incomi ng Command Pendi ng
This address is duplicated in the Communications Status File at CS0:0.4/0. See
General Channel Status Block on page 67 for more information.
Address Data Format Range Type User ProgramAccess
S:29 word 0 t o 255 st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:30 word 0 t o 65535 st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:31 word 0 t o 65535 st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:33/ 0 bi nary 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
406 Syst em St at us Fi l e
M essage Repl y Pendi ng
This address is duplicated in the Communications Status File at CS0:0.4/1. See
General Channel Status Block on page 67 for more information.
Out goi ng M essage Command Pendi ng
This address is duplicated in the Communications Status File at CS0:0.4/2. See
General Channel Status Block on page 67 for more information.
Communi cat i ons M ode Sel ect i on
This address is duplicated in the Communications Status File at CS0:0.4/3. See
General Channel Status Block on page 67 for more information.
Communi cat i ons Act i ve
This address is duplicated in the Communications Status File at CS0:0.4/4. See
General Channel Status Block on page 67 for more information.
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:33/ 1 bi nary 0 or 1 st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:33/ 2 bi nary 0 or 1 st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:33/ 3 bi nary 0 or 1 st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:33/ 4 bi nary 0 or 1 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 407
Scan Toggl e Bi t
The controller changes the status of this bit at the end of each scan. It is reset upon
entry into an executing mode.
Last 100 Sec Scan Time
This register indicates the elapsed time for the last program cycle of the controller
(in 100 s increments).
Data File Overwrite Protection Lost
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 50 for more information.
SeeSetting Download File Protection on page 49 for more information.
RTC Year
This address is duplicated in the Real-Time Clock Function File at RTC:0.YR.
SeeReal-Time Clock Function File on page 56 for more information. Note: This
value will not update while viewing online in RSLogix 500. Monitor address in function file to
see online values.
Address Data Format Range Type User ProgramAccess
S:33/ 9 bi nary 0 or 1 st at us read/ wri t e
Address Data Format Range Type User ProgramAccess
S:35 word 0 t o 32,767 st at us read/ wri t e
Address Data Format Range Type User ProgramAccess
S:36/ 10 bi nary 0 or 1 st at us read/ wri t e
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:37 word 1998 t o 2097 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
408 Syst em St at us Fi l e
RTC Month
This address is duplicated in the Real-Time Clock Function File at RTC:0.MON.
SeeReal-Time Clock Function File on page 56 for more information. Note: This
value will not update while viewing online in RSLogix 500. Monitor address in function file to
see online values.
RTC Day of Month
This address is duplicated in the Real-Time Clock Function File at RTC:0.DAY.
SeeReal-Time Clock Function File on page 56 for more information. Note: This
value will not update while viewing online in RSLogix 500. Monitor address in function file to
see online values.
RTC Hours
This address is duplicated in the Real-Time Clock Function File at RTC:0.HR.
SeeReal-Time Clock Function File on page 56 for more information. Note: This
value will not update while viewing online in RSLogix 500. Monitor address in function file to
see online values.
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:38 word 1 t o 12 st at us read onl y
Address
(1)
(1) Thi s bi t can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:39 word 1 t o 31 st at us read onl y
Address
(1)
(1) Thi s word can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:40 word 0 t o 23 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 409
RTC Minutes
This address is duplicated in the Real-Time Clock Function File at RTC:0.MIN.
SeeReal-Time Clock Function File on page 56 for more information. Note: This
value will not update while viewing online in RSLogix 500. Monitor address in function file to
see online values.
RTC Seconds
This address is duplicated in the Real-Time Clock Function File at RTC:0.SEC.
SeeReal-Time Clock Function File on page 56 for more information. Note: This
value will not update while viewing online in RSLogix 500. Monitor address in function file to
see online values.
RTC Day of Week
This address is duplicated in the Real-Time Clock Function File at RTC:0.DOW.
SeeReal-Time Clock Function File on page 56 for more information. Note: This
value will not update while viewing online in RSLogix 500. Monitor address in function file to
see online values.
Address
(1)
(1) Thi s word can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:41 word 0 t o 59 st at us read onl y
Address
(1)
(1) Thi s word can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:42 word 0 t o 59 st at us read onl y
Address
(1)
(1) Thi s word can onl y be accessed vi a l adder l ogi c. It cannot be accessed vi a communi cat i ons (such as a M essage
i nst ruct i on f rom anot her devi ce).
Data Format Range Type User ProgramAccess
S:53 word 0 t o 6 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
410 Syst em St at us Fi l e
OS Catalog Number
This register identifies the Catalog Number for the Operating System in
thecontroller.
OS Series
This register identifies the Series letter for the Operating System in the controller.
OS FRN
This register identifies the FRN of the Operating System in the controller.
Processor Catalog Number
This register identifies the Catalog Number for the processor.
Processor Series
This register identifies the Series of the processor.
Address Data Format Range Type User ProgramAccess
S:57 w ord 0 t o 32,767 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:58 ASCII A t o Z st at us read onl y
Address Data Format Range Type User ProgramAccess
S:59 w ord 0 t o 32,767 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:60 ASCII A t o ZZ st at us read onl y
Address Data Format Range Type User ProgramAccess
S:61 ASCII A t o Z st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Syst em St at us Fi l e 411
Processor Revision
This register identifies the revision (Boot FRN) of the processor.
User ProgramFunctionality Type
This register identifies the level of functionality of the user program in
thecontroller.
Compiler Revision - Build Number
This register identifies the Build Number of the compiler which created the
program in the controller.
Compiler Revision - Release
This register identifies the Release of the compiler which created the program in
the controller.
Address Data Format Range Type User ProgramAccess
S:62 word 0 t o 32,767 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:63 word 0 t o 32,767 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:64 (l ow byt e) byt e 0 t o 255 st at us read onl y
Address Data Format Range Type User ProgramAccess
S:64 (hi gh byt e) byt e 0 t o 255 st at us read onl y
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
412 Syst em St at us Fi l e
Notes:
413 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Appendix D
Fault Messages and Error Codes
This chapter describes how to troubleshoot your controller. Topics include:
identifying controller faults
contacting Rockwell Automation for assistance
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.
Automatically Clearing Faults
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 389.
TIP You can decl are your own appl i cat i on-speci f i c maj or f aul t by wri t i ng your
own uni que val ue t o S:6 and t hen set t i ng bi t S:1/ 13 t o prevent reusi ng
syst em def i ned codes. The recommended val ues f or user-def i ned f aul t s are
FF00 t o FF0F.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
414 Faul t M essages and Error Codes
Manually Clearing Faults Using the Fault Routine
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 236 for information on creating a user fault subroutine.
Fault Messages
This section contains fault messages that can occur during operation of the
MicroLogix 1200 and MicroLogix 1500 programmable controllers. Each table
liststhe error code description, the probable cause, and the recommended
corrective action.
Error
Code
(Hex)
Advisory Message Description Fault
Classification
Recommended Action
0001 NVRAM ERROR The def aul t program i s l oaded t o t he
cont rol l er memory. Thi s occurs:
i f a power down occurred duri ng
program downl oad or t ransf er
f rom t he memory modul e.
RAM i nt egri t y t est f ai l ed.
FLASH i nt egri t y t est f ai l ed
(M i croLogi x 1200 onl y).
Non-User Re-dow nl oad or t ransf er t he program.
Veri f y bat t ery i s connect ed (M i croLogi x
1500 onl y).
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve i f t he error persi st s.
0002 UNEXPECTED RESET The cont rol l er was unexpect edl y
reset due t o a noi sy envi ronment
or i nt ernal hardware f ai l ure.
The def aul t program i s l oaded.
(M i croLogi x 1500 onl y)
Ret ent i ve Dat a i s l ost . See page
401. (M i croLogi x 1200 onl y)
Non-User Ref er t o proper groundi ng gui del i nes and
usi ng surge suppressors i n your
cont rol l ers User M anual .
Veri f y bat t ery i s connect ed (M i croLogi x
1500 onl y).
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve i f t he error persi st s.
0003 M EM ORY M ODULE
USER PROGRAM IS
CORRUPT
M emory modul e memory error. Thi s
error can al so occur when goi ng t o
t he Run mode.
Non-User Re-program t he memory modul e. If t he error
persi st s, repl ace t he memory modul e.
0004 M EM ORY INTEGRITY
ERROR
Whi l e t he cont rol l er was powered
up, ROM or RAM became corrupt .
Non-User Cycl e power on your uni t . Then,
re-dow nl oad your program and st art up
your syst em.
Ref er t o proper groundi ng gui del i nes and
usi ng surge suppressors i n your
cont rol l ers User M anual .
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve i f t he error persi st s.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Faul t M essages and Error Codes 415
0005 RETENTIVE DATA IS
LOST (M i croLogi x
1200 onl y)
Ret ent i ve Dat a i s l ost . See page 401. Recoverabl e Cont act your l ocal Rockwel l Aut omat i on
represent at i ve i f t he error persi st s.
0006 M EM ORY M ODULE
HARDWARE FAULT
The memory modul e hardware
f aul t ed or t he memory modul e i s
i ncompat i bl e w i t h OS.
Non-User Upgrade t he OS t o be compat i bl e wi t h
memory modul e.
Obt ai n a new memory modul e.
0007 M EM ORY M ODULE
TRANSFER ERROR
Fai l ure duri ng memory modul e
t ransf er.
Non-User Re-at t empt t he t ransf er. If t he error persi st s,
repl ace t he memory modul e.
0008 FATAL INTERNAL
SOFTWARE ERROR
An unexpect ed sof t ware error
occurred.
Non-User Cycl e pow er on your uni t . Then,
re-downl oad your program and
re-i ni t i al i ze any necessary dat a.
St art up your syst em.
Ref er t o proper groundi ng gui del i nes and
usi ng surge suppressors i n your
cont rol l ers User M anual .
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve i f t he error persi st s.
0009 FATAL INTERNAL
HARDWARE ERROR
An unexpect ed hardware error
occurred.
Non-User Cycl e pow er on your uni t . Then,
re-downl oad your program and
re-i ni t i al i ze any necessary dat a.
St art up your syst em.
Ref er t o proper groundi ng gui del i nes and
usi ng surge suppressors i n your
cont rol l ers User M anual .
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve i f t he error persi st s.
000A OS M ISSING OR
CORRUPT
The operat i ng syst em requi red f or
t he user program i s corrupt or
mi ssi ng.
Non-User Downl oad a new OS usi ng Cont rol Fl ash.
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve f or more i nf ormat i on about
avai l abl e operat i ng syst ems your
cont rol l er.
000B BASE HARDWARE
FAULT
The base hardware f aul t ed or i s
i ncompat i bl e w i t h t he OS.
Non-User Upgrade t he OS usi ng Cont rol Fl ash.
Repl ace t he Cont rol l er (M i croLogi x 1200
onl y).
Repl ace t he Base Uni t (M i croLogi x 1500
onl y).
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve f or more i nf ormat i on about
avai l abl e operat i ng syst ems your
cont rol l er.
0011 EXECUTABLE FILE 2 IS
M ISSING
Ladder Fi l e 2 i s mi ssi ng f rom t he
program.
Non-User Re-compi l e and rel oad t he program.
Error
Code
(Hex)
Advisory Message Description Fault
Classification
Recommended Action
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
416 Faul t M essages and Error Codes
0012 LADDER PROGRAM
ERROR
The l adder program has a memory
i nt egri t y probl em.
Non-User Rel oad t he program or re-compi l e and
rel oad t he program. If t he error persi st s,
be sure t o use RSI programmi ng sof t w are
t o devel op and l oad t he program.
Ref er t o proper groundi ng gui del i nes and
usi ng surge suppressors i n your
cont rol l ers User M anual .
0015 I/ O CONFIGURATION
FILE ERROR
The user program I/ O conf i gurat i on
i s i nval i d.
Non-User Re-compi l e and rel oad t he program, and ent er
t he Run mode. If t he error persi st s, be sure t o
use RSI programmi ng sof t ware t o devel op
and l oad t he program.
0016 STARTUP
PROTECTION FAULT
The user f aul t rout i ne was execut ed
at power-up, pri or t o t he mai n l adder
program. Bi t S:1/ 13 (M aj or Error
Hal t ed) was not cl eared at t he end of
t he User Faul t Rout i ne. The User
Faul t Rout i ne ran because bi t S:1/ 9
was set at power-up.
Recoverabl e Ei t her reset bi t S:1/ 9 i f t hi s i s consi st ent
wi t h t he appl i cat i on requi rement s, and
change t he mode back t o RUN, or
cl ear S:1/ 13, t he M aj or Error Hal t ed bi t ,
bef ore t he end of t he User Faul t Rout i ne.
0017 NVRAM / M EM ORY
M ODULE USER
PROGRAM
M ISM ATCH
Bi t S:2/ 9 i s set i n t he cont rol l er and
t he memory modul e user program
does not mat ch t he cont rol l er user
program.
Non-Recoverabl e Transf er t he memory modul e program t o t he
cont rol l er and t hen change t o Run mode.
0018 M EM ORY M ODULE
USER PROGRAM
INCOM PATIBLE WITH
OS
The user program i n t he memory
modul e i s i ncompat i bl e w i t h t he OS.
Non-User Upgrade t he OS usi ng Cont rol Fl ash t o be
compat i bl e wi t h t he memory modul e.
Obt ai n a new memory modul e.
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve f or more i nf ormat i on about
avai l abl e operat i ng syst ems your
cont rol l er.
001A USER PROGRAM
INCOM PATIBLE WITH
OS AT POWER-UP
The user program i s i ncompat i bl e
wi t h t he OS.
Non-User Upgrade t he OS usi ng Cont rol Fl ash.
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve f or more i nf ormat i on about
avai l abl e operat i ng syst ems your
cont rol l er.
0020 M INOR ERROR AT
END-OF-SCAN
DETECTED
A mi nor f aul t bi t (bi t s 0-7) i n S:5 was
set at t he end of scan.
Recoverabl e Correct t he i nst ruct i on l ogi c causi ng t he
error.
Ent er t he st at us f i l e di spl ay i n your
programmi ng sof t ware and cl ear t he
f aul t .
Ent er t he Run mode.
Error
Code
(Hex)
Advisory Message Description Fault
Classification
Recommended Action
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Faul t M essages and Error Codes 417
0021 EXPANSION POWER
FAIL (EPF)
(M i croLogi x 1500 onl y)
A power f ai l ure i s present on t he
expansi on I/ O bank.
Thi s error code i s present when t he
cont rol l er i s powered, and power i s
not appl i ed t o t he expansi on I/ O
bank. Thi s i s a sel f -cl eari ng error
code. When power i s re-appl i ed t o
t he expansi on I/ O bank, t he f aul t i s
cl eared. See Import ant not e bel ow.
Non-User Re-appl y power t o t he expansi on I/ O bank.
See Import ant not e bel ow.
IMPORTANT
If t hi s f aul t occurs whi l e t he syst em i s i n t he RUN mode, t he cont rol l er f aul t s. When expansi on I/ O
power i s rest ored, t he cont rol l er cl ears t he f aul t and re-ent ers t he RUN mode.
If you change t he mode swi t ch whi l e t hi s f aul t i s present , t he cont rol l er may not re-ent er t he RUN mode
when expansi on I/ O power i s rest ored.
If an EPF condi t i on i s present and expansi on I/ O power i s OK, t oggl e t he mode swi t ch t o PROGRAM and
t hen t o RUN. The f aul t shoul d cl ear and t he cont rol l er ent ers t he RUN mode.
TIP Thi s error may al so occur i f t here i s a hardware f ai l ure on
t he bus wi t h ei t her a M i croLogi x 1200 or M i croLogi x
1500 cont rol l er.
Cycl e pow er on your uni t .
Cont act your l ocal Rockwel l Aut omat i on
represent at i ve i f t he error persi st s.
0022 WATCHDOG TIM ER
EXPIRED, SEE S:3
The program scan t i me exceeded t he
wat chdog t i meout val ue (S:3H).
Non-Recoverabl e Det ermi ne i f t he program i s caught i n a
l oop and correct t he probl em.
Increase t he wat chdog t i meout val ue i n
t he st at us f i l e.
0023 STI ERROR An error occurred i n t he STI
conf i gurat i on.
Recoverabl e See t he Error Code i n t he STI Funct i on Fi l e f or
t he speci f i c error.
0028 INVALID OR
NONEXISTENT USER
FAULT ROUTINE
VALUE
A f aul t rout i ne number was
ent ered i n t he st at us f i l e,
number (S:29), but ei t her t he
f aul t rout i ne was not physi cal l y
creat ed, or
t he f aul t rout i ne number was
l ess t han 3 or great er t han 255.
Non-User Ei t her cl ear t he f aul t rout i ne f i l e number
(S:29) i n t he st at us f i l e, or
creat e a f aul t rout i ne f or t he f i l e number
ref erence i n t he st at us f i l e (S:29). The f i l e
number must be great er t han 2 and l ess
t han 256.
0029 INSTRUCTION
INDIRECTION
OUTSIDE OF DATA
SPACE
An i ndi rect address ref erence i n t he
l adder program i s out si de of t he
ent i re dat a f i l e space.
Recoverabl e Correct t he program t o ensure t hat t here are
no i ndi rect ref erences out si de dat a f i l e space.
Re-compi l e, rel oad t he program and ent er t he
Run mode.
002E EII ERROR An error occurred i n t he EII
conf i gurat i on.
Recoverabl e See t he Error Code i n t he EII Funct i on Fi l e f or
t he speci f i c error.
0030 SUBROUTINE
NESTING EXCEEDS
LIM IT
The JSR i nst ruct i on nest i ng l evel
exceeded t he cont rol l er memory
space.
Non-User Correct t he user program t o reduce t he
nest i ng l evel s used and t o meet t he
rest ri ct i ons f or t he JSR i nst ruct i on. Then
rel oad t he program and Run.
0031 UNSUPPORTED
INSTRUCTION
DETECTED
The program cont ai ns an
i nst ruct i on(s) t hat i s not support ed
by t he cont rol l er.
Non-User M odi f y t he program so t hat al l
i nst ruct i ons are support ed by t he
cont rol l er.
Re-compi l e and rel oad t he program and
ent er t he Run mode.
Error
Code
(Hex)
Advisory Message Description Fault
Classification
Recommended Action
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
418 Faul t M essages and Error Codes
0032 SQO/ SQC/ SQL
OUTSIDE OF DATA
FILE SPACE
A sequencer i nst ruct i on l engt h/
posi t i on paramet er ref erences
out si de of t he ent i re dat a f i l e space.
Recoverabl e Correct t he program t o ensure t hat t he
l engt h and posi t i on paramet ers do not
poi nt out si de dat a f i l e space.
Re-compi l e, rel oad t he program and ent er
t he Run mode.
0033 BSL/ BSR/ FFL/ FFU/ LFL/
LFU CROSSED DATA
FILE SPACE
The l engt h/ posi t i on paramet er of a
BSL, BSR, FFL, FFU, LFL, or LFU
i nst ruct i on ref erences out si de of t he
ent i re dat a f i l e space.
Recoverabl e Correct t he program t o ensure t hat t he
l engt h and posi t i on paramet ers do not
poi nt out si de of t he dat a space.
Re-compi l e, rel oad t he program and ent er
t he Run mode.
0034 NEGATIVE VALUE IN
TIM ER PRESET OR
ACCUM ULATOR
A negat i ve val ue was l oaded t o a
t i mer preset or accumul at or.
Recoverabl e If t he program i s movi ng val ues t o t he
accumul at ed or preset word of a t i mer,
make cert ai n t hese val ues are not
negat i ve.
Rel oad t he program and ent er t he Run
mode.
0035 ILLEGAL
INSTRUCTION IN
INTERRUPT FILE
The program cont ai ns a Temporary
End (TND), Ref resh (REF), or Servi ce
Communi cat i on i nst ruct i on i n an
i nt errupt subrout i ne (STI, EII, HSC) or
user f aul t rout i ne.
Non-Recoverabl e Correct t he program.
Re-compi l e, rel oad t he program and ent er
t he Run mode.
0036 INVALID PID
PARAM ETER
An i nval i d val ue i s bei ng used f or a
PID i nst ruct i on paramet er.
Recoverabl e See page 253, Process Cont rol Inst ruct i on f or
more i nf ormat i on about t he PID i nst ruct i on.
0037 HSC ERROR An error occurred i n t he HSC
conf i gurat i on.
Recoverabl e See t he Error Code i n t he HSC Funct i on Fi l e
f or t he speci f i c error.
003B PTO ERROR An error occurred i n t he PTO
i nst ruct i on conf i gurat i on.
Recoverabl e or
Non-User
See t he Error Code i n t he PTO Funct i on Fi l e f or
t he speci f i c error.
003C PWM ERROR An error occurred i n t he PWM
i nst ruct i on conf i gurat i on.
Recoverabl e or
Non-User
See t he Error Code i n t he PWM Funct i on Fi l e
f or t he speci f i c error.
003D INVALID SEQUENCER
LENGTH/ POSITION
A sequencer i nst ruct i on (SQO, SQC,
SQL) l engt h/ posi t i on paramet er i s
great er t han 255.
Recoverabl e Correct t he user program, t hen re-compi l e,
rel oad t he program and ent er t he Run mode.
003E INVALID BIT SHIFT OR
LIFO/ FIFO
PARAM ETER
A BSR or BSL i nst ruct i on l engt h
paramet er i s great er t han 2048 or an
FFU, FFL, LFU, LFL i nst ruct i on l engt h
paramet er i s great er t han 128 (word
f i l e) or great er t han 64 (doubl e word
f i l e)
Recoverabl e Correct t he user program or al l ocat e more
dat a f i l e space usi ng t he memory map, t hen
rel oad and Run.
003F COP/ CPW/ FLL
OUTSIDE OF DATA
FILE SPACE
A COP, CPW or FLL i nst ruct i on l engt h
paramet er ref erences out si de of t he
ent i re dat a space.
Recoverabl e Correct t he program t o ensure t hat t he
l engt h and paramet er do not poi nt out si de
of t he dat a f i l e space.
Re-compi l e, rel oad t he program and ent er
t he Run mode.
0042 INVALID RECIPE
NUM BER
Number of Reci pes speci f i ed i s
great er t han 256.
Recoverabl e Correct t he val ue f or Number of Reci pes.
Re-compi l e, rel oad t he program and ent er
t he Run mode.
Error
Code
(Hex)
Advisory Message Description Fault
Classification
Recommended Action
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Faul t M essages and Error Codes 419
0044 INVALID WRITE TO
RTC FUNCTION FILE
Wri t e at t empt t o RTC f unct i on f i l e
f ai l ed. Thi s onl y occurs when
at t empt i ng t o wri t e i nval i d dat a t o
t he RTC f unct i on f i l e. Exampl es of
i nval i d dat a are: set t i ng t he Day of
Week t o zero, or set t i ng t he Dat e t o
February 30t h.
Recoverabl e Correct t he i nval i d dat a.
Re-compi l e, rel oad t he program and ent er
t he Run mode.
0050 CONTROLLER TYPE
M ISM ATCH
A part i cul ar cont rol l er t ype was
sel ect ed i n t he user program
conf i gurat i on, but di d not mat ch t he
act ual cont rol l er t ype.
Non-User Connect t o t he hardware t hat i s speci f i ed
i n t he user program, or
Reconf i gure t he program t o mat ch t he
at t ached hardware.
0051 BASE TYPE
M ISM ATCH
A part i cul ar hardware t ype (AWA,
BWA, BXB) was sel ect ed i n t he user
program conf i gurat i on, but di d no
mat ch t he act ual base.
Non-User Connect t o t he hardware t hat i s speci f i ed
i n t he user program, or
Reconf i gure t he program t o mat ch t he
at t ached hardware.
0052 M INIM UM SERIES
ERROR
The hardware mi ni mum seri es
sel ect ed i n t he user program
conf i gurat i on was great er t han t he
seri es on t he act ual hardware.
Non-User Connect t o t he hardware t hat i s speci f i ed
i n t he user program, or
Reconf i gure t he program t o mat ch t he
at t ached hardware.
0070 EXPANSION I/ O
TERM INATOR
REM OVED
(M i croLogi x 1500 onl y)
The requi red expansi on I/ O
t ermi nat or was removed.
Non-Recoverabl e Check t he expansi on I/ O t ermi nat or on
t he l ast
I/ O modul e.
Cycl e pow er.
xx71
(1)
EXPANSION I/ O
HARDWARE ERROR
The cont rol l er cannot communi cat e
wi t h an expansi on I/ O modul e.
Non-Recoverabl e Check connect i ons.
Check f or a noi se probl em and be sure
proper groundi ng pract i ces are used.
Repl ace t he modul e.
Cycl e pow er.
xx79
(1)
EXPANSION I/ O
M ODULE ERROR
An expansi on I/ O modul e generat ed
an error.
Non-Recoverabl e Ref er t o t he I/ O M odul e St at us (IOS) f i l e.
Consul t t he document at i on f or your
speci f i c I/ O modul e t o det ermi ne possi bl e
causes of a modul e error.
0080 EXPANSION I/ O
TERM INATOR
REM OVED
(M i croLogi x 1500 onl y)
The requi red expansi on I/ O
t ermi nat or was removed.
Non-User Check expansi on I/ O t ermi nat or on l ast I/
O modul e.
Cycl e pow er.
xx81
(1)
EXPANSION I/ O
HARDWARE ERROR
The cont rol l er cannot communi cat e
wi t h an expansi on I/ O modul e.
Non-User Check connect i ons.
Check f or a noi se probl em and be sure
proper groundi ng pract i ces are used.
Repl ace t he modul e.
Cycl e pow er.
0083 M AX I/ O CABLES
EXCEEDED
The maxi mum number of expansi on
I/ O cabl es al l owed was exceeded.
Non-User Reconf i gure t he expansi on I/ O syst em so
t hat i t has an al l owabl e number of cabl es.
Cycl e pow er.
Error
Code
(Hex)
Advisory Message Description Fault
Classification
Recommended Action
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
420 Faul t M essages and Error Codes
0084 M AX I/ O POWER
SUPPLIES EXCEEDED
The maxi mum number of expansi on
I/ O power suppl i es al l ow ed w as
exceeded.
Non-User Reconf i gure t he expansi on I/ O syst em so
t hat i t has t he correct number of power
suppl i es.
0085 M AX I/ O M ODULES
EXCEEDED
The maxi mum number of expansi on
I/ O modul es al l ow ed was exceeded.
Non-User Reconf i gure t he expansi on I/ O syst em so
t hat i t has an al l owabl e number of
modul es.
Cycl e power.
xx86
(1)
EXPANSION I/ O
M ODULE BAUD RATE
ERROR
An expansi on I/ O modul e coul d not
communi cat e at t he baud rat e
speci f i ed i n t he user program I/ O
conf i gurat i on.
Non-User Change t he baud rat e i n t he user program
I/ O conf i gurat i on, and
Re-compi l e, rel oad t he program and ent er
t he Run mode, or
Repl ace t he modul e.
Cycl e power.
xx87
(1)
I/ O CONFIGURATION
M ISM ATCH
The expansi on I/ O conf i gurat i on
i n t he user program di d not
mat ch t he act ual conf i gurat i on,
or
The expansi on I/ O conf i gurat i on
i n t he user program speci f i ed a
modul e, but one was not f ound,
or
The expansi on I/ O modul e
conf i gurat i on dat a si ze f or a
modul e was great er t han what
t he modul e i s capabl e of
hol di ng.
Non-User Ei t her correct t he user program I/ O
conf i gurat i on t o mat ch t he act ual
conf i gurat i on, or
Wi t h power of f , correct t he act ual I/ O
conf i gurat i on t o mat ch t he user program
conf i gurat i on.
xx88
(1)
EXPANSION I/ O
M ODULE
CONFIGURATION
ERROR
The number of i nput or out put i mage
words conf i gured i n t he user
program exceeds t he i mage si ze i n
t he expansi on I/ O modul e.
Non-User Correct t he user program I/ O
conf i gurat i on t o reduce t he number of
i nput or out put words, and
Re-compi l e, rel oad t he program and ent er
t he Run mode.
xx89
(1)(2)
EXPANSION I/ O
M ODULE ERROR
An expansi on I/ O modul e generat ed
an error.
Non-User Ref er t o t he I/ O st at us f i l e.
Consul t t he document at i on f or your
speci f i c I/ O modul e t o det ermi ne possi bl e
causes of a modul e error.
xx8A
(1)(2)
EXPANSION I/ O
CABLE
CONFIGURATION
M ISM ATCH ERROR
Ei t her an expansi on I/ O cabl e i s
conf i gured i n t he user program,
but no cabl e i s present , or
an expansi on I/ O cabl e i s
conf i gured i n t he user program
and a cabl e i s physi cal l y present ,
but t he t ypes do not mat ch.
Non-User Correct t he user program t o el i mi nat e a
cabl e t hat i s not present
Re-compi l e, rel oad t he program and ent er
t he Run mode, or
Add t he mi ssi ng cabl e.
Cycl e power.
Error
Code
(Hex)
Advisory Message Description Fault
Classification
Recommended Action
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Faul t M essages and Error Codes 421
Contacting Rockwell
Automation for
Assistance
If you need to contact Rockwell Automation or local distributor for assistance, it is
helpful to obtain the following information ready:
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)
controller LED status
controller error codes (found in S2:6 of status file).
Rockwell Automation phone numbers are listed on the back cover of this manual.
To contact us via the Internet, go to http://www.rockwellautomation.com.
xx8B
(1)(2)
EXPANSION I/ O
POWER SUPPLY
CONFIGURATION
M ISM ATCH ERROR
Ei t her an expansi on I/ O power
suppl y i s conf i gured i n t he user
program, but no power suppl y i s
present , or
an expansi on I/ O power suppl y
i s conf i gured i n t he user program
and a power suppl y i s physi cal l y
present , but t he t ypes do not
mat ch.
Non-User Correct t he user program t o el i mi nat e a
power suppl y t hat i s not present
Re-compi l e, rel oad t he program and ent er
t he Run mode, or
Wi t h power removed, add t he mi ssi ng
power suppl y.
xx8C
(1)(2)
EXPANSION I/ O
OBJECT TYPE
M ISM ATCH
An expansi on I/ O obj ect (i .e. cabl e,
power suppl y, or modul e) i n t he user
program I/ O conf i gurat i on i s not t he
same obj ect t ype as i s physi cal l y
present .
Non-User Correct t he user program I/ O
conf i gurat i on so t hat t he obj ect t ypes
mat ch t he act ual conf i gurat i on, and
Re-compi l e, rel oad t he program and ent er
t he Run mode. Or
Correct t he act ual conf i gurat i on t o mat ch
t he user program I/ O conf i gurat i on.
Cycl e pow er.
0x1F39 INVALID STRING
LENGTH
(3)
The f i rst word of st ri ng dat a cont ai ns
a negat i ve, zero, or val ue great er
t han 82.
Recoverabl e Check t he f i rst w ord of t he st ri ng dat a
el ement f or i nval i d val ues and correct t he
dat a.
(1) xx i ndi cat es modul e number. If xx = 0, probl em cannot be t raced t o a speci f i c modul e.
(2) The xx i n t hi s error code means t hat t he error occurs at t he l ocat i on of t he l ast properl y conf i gured Expansi on I/ O modul e +1. You shoul d use t hi s i nf ormat i on i n conj unct i on
wi t h t he speci f i c error code t o det ermi ne t he source of t he probl em.
(3) Appl i es t o M i croLogi x 1500 1764-LSP Seri es B and 1764-LRP Processors.
Error
Code
(Hex)
Advisory Message Description Fault
Classification
Recommended Action
TIP You can al so check t he FRN by l ooki ng at word S:59 (Operat i ng Syst em FRN)
i n t he St at us Fi l e.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
422 Faul t M essages and Error Codes
Notes:
423 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Appendix E
Protocol Configuration
Use the information in this appendix for configuring communication protocols.
The following protocols are supported from any RS-232 communication channel:
DH-485
DF1 Full-Duplex
DF1 Half-Duplex
DF1 Radio Modem
Modbus RTU
ASCII
This appendix is organized into the following sections:
DH-485 Communication Protocol on page 423
DF1 Full-Duplex Protocol on page 426
DF1 Half-Duplex Protocol on page 427
DF1 Radio Modem Protocol on page 439
Modbus RTU Protocol on page 447
ASCII Driver on page 456
See your controllers User Manual for information about required network devices
and accessories.
DH-485 Communication
Protocol
The information in this section describes the DH-485 network functions, network
architecture, and performance characteristics. It also helps you plan and operate
the controller on a DH-485 network.
DH-485 Network Description
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 network offers:
interconnection of 32 devices
multi-master capability
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
424 Prot ocol Conf i gurat i on
token passing access control
the ability to add or remove nodes without disrupting the network
maximum network length of 1219 m (4000 ft.)
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
isused.
The following section describes the protocol used to control message transfers on
the DH-485 network.
DH-485 Token Rotation
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 0 to 31. There must be at least one
initiatoron the network (such as a MicroLogix controller, or an SLC 5/02 or
higher processor).
DH-485 Broadcast Messages
A broadcast write command is sent as a DH-485 Send Data No
Acknowledgement(SDN) packet. No acknowledgement or reply is returned.
DH-485 Configuration Parameters
When communications are configured for DH-485, the following parameters can
be changed:
The major software issues you need to resolve before installing a network are
discussed in the following sections.
Parameter Options Programming Software Default
Baud Rat e 9600, 19.2K 19.2K
Node Address 1 t o 31 deci mal 1
Token Hol d Fact or 1 t o 4 2
M ax Node Address 1 t o 31 31
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 425
Software Considerations
Software considerations include the configuration of the network and the
parameters that can be set to the specific requirements of the network. The
following are major configuration factors that have a significant effect on
networkperformance:
number of nodes on the network
addresses of those nodes
baud rate
The following sections explain network considerations and describe ways to select
parameters for optimum network performance (speed). Refer to your
programming softwares documentation for more information.
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.
Set t i ng Node Addresses
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 to 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 to CS0:5/7). Configure the node address via
Channel Configuration using RSLogix 500. Select the Channel 0 tab. The node address
is listed as Source ID.
Set t i ng Cont rol l er Baud Rat e
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 to CS0:5/15). Configure the baud rate via
Channel Configuration using RSLogix 500. Select the Channel 0 tab.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
426 Prot ocol Conf i gurat i on
Set t i ng M axi mum Node Address
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
beingused.
M i croLogi x 1200 and 1500 Remot e Packet Support
These controllers can respond and initiate with devices 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.
DF1 Full-Duplex Operation
DF1 Full-Duplex protocol (also referred to as DF1 point-to-point protocol) is
useful where RS-232 point-to-point communication is required. This type of
protocol supports simultaneous transmissions between two devices in both
directions. DF1 protocol controls message flow, detects and signals errors, and
retries if errors are detected.
IMPORTANT Al l devi ces shoul d be set t o t he same maxi mum node address.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 427
When the system driver is DF1 Full-Duplex, the following parameters can
bechanged:
DF1 Half-Duplex
Protocol
With MicroLogix 1200 FRN 7 and MicroLogix 1500 FRN 8, a DF1 Half-Duplex
Master driver has been added to complement the DF1 Half-Duplex Slave driver
already available in the MicroLogix 1200 and 1500 controllers.
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.
MicroLogix 1200 and 1500 controllers support Half-Duplex modems using RTS/
CTS hardware handshaking.
DF1Full-Duplex Configuration Parameters
(Al l M i croLogi x 1200 and M i croLogi x 1500 Cont rol l ers)
Parameter Options Programming Software
Default
Channel M i croLogi x 1200 and M i croLogi x 1500 1764-LSP: Channel 0
M i croLogi x 1500 1764-LRP: Channel 0 or 1
0 (1200 & LSP)
0 or 1 (LRP)
Dri ver DF1 Ful l Dupl ex DF1 Ful l Dupl ex
Baud Rat e 300, 600, 1200, 2400, 4800, 9600, 19.2K, 38.4K 19.2K
Pari t y none, even none
Source ID (Node Address) 0 t o 254 deci mal 1
Cont rol Li ne no handshaki ng, Ful l -Dupl ex modem no handshaki ng
Error Det ect i on CRC, BCC CRC
Embedded Responses aut o det ect , enabl ed aut o det ect
Dupl i cat e Packet (M essage) Det ect enabl ed, di sabl ed enabl ed
ACK Ti meout (x20 ms) 1 t o 65535 count s (20 ms i ncrement s) 50 count s
NAK ret ri es 0 t o 255 3 ret ri es
ENQ ret ri es 0 t o 255 3 ret ri es
St op Bi t s not a set t i ng, al ways 1 1
TIP DF1 Hal f -Dupl ex M ast er dri ver can be used wi t h t he f ol l owi ng cont rol l ers:
M i croLogi x 1200, FRN 7 and hi gher
M i croLogi x 1500, 1764-LSP, FRN 8 and hi gher
M i croLogi x 1500, 1764-LRP, FRN 8 and hi gher (Channel 1 onl y)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
428 Prot ocol Conf i gurat i on
DF1 Half-Duplex supports up to 255 devices (addresses 0 to 254, with address 255
reserved for master broadcasts). Note: When configuring a message instruction, set the
target node address to -1 for broadcast messages.
Broadcast messages are handled as follows:
DF1 Hal f -Dupl ex M ast er Dri ver Broadcast M essages
A broadcast write command initiated by the DF1 half-duplex master is received
and executed by all DF1 half-duplex slaves. A broadcast write command received
by the DF1 half-duplex master after polling a DF1 half-duplex slave is received,
acknowledged and re-broadcast without being executed by the DF1 half-duplex
master. It is treated like any other slave-to-slave command, except that no
acknowledgement is expected after re-broadcast.
DF1 Hal f -Dupl ex Sl ave Dri ver Broadcast M essages
When a broadcast write command is initiated by a DF1 half-duplex slave, it is
queued up just like any other MSG command until it receives a poll from the DF1
half-duplex master. After transmitting the broadcast write command, the DF1
half-duplex slave receives an acknowledgement that the DF1 half-duplex master
received the packet without error. When the DF1 half-duplex master re-broadcasts
the broadcast write command, the initiating DF1 half-duplex slave receives and
executes the command along with all of the other slave nodes receiving the
broadcast packet. No acknowledgement or reply is returned.
Choosing a Polling Mode for DF1 Half-Duplex Master
A master station can be configured to communicate with slave stations in either
Message-based polling mode or Standard polling mode. The pros and cons of each
polling mode are described below.
M essage-Based Pol l i ng M ode
Message-based polling mode is best used in networks when communication with
the slave stations is not time critical and where the user needs to be able to limit
when and how often the master station communicates with each slave station. It is
not recommended for larger systems that require time critical communication
between the master and all the slave stations, or for systems where slave
station-initiated messages are going to be used.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 429
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 stations address. This polling mode gives the user complete
control (through ladder logic) over when and how often to communicate with each
slave station.
If multiple MSG instructions are triggered simultaneously, they will be executed
in order, one at a time, to completion (i.e., the first MSG queued up will be
transmitted and completed to done or error before the next queued up MSG is
transmitted). Any time a message is triggered to a slave station that cannot respond
(for instance, if its modem fails), the message will go through retries and time-outs
that will slow down the execution of all the other queued up messages. The
minimum time to message to every responding slave station increases linearly with
the number of slave stations that cannot respond.
If the Message-based selection is allow slaves to initiate messages, a slave station
can initiate a message to the master station (polled report by exception messaging) or to
another slave station (slave-to-slave messaging). The MSG command packet will remain
in that slave stations transmit queue until the master station triggers its own MSG
command packet to it (which could be seconds, minutes or hours later, depending
on the masters ladder logic).
If the Message-based selection is dont 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.
St andard Pol l i ng M ode
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
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
430 Prot ocol Conf i gurat i on
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.
If each of the transmitted message packets is addressed to a different slave station,
the order of completion will be based upon which slave station address comes up
next in the poll list, not the order in which the MSG instructions were executed
and transmitted.
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 its in program
mode). In this list, one bit is assigned to each possible slave station address (0 to
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 cant respond increases.
IMPORTANT In order t o remot el y moni t or and program t he sl ave st at i ons over t he
hal f -dupl ex net work whi l e t he mast er st at i on i s conf i gured f or St andard
pol l i ng mode, t he programmi ng comput er DF1 sl ave dri ver (t ypi cal l y
Rockwel l Sof t ware RSLi nx) st at i on address must be i ncl uded i n t he
mast er st at i on pol l l i st .
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 431
About Pol l ed Report -by-Except i on
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.
About Sl ave-t o-Sl ave M essagi ng
If one slave station has a message to send to another, it simply includes the
destination slave stations address in the message instructions destination field in
place of the master stations 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 slaves own station address, the
entire message is forwarded back onto the telemetry network to the appropriate
slave station, without any further processing.
Addressi ng Ti ps
Each station on the network, including the master station, must have a unique
address. The address range is 0 to 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 stations individual address.
DF1 Half-Duplex Master Standard Polling Mode
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 slaves 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
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
432 Prot ocol Conf i gurat i on
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
as255.
An additional feature of the DF1 Half-Duplex protocol in Standard Polling Mode
operation is that it is possible for a slave device to enable a MSG instruction in its
ladder program to send or request data to/from the master or another slave. When
the initiating slave is polled, the message command is sent to the master. If the
message is addressed to the master, then the master replies to the message. If the
master recognizes that the message is not intended for it, but for another slave, the
master immediately re-broadcasts the message so that it can be received by the
intended slave. This slave-to-slave transfer is a built-in function of the master
device and can also be used by programming software to upload and download
programs to processors on the DF1 Half-Duplex link.
Standard Mode Channel Configuration
DF1 Half-Duplex Master MSG-based Polling Mode Operation
With MSG-based Polling Mode, the master device only initiates communication
with a slave when a MSG instruction to that slave is triggered in ladder logic. Once
the read or write command has been transmitted, the master waits the Reply MSG
Timeout period and then polls that slave for a reply to its command. The master
can be configured either to ignore (MSG-based Polling, dont allow slaves to
initiate) or to accept (MSG-based Polling, allow slaves to initiate) MSGs that
may have been triggered and queued up in the slave.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 433
Message-Based Polling Mode Channel Configuration
When the system driver is DF1 Half-Duplex Master, the following parameters can
be changed:
DF1Half-Duplex Master Configuration Parameters
(M i croLogi x 1200, FRN 7 and hi gher
M i croLogi x 1500, 1764-LSP, FRN 8 and hi gher
M i croLogi x 1500, 1764-LRP, FRN 8 and hi gher [Channel 1 onl y])
Parameter Options Programming
Software
Default
Channel M i croLogi x 1200 and M i croLogi x 1500 1764-LSP: Channel 0
M i croLogi x 1500 1764-LRP: Channel 1 onl y
0 (1200 & LSP)
1 (LRP)
Dri ver DF1 Hal f Dupl ex M ast er
Baud Rat e 300, 600, 1200, 2400, 4800, 9600, 19.2K, 38.4K 19.2K
Pari t y none, even none
Node Address 0 t o 254 deci mal (255 i s reserved f or broadcast ) 1
Cont rol Li ne No Handshaki ng, Hal f -Dupl ex M odem (RTS/ CTS Handshaki ng), Ful l -Dupl ex M odem (RTS on) No
Handshaki ng
Error Det ect i on CRC, BCC CRC
Dupl i cat e Packet
Det ect
enabl ed, di sabl ed
Det ect s and el i mi nat es dupl i cat e responses t o a message. Dupl i cat e packet s may be sent under
noi sy communi cat i on condi t i ons i f t he senders M essage Ret ri es are set great er t han 0.
enabl ed
RTS Of f Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s) onl y wi t h cont rol l i ne set t o Hal f Dupl ex M odem
(RTS/ CTS Handshaki ng)
Speci f i es t he del ay t i me bet ween when t he l ast seri al charact er i s sent t o t he modem and when
RTS i s deact i vat ed. Gi ves t he modem ext ra t i me t o t ransmi t t he l ast charact er of a packet .
0
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
434 Prot ocol Conf i gurat i on
RTS Send Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s) onl y wi t h cont rol l i ne set t o Hal f Dupl ex M odem
(RTS/ CTS Handshaki ng)
Speci f i es t he t i me del ay bet ween set t i ng RTS unt i l checki ng f or t he CTS response. For use wi t h
modems t hat are not ready t o respond wi t h CTS i mmedi at el y upon recei pt of RTS.
0
M essage Ret ri es 0 t o 255
Speci f i es t he number of t i mes t he mast er devi ce at t empt s t o re-send a message packet when i t
does not recei ve an ACK f rom t he sl ave devi ce. For use i n noi sy envi ronment s where
acknowl edgement s may become corrupt ed i n t ransmi ssi on.
3
Pre Transmi t Del ay
(x1 ms)
0 t o 65535 (can be set i n 1 ms i ncrement s)
When t he Cont rol Li ne i s set t o No Handshaki ng , t hi s i s t he del ay t i me bef ore t ransmi ssi on.
Requi red f or 1761-NET-AIC physi cal Hal f -Dupl ex net works. The 1761-NET-AIC needs 2 ms of del ay
t i me t o change f rom t ransmi t t o recei ve mode.
When t he Cont rol Li ne i s set t o Hal f -Dupl ex M odem (RTS/ CTS Handshaki ng) , t hi s i s t he
mi ni mum t i me del ay bet ween recei vi ng t he l ast charact er of a packet and t he next RTS assert i on.
0
ACK Ti meout
(x20 ms)
0 t o 255 (can be set i n 20 ms i ncrement s)
Speci f i es t he amount of t i me t he mast er wi l l wai t f or an acknowl edgement t o a message i t has
t ransmi t t ed bef ore i t ret ri es t he message or errors out t he message i nst ruct i on.
Thi s t i meout val ue i s al so used f or t he pol l response t i meout .
50
Repl y M SG Ti meout
(x 20 ms)
0 t o 255 (can be set i n 20 ms i ncrement s) onl y wi t h M SG-based Pol l i ng M odes
Speci f i es t he amount of t i me t he mast er wi l l wai t af t er recei vi ng an ACK t o a mast er-i ni t i at ed
M SG bef ore pol l i ng t he sl ave st at i on f or i t s repl y.
1
Pri ori t y Pol l i ng
Range Hi gh
Sel ect t he l ast sl ave st at i on address t o pri ori t y pol l onl y wi t h St andard Pol l i ng M odes. 0
Pri ori t y Pol l i ng
Range Low
Sel ect t he f i rst sl ave st at i on address t o pri ori t y pol l . Ent eri ng 255 di sabl es pri ori t y pol l i ng onl y
wi t h St andard Pol l i ng M odes.
255
Normal Pol l i ng
Range Hi gh
Sel ect t he l ast sl ave st at i on address t o normal pol l onl y wi t h St andard Pol l i ng M odes. 0
Normal Pol l i ng
Range Low
Sel ect t he f i rst sl ave st at i on address t o normal pol l . Ent eri ng 255 di sabl es normal pol l i ng onl y
wi t h St andard Pol l i ng M odes.
255
Normal Pol l Group
Si ze
Ent er t he quant i t y of act i ve st at i ons l ocat ed i n t he normal pol l range t hat you want pol l ed duri ng a
scan t hrough t he normal pol l range bef ore ret urni ng t o t he pri ori t y pol l range. If no st at i ons are
conf i gured i n t he Pri ori t y Pol l i ng Range, l eave t hi s paramet er at 0.
0
DF1Half-Duplex Master Configuration Parameters
(M i croLogi x 1200, FRN 7 and hi gher
M i croLogi x 1500, 1764-LSP, FRN 8 and hi gher
M i croLogi x 1500, 1764-LRP, FRN 8 and hi gher [Channel 1 onl y])
Parameter Options Programming
Software
Default
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 435
RTS Send Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s) onl y wi t h cont rol l i ne set t o Hal f Dupl ex M odem
(RTS/ CTS Handshaki ng)
Speci f i es t he t i me del ay bet ween set t i ng RTS unt i l checki ng f or t he CTS response. For use wi t h
modems t hat are not ready t o respond wi t h CTS i mmedi at el y upon recei pt of RTS.
0
M essage Ret ri es 0 t o 255
Speci f i es t he number of t i mes t he mast er devi ce at t empt s t o re-send a message packet when i t
does not recei ve an ACK f rom t he sl ave devi ce. For use i n noi sy envi ronment s where
acknowl edgement s may become corrupt ed i n t ransmi ssi on.
3
Pre Transmi t Del ay
(x1 ms)
0 t o 65535 (can be set i n 1 ms i ncrement s)
When t he Cont rol Li ne i s set t o No Handshaki ng , t hi s i s t he del ay t i me bef ore t ransmi ssi on.
Requi red f or 1761-NET-AIC physi cal Hal f -Dupl ex net works. The 1761-NET-AIC needs 2 ms of del ay
t i me t o change f rom t ransmi t t o recei ve mode.
When t he Cont rol Li ne i s set t o Hal f -Dupl ex M odem (RTS/ CTS Handshaki ng) , t hi s i s t he
mi ni mum t i me del ay bet ween recei vi ng t he l ast charact er of a packet and t he next RTS assert i on.
0
ACK Ti meout
(x20 ms)
0 t o 255 (can be set i n 20 ms i ncrement s)
Speci f i es t he amount of t i me t he mast er wi l l wai t f or an acknowl edgement t o a message i t has
t ransmi t t ed bef ore i t ret ri es t he message or errors out t he message i nst ruct i on.
Thi s t i meout val ue i s al so used f or t he pol l response t i meout .
50
Repl y M SG Ti meout
(x 20 ms)
0 t o 255 (can be set i n 20 ms i ncrement s) onl y w i t h M SG-based Pol l i ng M odes
Speci f i es t he amount of t i me t he mast er wi l l wai t af t er recei vi ng an ACK t o a mast er-i ni t i at ed
M SG bef ore pol l i ng t he sl ave st at i on f or i t s repl y.
1
Pri ori t y Pol l i ng
Range Hi gh
Sel ect t he l ast sl ave st at i on address t o pri ori t y pol l onl y wi t h St andard Pol l i ng M odes. 0
Pri ori t y Pol l i ng
Range Low
Sel ect t he f i rst sl ave st at i on address t o pri ori t y pol l . Ent eri ng 255 di sabl es pri ori t y pol l i ng onl y
wi t h St andard Pol l i ng M odes.
255
Normal Pol l i ng
Range Hi gh
Sel ect t he l ast sl ave st at i on address t o normal pol l onl y wi t h St andard Pol l i ng M odes. 0
Normal Pol l i ng
Range Low
Sel ect t he f i rst sl ave st at i on address t o normal pol l . Ent eri ng 255 di sabl es normal pol l i ng onl y
wi t h St andard Pol l i ng M odes.
255
Normal Pol l Group
Si ze
Ent er t he quant i t y of act i ve st at i ons l ocat ed i n t he normal pol l range t hat you want pol l ed duri ng a
scan t hrough t he normal pol l range bef ore ret urni ng t o t he pri ori t y pol l range. If no st at i ons are
conf i gured i n t he Pri ori t y Pol l i ng Range, l eave t hi s paramet er at 0.
0
DF1Half-Duplex Master Configuration Parameters
(M i croLogi x 1200, FRN 7 and hi gher
M i croLogi x 1500, 1764-LSP, FRN 8 and hi gher
M i croLogi x 1500, 1764-LRP, FRN 8 and hi gher [Channel 1 onl y])
Parameter Options Programming
Software
Default
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
436 Prot ocol Conf i gurat i on
DF1 Half-Duplex Master Channel Status
Channel Status data is stored in the Communication Status Function File.
Viewing Channel Status Data for DF1Half-Duplex Master
Communication Status Function DF1Half-Duplex Master Channel Status
Status Field
Status File Location
(1)
Definition
M essages Sent CSx:10 The t ot al number of DF1 messages sent by t he processor
(i ncl udi ng message ret ri es)
M essages Recei ved CSx:11 The number of messages recei ved w i t h no errors
Pol l s Sent CSx:15 The number of pol l packet s sent by t he processor
Lack of M emory CSx:17 The number of t i mes t he processor coul d not recei ve a message because
i t di d not have avai l abl e memory
Last Normal Pol l Li st Scan CSx:19 Ti me i n 100 ms i ncrement s of l ast scan t hrough Normal Pol l Li st
Last Pri ori t y Pol l Li st Scan CSx:21 Ti me i n 100 ms i ncrement s of l ast scan t hrough Pri ori t y Pol l Li st
M essage Ret ry CSx:13 The number of message ret ri es sent by t he processor
Undel i vered M essages CSx:12 The number of messages t hat were sent by t he processor but not
acknow l edged by t he dest i nat i on devi ce
Dupl i cat e M essages
Recei ved
CSx:18 The number of t i mes t he processor recei ved a message packet i dent i cal
t o t he previ ous message packet
Bad Packet s Recei ved CSx:16 The number of i ncorrect dat a packet s recei ved by t he processor f or w hi ch
no ACK was ret urned
M ax Normal Pol l Li st Scan CSx:20 M axi mum t i me i n 100 ms i ncrement s t o scan t he Normal Pol l Li st
M ax Pri ori t y Pol l Li st Scan CSx:22 M axi mum t i me i n 100 ms i ncrement s t o scan t he Pri ori t y Pol l Li st
RTS (Request t o Send) CSx:9/ 1 The st at us of t he RTS handshaki ng l i ne (assert ed by t he processor)
CTS (Cl ear t o Send) CSx:9/ 0 The st at us of t he CTS handshaki ng l i ne (recei ved by t he processor)
DCD (Dat a Carri er Det ect ) CSx:9/ 3 Channel 1 of 1764-LRP onl y: The st at us of t he DCD handshaki ng l i ne
(recei ved by t he processor)
(1) x equal s t he Channel number.
Doubl e-cl i ck on t he Channel St at us
Icon Locat ed beneat h t he
Conf i gurat i on i con t o bri ng up t he
Channel St at us screen.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 437
Monitor Active Stations
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 to CSx:42, where x is the
channel number (x = 0 for MicroLogix 1200 and MicroLogix 1500 1764-LSP; x =
1 for MicroLogix 1500 1764-LRP). Each bit in the table represents a station on the
link, from 0 to 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.
When valid Normal and/or Priority Poll Ranges are defined:
if a slave responded the last time it was polled by the master, the bit
corresponding to its address is set (1 = active).
if a slave didnt respond the last time it was polled by the master, the bit
corresponding to its address is cleared (0 = inactive).
If you are using RSLogix 500 version 6.10.10 or higher, you can view the active
node table by clicking on Processor Status and then selecting the tab for the DF1
Master channel.
Example Active Node Table
At power-up or after reconfiguration, the master station assumes that all
slavestations are inactive. A station is shown active only after it responds to a
pollpacket.
TIP The bi t correspondi ng t o t he address conf i gured f or t he DF1 M ast er i s
al w ays cl eared because t he mast er address never get s pol l ed.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
438 Prot ocol Conf i gurat i on
DF1 Half-Duplex Slave Configuration
When the system driver is DF1 Half-Duplex Slave, the following parameters can
be changed:
DF1Half-Duplex Slave Configuration Parameters
(Al l M i croLogi x 1200 and M i croLogi x 1500 Cont rol l ers)
Parameter Options Programming
Software
Default
Channel M i croLogi x 1200 and M i croLogi x 1500 1764-LSP: Channel 0
M i croLogi x 1500 1764-LRP: Channel 0 or 1
0 (1200 & LSP)
0 or 1 (LRP)
Dri ver DF1 Hal f Dupl ex Sl ave
Baud Rat e 300, 600, 1200, 2400, 4800, 9600, 19.2K, 38.4K 19.2K
Pari t y none, even none
Node Address 0 t o 254 deci mal (255 i s reserved f or broadcast ) 1
Cont rol Li ne No Handshaki ng, Hal f -Dupl ex M odem No
Handshaki ng
Error Det ect i on CRC, BCC CRC
EOT Suppressi on enabl ed, di sabl ed
When EOT Suppressi on i s enabl ed, t he sl ave does not respond when pol l ed i f no message i s
queued. Thi s saves modem t ransmi ssi on power when t here i s no message t o t ransmi t .
di sabl ed
Dupl i cat e Packet
(M essage) Det ect
enabl ed, di sabl ed
Det ect s and el i mi nat es dupl i cat e responses t o a message. Dupl i cat e packet s may be sent under
noi sy communi cat i on condi t i ons i f t he senders M essage Ret ri es are set great er t han 0.
enabl ed
Pol l Ti meout
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s)
Pol l t i meout onl y appl i es when a sl ave devi ce i ni t i at es a M SG i nst ruct i on. It i s t he amount of t i me
t hat t he sl ave devi ce wai t s f or a pol l f rom t he mast er devi ce. If t he sl ave devi ce does not recei ve a
pol l w i t hi n t he Pol l Ti meout , a M SG i nst ruct i on error i s generat ed, and t he l adder program needs t o
re-queue t he M SG i nst ruct i on. If you are usi ng a M SG i nst ruct i on, i t i s recommended t hat a Pol l
Ti meout val ue of zero i s not used. Pol l Ti meout i s di sabl ed when set t o zero.
3000
RTS Of f Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s) onl y wi t h cont rol l i ne set t o Hal f Dupl ex M odem
(RTS/ CTS Handshaki ng)
Speci f i es t he del ay t i me bet ween when t he l ast seri al charact er i s sent t o t he modem and when
RTS i s deact i vat ed. Gi ves t he modem ext ra t i me t o t ransmi t t he l ast charact er of a packet .
0
RTS Send Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s) onl y wi t h cont rol l i ne set t o Hal f Dupl ex M odem
(RTS/ CTS Handshaki ng)
Speci f i es t he t i me del ay bet ween set t i ng RTS unt i l checki ng f or t he CTS response. For use wi t h
modems t hat are not ready t o respond wi t h CTS i mmedi at el y upon recei pt of RTS.
0
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 439
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.
M essage Ret ri es 0 t o 255
Speci f i es t he number of t i mes t he mast er devi ce at t empt s t o re-send a message packet when i t
does not recei ve an ACK f rom t he sl ave devi ce. For use i n noi sy envi ronment s where
acknowl edgement s may become corrupt ed i n t ransmi ssi on.
3
Pre Transmi t Del ay
(x1 ms)
0 t o 65535 (can be set i n 1 ms i ncrement s)
When t he Cont rol Li ne i s set t o No Handshaki ng , t hi s i s t he del ay t i me bef ore t ransmi ssi on.
Requi red f or 1761-NET-AIC physi cal Hal f -Dupl ex net works. The 1761-NET-AIC needs 2 ms of del ay
t i me t o change f rom t ransmi t t o recei ve mode.
When t he Cont rol Li ne i s set t o Hal f -Dupl ex M odem (RTS/ CTS Handshaki ng) , t hi s i s t he
mi ni mum t i me del ay bet ween recei vi ng t he l ast charact er of a packet and t he next RTS assert i on.
0
DF1Half-Duplex Slave Configuration Parameters
(Al l M i croLogi x 1200 and M i croLogi x 1500 Cont rol l ers)
Parameter Options Programming
Software
Default
TIP DF1 Radi o M odem dri ver can be used wi t h t he f ol l owi ng cont rol l ers:
- M i croLogi x 1200, FRN 7 and hi gher
- M i croLogi x 1500, 1764-LSP, FRN 8 and hi gher
- M i croLogi x 1500, 1764-LRP, FRN 8 and hi gher (Channel 1 onl y)
IMPORTANT The DF1 Radi o M odem dri ver shoul d onl y be used among devi ces t hat
support and are conf i gured f or t he DF1 Radi o M odem prot ocol . As of t he
rel ease of t hi s f i rmware, no ot her devi ces besi des t he M i croLogi x 1200
wi t h FRN7, t he M i croLogi x 1500 wi t h FRN8 and SLC 5/ 03, SLC 5/ 04, and
SLC 5/ 05 processors wi t h Seri es C FRN6 or hi gher support DF1 Radi o
M odem prot ocol .
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
440 Prot ocol Conf i gurat i on
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 to 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.
Unlike either DF1 Full-Duplex or DF1 Half-Duplex protocols, DF1 Radio
Modem protocol does not include ACKs, NAKs, ENQs, or poll packets. Data
integrity is ensured by the CRC checksum.
Using the DF1 Radio Modem
Using RSLogix 500 version 6.10.10 or higher, the DF1 Radio Modem driver can be
configured as the system mode driver for Channel 0 in MicroLogix 1200 (FRN 7
or higher) and MicroLogix 1500 1764-LSP (FRN 8 or higher) and for Channel 1 in
MicroLogix 1500 1764-LRP (FRN 8 or higher).
Channel configuration appears as follows. Figure shows Channel 0 configuration,
and Figure shows Channel 1 configuration options.
DF1Radio ModemChannel 0Configuration (MicroLogix 1200and MicroLogix 1500,
1764-LSP
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 441
When the system driver is DF1 Radio Modem, the following parameters can be
changed for Channel 0.
DF1Radio ModemChannel 1Configuration (MicroLogix 1500, 1764-LRP
DF1Radio ModemChannel 0Configuration Parameters
(M i croLogi x 1200 FRN 7 and hi gher, and M i croLogi x 1500 1764-LSP FRN 8 and hi gher)
Parameter Options Programming
Software
Default
Channel M i croLogi x 1200 and M i croLogi x 1500 1764-LSP: Channel 0 0
Dri ver DF1 Radi o M odem
Baud Rat e 300, 600, 1200, 2400, 4800, 9600, 19.2K, 38.4K 19.2K
Pari t y none, even none
Node Address 0 t o 254 deci mal (255 i s reserved f or broadcast ) 1
St ore and Forward
Fi l e Number
St ore and Forward al l ows messages bet ween t wo out -of -radi o-range nodes t o be rout ed t hrough
one or more i n-radi o-range nodes. Thi s i s t he dat a t abl e f i l e number used f or t he St ore & Forw ard
Tabl e.
0
Cont rol Li ne No Handshaki ng, Hal f -Dupl ex M odem (RTS/ CTS Handshaki ng) No
Handshaki ng
Error Det ect i on CRC, BCC CRC
Pre Transmi t Del ay
(x1 ms)
0 t o 65535 (can be set i n 1 ms i ncrement s)
When t he Cont rol Li ne i s set t o No Handshaki ng , t hi s i s t he del ay t i me bef ore t ransmi ssi on.
Requi red f or 1761-NET-AIC physi cal Hal f -Dupl ex net works. The 1761-NET-AIC needs 2 ms of del ay
t i me t o change f rom t ransmi t t o recei ve mode.
When t he Cont rol Li ne i s set t o Hal f -Dupl ex M odem (RTS/ CTS Handshaki ng) , t hi s i s t he
mi ni mum t i me del ay bet ween recei vi ng t he l ast charact er of a packet and t he next RTS assert i on.
1
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
442 Prot ocol Conf i gurat i on
When the system driver is DF1 Radio Modem, the following parameters can be
changed for Channel 1.
With RSLogix 500 version 6.10.10 and higher, the MicroLogix 1500 1764-LRP
offers a Half-Duplex Modem with DCD Handshaking Control Line selection.
This allows messaging to occur in a Report-by-Exception mode with radio
modems using hardware handshaking, based on the status of the DCD.
Transmission can only occur when DCD is low, indicating that no other nodes are
currently transmitting. Received characters are considered valid while DCD is high.
DF1Radio ModemChannel 1Configuration Parameters
(M i croLogi x 1500 1764-LRP FRN 8 and hi gher)
Parameter Options Programming
Software
Default
Channel M i croLogi x 1500 1764-LRP: Channel 1 onl y 1
Dri ver DF1 Radi o M odem
Baud Rat e 300, 600, 1200, 2400, 4800, 9600, 19.2K, 38.4K 19.2K
Pari t y none, even none
Node Address 0 t o 254 deci mal (255 i s reserved f or broadcast ) 1
St ore and Forward
Fi l e Number
St ore and Forward al l ows messages bet ween t wo out -of -radi o-range nodes t o be rout ed t hrough
one or more i n-radi o-range nodes. Thi s i s t he st art i ng address f or t he St ore & Forw ard Tabl e.
0
Cont rol Li ne No Handshaki ng, Hal f Dupl ex M odem (RTS/ CTS) Handshaki ng, Hal f Dupl ex M odem wi t h DCD
Handshaki ng
No
Handshaki ng
Error Det ect i on CRC, BCC CRC
RTS Of f Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s) onl y wi t h cont rol l i ne set t o Hal f Dupl ex M odem
(RTS/ CTS Handshaki ng)
Speci f i es t he del ay t i me bet ween when t he l ast seri al charact er i s sent t o t he modem and when
RTS i s deact i vat ed. Gi ves t he modem ext ra t i me t o t ransmi t t he l ast charact er of a packet .
0
RTS Send Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s) onl y wi t h cont rol l i ne set t o Hal f Dupl ex M odem
(RTS/ CTS Handshaki ng)
Speci f i es t he t i me del ay bet ween set t i ng RTS unt i l checki ng f or t he CTS response. For use wi t h
modems t hat are not ready t o respond wi t h CTS i mmedi at el y upon recei pt of RTS.
0
DCD Wai t Del ay 0 t o 255
Speci f i es t he number of t i mes t he mast er devi ce at t empt s t o re-send a message packet when i t
does not recei ve an ACK f rom t he sl ave devi ce. For use i n noi sy envi ronment s where
acknowl edgement s may become corrupt ed i n t ransmi ssi on.
1
Pre Transmi t Del ay
(x1 ms)
0 t o 65535 (can be set i n 1 ms i ncrement s)
When t he Cont rol Li ne i s set t o No Handshaki ng , t hi s i s t he del ay t i me bef ore t ransmi ssi on.
Requi red f or 1761-NET-AIC physi cal Hal f -Dupl ex net works. The 1761-NET-AIC needs 2 ms of del ay
t i me t o change f rom t ransmi t t o recei ve mode.
When t he Cont rol Li ne i s set t o Hal f -Dupl ex M odem (RTS/ CTS Handshaki ng) , t hi s i s t he
mi ni mum t i me del ay bet ween recei vi ng t he l ast charact er of a packet and t he next RTS assert i on.
0
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 443
A DCD Wait Timeout parameter configures the length of time, after triggering a
MSG, that the DCD must go low in order for a message to be transmitted.
Otherwise, the MSG will error out with a 09 error code.
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 others transmissions.
Using Store & Forward Capability
DF1 Radio Modem also supports Store & 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 & Forward has a user-configured Store & Forward Table
to indicate which received packets it should re-broadcast, based on the packets
source and destination addresses.
Configuring the Store & Forward Table
The Store & Forward Table can be configured to use any valid binary data table file
(B3, B9 through 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 &
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 & Forward message packets between nodes 1 and 3, then both bits Bx/1 and
IMPORTANT RSLogi x 500 versi on 6.10.10 al l ows you t o conf i gure t he M i croLogi x DF1
Radi o M odem dri ver, but does not al l ow you t o conf i gure t he St ore &
Forward Tabl e f i l e. In order t o use t he St ore & Forward capabi l i t y wi t h
RSLogi x versi on 6.10.10, you must downl oad a pre-conf i gured def aul t
l adder f i l e f or your part i cul ar processor f rom t he M i croLogi x web si t e
(www.ab.com/micrologix), whi ch has a bi nary f i l e (B3:0-15)
pre-conf i gured f or t he DF1 Radi o M odem St ore & Forw ard Tabl e f i l e.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
444 Prot ocol Conf i gurat i on
Bx/3 (where x is the configured data table file number) would have to be set in the
Store & Forward Table file (see Figure ). You can set bit 255 to enable Store &
Forward of broadcast packets, as well.
Applying DF1Radio ModemProtocol
If you are using RSLogix 500 version 6.10.10 or higher, you can view the store &
forward table by clicking on Processor Status and then selecting the tab for the
DF1 Master channel.
IMPORTANT Once St ore & Forw ard i s enabl ed, dupl i cat e packet det ect i on i s al so
aut omat i cal l y enabl ed. Whenever St ore & Forward i s used wi t hi n a radi o
modem net work, every node shoul d have a St ore & Forw ard Tabl e f i l e
conf i gured, even i f al l of t he bi t s i n t he f i l e are cl eared, so t hat dupl i cat e
packet s wi l l be i gnored.
Node 4
No Bi t s
Node 3
1, 2, 4
Node 2
1, 3, 4
Node 1
No Bi t s
CM D 1
(DST = 4, SRC = 1)
REPLY 1
(DST = 1, SRC = 4)
CM D1
(1st Rebroadcast )
Note 1
(2nd Rebroadcast )
REPLY 1
CM D 1
(2nd Rebroadcast )
(1st Rebroadcast )
REPLY 1
Note 4
Note 2
Note 1 The l i nk l ayer of Node 1 bl ocks t he re-t ransmi ssi on of a packet t hat i s recei ved wi t h t he SRC byt e equal t o t he
recei vi ng nodes st at i on address. Packet s recei ved t hat ori gi nat e f rom t he recei vi ng node shoul d never be re-t ransmi t t ed.
Note 2 To prevent Node 2 f rom re-t ransmi t t i ng a dupl i cat e packet , t he l i nk l ayer of Node 2 updat es t he dupl i cat e packet
t abl e wi t h t he l ast 20 packet s recei ved.
Note 3 The l i nk l ayer of Node 4 bl ocks t he re-t ransmi ssi on of a packet t hat i s recei ved wi t h t he SRC byt e equal t o t he
recei vi ng nodes st at i on address. Packet s recei ved t hat ori gi nat e f rom t he recei vi ng node shoul d never be re-t ransmi t t ed.
Note 4 To prevent Node 3 f rom re-t ransmi t t i ng a dupl i cat e packet , t he l i nk l ayer of Node 3 updat es t he dupl i cat e packet
t abl e wi t h t he l ast 20 packet s recei ved.
Note 3
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 445
Example Store & Forward Table
DF1 Radio ModemChannel Status
Channel Status data is stored in the Communication Status Function File.
Viewing Channel Status for DF1Radio Modem
Communication Status Function DF1Radio ModemChannel Status
Status Field
Diagnostic File Location
(1)
Definition
M essages Sent CSx:10 The t ot al number of DF1 messages sent by t he processor (i ncl udi ng
message ret ri es)
M essages Recei ved CSx:11 The number of messages recei ved wi t h no errors
Lack of M emory CSx:17 The number of t i mes t he processor coul d not recei ve a message because
i t di d not have avai l abl e memory
Undel i vered M essages CSx:12 The number of messages t hat coul d not be sent by t he processor due t o
bad modem handshake si gnal s
Doubl e-cl i ck on t he Channel St at us
Icon Locat ed beneat h t he
Conf i gurat i on i con t o bri ng up t he
Channel St at us screen.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
446 Prot ocol Conf i gurat i on
DF1 Radio ModemSystemLimitations
The following questions need to be answered in order to determine if you can
implement the new DF1 Radio Modem driver in your radio modem network:
1. Are all of the devices MicroLogix 1200 or 1500 controllers, or SLC 5/03,
5/04 or 5/05 processors?
In order to be configured with the DF1 Radio Modem driver, using RSLogix
6.0 or higher, MicroLogix 1200 controllers must be at FRN 7 or higher and
MicroLogix 1500 controllers must be at FRN 8 or higher.
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 version 5.50 or higher.
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 & 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,
Dupl i cat e M essages
Recei ved
CSx:18 The number of t i mes t he processor recei ved a message packet i dent i cal
t o t he previ ous message packet
Bad Packet Recei ved CSx:16 The number of dat a packet s recei ved by t he processor t hat had bad
checksum or w ere t runcat ed
RTS (Request t o Send) CSx:9/ 1 The st at us of t he RTS handshaki ng l i ne (assert ed by t he processor)
CTS (Cl ear t o Send) CSx:9/ 0 The st at us of t he CTS handshaki ng l i ne (recei ved by t he processor)
DCD (Dat a Carri er Det ect ) CSx:9/ 3 1764-LRP onl y: The st at us of t he DCD handshaki ng l i ne (recei ved by t he
processor)
(1) x equal s Channel number
Communication Status Function DF1Radio ModemChannel Status
Status Field
Diagnostic File Location
(1)
Definition
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 447
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 nodes using RSLinx and
RSLogix 500 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 number
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
TerminalUnit 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 typescoils, contacts, input
registers, and holding registersinto four binary and/or integer data table files
created by the user.
Modbus RTU Master
Message instructions are used to transfer information between the data files in the
Modbus RTU Master and the Modbus RTU Slaves. Refer to Chapter 21 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
1to 65,536. There are four memory groups, one for each function:
coils (generally addressed as 0xxxx)
contacts (1xxxx)
input registers (3xxxx)
holding registers (4xxxx)
TIP M odbus RTU M ast er dri ver can be used wi t h t he f ol l owi ng cont rol l ers:
M i croLogi x 1200, FRN 8 and hi gher
M i croLogi x 1500, FRN 9 and hi gher
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
448 Prot ocol Conf i gurat i on
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
getentered into the Modbus Data Address field when configuring the
messageinstruction.
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.
Modbus RTU Slave
The coil and contact files can contain up to 4096 coils or contacts in each register
when the data table file is configured for a maximum size of 256 words. Each input
register and holding register file can contain up to 256 registers when the data table
file is configured for a maximum size of 256 words. With the Expanded box
checked, the controllers can be specifically configured to use up to six 256-word
data table files for a total of 1536 Modbus Holding registers.
TIP M odbus prot ocol may not be consi st ent l y i mpl ement ed i n t he f i el d. The
M odbus speci f i cat i on cal l s f or t he addressi ng range t o st art at 1; however,
some devi ces st art addressi ng at 0.
The M odbus Dat a Address i n t he M essage Set up Screen may need t o be
i ncrement ed by one t o properl y access a M odbus sl aves memory,
dependi ng on t hat sl aves i mpl ement at i on of memory addressi ng.
TIP M odbus RTU Sl ave dri ver can be used w i t h t he f ol l owi ng cont rol l ers:
Al l M i croLogi x 1200 cont rol l ers
M i croLogi x 1500 1764-LSP Seri es B and hi gher
Al l M i croLogi x 1500 1764-LRP
TIP A request t o access a group of hol di ng regi st ers t hat span across t wo f i l es
i s permi t t ed. Not e t hat t he maxi mum number of regi st ers i n a command
does not al l ow f or more t han t wo f i l es t o be accessed duri ng a si ngl e
M odbus command.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 449
Modbus RTU Master Configuration
Select the Modbus RTU Master from the Channel Configuration menu as
shownbelow.
The Baud defaults to 19200.
The Control Line can be configured as:
No Handshaking
Full-Duplex Modem (RTS on)
Half-Duplex Modem (RTS/CTS handshaking).
The Protocol Control defaults are:
No Handshaking
InterChar. Timeout = 0
Pre Transmit Delay = 0.
When the system driver is Modbus RTU Master, the following communication
port parameters can be changed:
Modbus RTU Master Communications Configuration Parameters
(M i croLogi x 1200 FRN 8 and hi gher, M i croLogi x 1500 FRN 9 and hi gher)
Parameter Options Programming
Software Default
Channel M i croLogi x 1200 FRN 8 and hi gher: Channel 0
M i croLogi x 1500 FRN 9 and hi gher: Channel 0 or 1
0 (1200 & LSP)
0 or 1 (LRP)
Dri ver M odbus RTU M ast er
Baud Rat e 300, 600, 1200, 2400, 4800, 9600, 19.2K, 38.4K 19.2K
Pari t y none, even, odd none
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
450 Prot ocol Conf i gurat i on
Modbus RTU Slave Configuration
The Modbus configuration screen and configuration procedure are shown below:
Cont rol Li ne No Handshaki ng, Ful l -Dupl ex M odem (RTS on), Hal f -Dupl ex M odem (RTS/ CTS handshaki ng) No Handshaki ng
Int er-charact er
Ti meout (x1 ms)
0 t o 65535 (can be set i n 1 ms i ncrement s); 0 = 3.5 charact er t i mes
Speci f i es t he mi ni mum del ay bet ween charact ers t hat i ndi cat es t he end of a message packet .
0
RTS Of f Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s)
Speci f i es t he del ay t i me bet ween when t he l ast seri al charact er i s sent t o t he modem and
when RTS i s deact i vat ed. Gi ves t he modem ext ra t i me t o t ransmi t t he l ast charact er of a
packet .
0
RTS Send Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s)
Speci f i es t he t i me del ay bet ween set t i ng RTS unt i l checki ng f or t he CTS response. For use
wi t h modems t hat are not ready t o respond w i t h CTS i mmedi at el y upon recei pt of RTS.
0
Pre Transmi t Del ay
(x1 ms)
0 t o 65535 (can be set i n 1 ms i ncrement s)
When t he Cont rol Li ne i s set t o No Handshaki ng, t hi s i s t he del ay t i me bef ore t ransmi ssi on.
Requi red f or 1761-NET-AIC physi cal Hal f -Dupl ex net works. The 1761-NET-AIC needs 2 ms of
del ay t i me t o change f rom recei ve t o t ransmi t mode.
When t he Cont rol Li ne i s set t o Hal f -Dupl ex M odem or Ful l -Dupl ex M odem, t hi s i s t he
mi ni mum t i me del ay bet ween recei vi ng t he l ast charact er of a packet and t he RTS assert i on.
0
Modbus RTU Master Communications Configuration Parameters
(M i croLogi x 1200 FRN 8 and hi gher, M i croLogi x 1500 FRN 9 and hi gher)
Parameter Options Programming
Software Default
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 451
1. To set up Channel 0 and data files for Modbus communication, select the
Channel 0 Configuration tab. For the 1764-LRP only, you can select either Channel
0 or Channel 1.
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. (MicroLogix 1200 Series C FRN6 and
higher, and MicroLogix 1500 Series C FRN7 and higher only. Requires RSLogix 500
version 5.50 or higher to program.)
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:
TIP The cont rol l er def aul t i s one dat a f i l e of 256 regi st ers. The Expansi on
check box enabl es an addi t i onal f i ve f i l es and 1280 hol di ng regi st ers.
The f i ve addi t i onal t abl es do not need t o be i ndi vi dual l y def i ned, but
sequent i al l y f ol l ow t he f i rst i nt eger or bi t f i l e. For exampl e, i f t he f i rst f i l e
i s N10 (or B10), t hen t he addi t i onal f i ve f i l es wi l l be N11 (or B11), N12 (or
B12), N13 (or B13), N14 (or B14), and N15 (or B15).
Modbus RTU Slave Communications Configuration Parameters
(M i croLogi x 1200 Cont rol l ers and M i croLogi x 1500 Seri es B and hi gher Processors onl y)
Parameter Options Programming
Software Default
Channel M i croLogi x 1200: Channel 0
M i croLogi x 1500 1764-LSP Seri es B and hi gher: Channel 0 and 1
M i croLogi x 1500 1764-LRP: Channel 0 and 1
0 (1200 & LSP)
1 (LRP)
Dri ver M odbus RTU Sl ave
Baud Rat e 300, 600, 1200, 2400, 4800, 9600, 19.2K, 38.4K 19.2K
Pari t y none, even, odd none
Node Address 1 t o 247 deci mal 1
Cont rol Li ne No Handshaki ng, Hal f -Dupl ex M odem (RTS/ CTS Handshaki ng) No Handshaki ng
Int er-charact er
Ti meout (x1 ms)
0 t o 6553 (can be set i n 1 ms i ncrement s); 0 = 3.5 charact er t i mes
Speci f i es t he mi ni mum del ay bet ween charact ers t hat i ndi cat es t he end of a message packet .
0
M odbus Dat a Tabl e
Fi l e Number
Assi gnment
(M ust be Bi nary or
Int eger f i l e t ype)
Coi l s (Di scret e out put s, M odbus addresses 0001 t o 4096) range = 3 t o 255, 0 = no f i l e 0
Cont act s (Di scret e i nput s, M odbus addresses 10001 t o 14096) range = 3 t o 255, 0 = no f i l e 0
Input Regi st ers (Read Onl y, M odbus addresses 30001 t o 30256) range = 3 t o 255, 0 = no f i l e 0
Hol di ng Regi st ers (Read/ Wri t e, M odbus addresses 40001 t o 40256) range = 3 t o 255, 0 = no
f i l e
0
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
452 Prot ocol Conf i gurat i on
Modbus Slave Memory Map
The modbus Memory map is summarized in and detailed in:
RTS Of f Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s)
Speci f i es t he del ay t i me bet ween when t he l ast seri al charact er i s sent t o t he modem and
when RTS i s deact i vat ed. Gi ves t he modem ext ra t i me t o t ransmi t t he l ast charact er of a
packet .
0
RTS Send Del ay
(x20 ms)
0 t o 65535 (can be set i n 20 ms i ncrement s)
Speci f i es t he t i me del ay bet ween set t i ng RTS unt i l checki ng f or t he CTS response. For use
wi t h modems t hat are not ready t o respond w i t h CTS i mmedi at el y upon recei pt of RTS.
0
Pre Transmi t Del ay
(x1 ms)
0 t o 65535 (can be set i n 1 ms i ncrement s)
When t he Cont rol Li ne i s set t o No Handshaki ng, t hi s i s t he del ay t i me bef ore t ransmi ssi on.
Requi red f or 1761-NET-AIC physi cal Hal f -Dupl ex net works. The 1761-NET-AIC needs 2 ms of
del ay t i me t o change f rom recei ve t o t ransmi t mode.
When t he Cont rol Li ne i s set t o Hal f -Dupl ex M odem, t hi s i s t he mi ni mum t i me del ay bet ween
recei vi ng t he l ast charact er of a packet and t he RTS assert i on.
0
Modbus RTU Slave Communications Configuration Parameters
(M i croLogi x 1200 Cont rol l ers and M i croLogi x 1500 Seri es B and hi gher Processors onl y)
Parameter Options Programming
Software Default
Modbus to MicroLogix Memory Map - Summary
(M i croLogi x 1200 Cont rol l ers and M i croLogi x 1500 1764-LSP Seri es B and 1764-LRP Processors onl y)
Modbus
Addressing
Description Valid MicroLogix Addressing
File Type Data File Number Address
0001 t o 4096 Read/ Wri t e M odbus Coi l Dat a space Bi t (B) or Int eger (N) 3 t o 255 bi t s 0 t o 4095
10001 t o 14096 Read-Onl y M odbus Cont act Dat a space Bi t (B) or Int eger (N) 3 t o 255 bi t s 0 t o 4095
30001 t o 30256 Read-Onl y M odbus Input Regi st er space Bi t (B) or Int eger (N) 3 t o 255 words 0 t o 255
30501 t o 30532 M odbus Communi cat i on Paramet ers Communi cat i on St at us Fi l e - -
31501 t o 31566 Read-Onl y Syst em St at us Fi l e space St at us (S) 2 words 0 t o 65
40001 t o 40256 Read/ Wri t e M odbus Hol di ng Regi st er space Bi t (B) or Int eger (N) 3 t o 255 words 0 t o 255
40257 t o 41280
(1)
Read/ Wri t e M odbus Hol di ng Regi st er space Bi t (B) or Int eger (N) 3 t o 255 words 0 t o 255 of
f our Hol di ng
Regi st er f i l es
41501 t o 41566 Read/ Wri t e Syst em St at us Fi l e space St at us (S) 2 words 0 t o 65
41793 t o 42048
(1)
Read/ Wri t e M odbus Hol di ng Regi st er space Bi t (B) or Int eger (N) 3 t o 255 words 0 t o 255 of
t he l ast Hol di ng
Regi st er f i l e
(1) These addresses onl y become act i ve when speci al l y conf i gured f or expanded hol di ng regi st ers.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 453
Modbus Slave to MicroLogix Memory Map - Detail
(M i croLogi x 1200 Cont rol l ers and M i croLogi x 1500 1764-LSP Seri es B and 1764-LRP Processors onl y)
Modbus Addressing Modbus Address Reference Modbus Function Code (decimal)
0001 t o 4096 Read/ Wri t e M odbus Coi l Dat a space 1, 5, 15
10001 t o 14096 Read Onl y M odbus Cont act Dat a space 2
30001 t o 30256 Read M odbus Input Regi st er space 4
30501 M odbus Dat a Tabl e Coi l Fi l e Number 4
30502 Modbus Dat a Tabl e Cont act Fi l e Number 4
30503 M odbus Dat a Tabl e Input Regi st er Fi l e Number 4
30504 Modbus Dat a Tabl e Hol di ng Regi st er Fi l e Number 4
30506 Pre-Send Del ay 4
30507 Modbus Sl ave Address 4
30508 Int er-charact er Ti meout 4
30509 RTS Send Del ay 4
30510 RTS Of f Del ay 4
30511 Pari t y 4
30512 Present at i on Layer Error Code 4
30512 Present at i on Layer Error Code 4
30513 Present at i on Layer Error Count 4
30514 Execut ed Funct i on Code Error 4
30515 Last Transmi t t ed Except i on Code 4
30516 Fi l e Number of Error Request 4
30517 El ement Number of Error Request 4
30518 Funct i on Code 1 Message Count er - Read Si ngl e Out put Coi l 4
30519 Funct i on Code 2 Message Count er - Read Di scret e Input Image 4
30520 Funct i on Code 3 Message Count er - Read Si ngl e Hol di ng Regi st er 4
30521 Funct i on Code 4 Message Count er - Read Si ngl e Input Regi st er 4
30522 Funct i on Code 5 Message Count er - Set / Cl ear Si ngl e Out put Coi l 4
30523 Funct i on Code 6 Message Count er - Read/ Wri t e Si ngl e Hol di ng Regi st er 4
30524 Funct i on Code 8 Message Count er - Run Di agnost i cs 4
30525 Funct i on Code 15 M essage Count er - Set / Cl ear f or Bl ock of Out put Coi l s 4
30526 Funct i on Code 16 M essage Count er - Read/ Wri t e f or Bl ock of Hol di ng Regi st ers 4
30527 Modem St at us 4
30528 Tot al messages responded t o by t hi s sl ave 4
30529 Tot al messages t o t hi s Sl ave 4
30530 Tot al M essages Seen 4
30531 Li nk Layer Error Count 4
30532 Li nk Layer Error 4
31501 t o 31566 Read Onl y Syst em St at us Fi l e 4
40001 t o 40256 Read/ Wri t e M odbus Hol di ng Regi st er space (1st Hol di ng Regi st er f i l e). 3, 6, 16
40257 t o 40512 Read/ Wri t e M odbus Hol di ng Regi st er space (2nd Hol di ng Regi st er f i l e). 3, 6, 16
40513 t o 40768 Read/ Wri t e M odbus Hol di ng Regi st er space (3rd Hol di ng Regi st er f i l e). 3, 6, 16
40769 t o 41024 Read/ Wri t e M odbus Hol di ng Regi st er space (4t h Hol di ng Regi st er f i l e). 3, 6, 16
41025 t o 41280 Read/ Wri t e M odbus Hol di ng Regi st er space (5t h Hol di ng Regi st er f i l e). 3, 6, 16
41501 t o 41566 Read/ Wri t e Syst em St at us Fi l e 3, 6, 16
41793 t o 42048 Read/ Wri t e M odbus Hol di ng Regi st er space (6t h Hol di ng Regi st er f i l e). 3, 6, 16
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
454 Prot ocol Conf i gurat i on
Modbus Commands
The controller configured for Modbus RTU Slave responds to the Modbus
command function codes listed in below:
Supported Modbus Commands as a Modbus RTU Slave
(Mi croLogi x 1200 Cont rol l ers and M i croLogi x 1500 1764-LSP Seri es B and 1764-LRP Processors onl y)
Command Function Code
(decimal)
Subfunction Code
(decimal)
Read Coi l St at us 1 -
Read Input St at us 2 -
Read Hol di ng Regi st ers 3 -
Read Input Regi st ers 4 -
Wri t e Si ngl e Coi l
(1)
(1) Broadcast i s support ed f or t hi s command.
5 -
Wri t e Si ngl e Hol di ng Regi st er
(1)
6 -
Echo Command Dat a 8 0
Cl ear Di agnost i c Count ers 8 10
Wri t e M ul t i pl e Coi l s
(1)
15 -
Wri t e M ul t i pl e Hol di ng Regi st ers
(1)
16 -
Supported Modbus Commands as a Modbus RTU Master
(M i croLogi x 1200 FRN 8 and hi gher, M i croLogi x 1500 FRN 9 and hi gher)
Command Function Code
(decimal)
Subfunction Code
(decimal)
Read Coi l St at us 1 -
Read Input St at us 2 -
Read Hol di ng Regi st ers 3 -
Read Input Regi st ers 4 -
Wri t e Si ngl e Coi l
(1)
(1) Broadcast i s support ed f or t hi s command.
5 -
Wri t e Si ngl e Hol di ng Regi st er
(1)
6 -
Wri t e M ul t i pl e Coi l s
(1)
15 -
Wri t e M ul t i pl e Hol di ng Regi st ers
(1)
16 -
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 455
Modbus Error Codes
Upon receiving a Modbus command that is not supported or improperly
formatted, the controller configured for Modbus RTU Slave will respond with one
of the exception codes listed below:
The following table lists the possible error codes and error descriptions for the
Modbus RTU Master MSG Instruction.
Modbus Error Codes Returned by Modbus RTU Slave
(M i croLogi x 1200 Cont rol l ers and Mi croLogi x 1500 1764-LSP Seri es B and 1764-LRP Processors onl y)
Error
Code
Error Description Transmitted
Exception Code
(1)
0 No error. none
1 Funct i on Code cannot Broadcast . The f unct i on does not support Broadcast . not hi ng t ransmi t t ed
2 Funct i on Code not support ed. The cont rol l er does not support t hi s M odbus f unct i on or
subf unct i on.
1
3 Bad Command Lengt h. The M odbus Command i s t he wrong si ze. 3
4 Bad Lengt h. The f unct i on at t empt ed t o read/ wri t e past t he end of a dat a f i l e. 3
5 Bad paramet er The f unct i on cannot be execut ed wi t h t hese paramet ers. 1
6 Bad Fi l e Type The f i l e number bei ng ref erenced i s not t he proper f i l e t ype. 2
7 Bad Fi l e Number The f i l e number does not exi st 2
8 Bad M odbus Address
The f unct i on at t empt ed t o access an i nval i d M odbus address.
(2)
3
9 Tabl e Wri t e prot ect ed The f unct i on at t empt ed t o wri t e t o a read-onl y f i l e. 3
10 Fi l e Access Deni ed Access t o t hi s f i l e i s not grant ed. 2
11 Fi l e Al ready Owned Dat a f i l e i s al ready owned by anot her process. 2
(1) If M odbus Command i s sent wi t h a val i d Broadcast address, t hen no except i on repl y wi l l be sent f or Error Codes 2 t hrough 11.
(2) See on page 452 f or val i d M odbus memory mappi ng.
Modbus Error Codes in Modbus RTU Master MSG Instruction
(M i croLogi x 1200 FRN 8 and hi gher, M i croLogi x 1500 FRN 9 and hi gher)
Error
Code
Error Description Received Exception
Code
81 Il l egal Funct i on The f unct i on code sent by t he M ast er i s not support ed by t he sl ave
or has an i ncorrect paramet er.
1
82 Il l egal Dat a Address The dat a address ref erenced i n t he M ast er command does not exi st
i n t he sl ave, or access t o t hat address i s not al l owed.
2
83 Il l egal Dat a Val ue The dat a val ue bei ng wri t t en i s not al l ow ed, ei t her because i t i s out
of range, or i t i s bei ng wri t t en t o a read-onl y address.
3
84 Sl ave Devi ce Fai l ure An unrecoverabl e error occurred whi l e t he sl ave was at t empt i ng t o
perf orm t he request ed act i on.
4
85 Acknowl edge The sl ave has accept ed t he request , but a l ong durat i on of t i me wi l l
be requi red t o process t he request .
5
86 Sl ave Devi ce Busy The sl ave i s current l y processi ng a l ong-durat i on command. 6
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
456 Prot ocol Conf i gurat i on
When Channel 0 or Channel 1 is configured for Modbus RTU Master or Modbus
RTU Slave, the associated Channel Status screen displays a Link Layer Error Count
and a Link Layer Error Code. Use the table below to interpret the Link Layer Error
Code being displayed.
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
(For the 1764-LRP only, you can select either Channel 0 or Channel 1). 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 279 for
information on using the ASCII instructions. You can also send ASCII string data
to most attached devices that accept ASCII data/characters.
87 Negat i ve Acknowl edge The sl ave cannot perf orm t he program f unct i on recei ved i n t he
command.
7
88 M emory Pari t y Error The sl ave at t empt ed t o read ext ended memory, but det ect ed a
pari t y error i n t he memory.
8
89 Non-st andard Error Code An error code great er t han 8 was ret urned by t he sl ave. >8
Modbus Error Codes in Modbus RTU Master MSG Instruction
(M i croLogi x 1200 FRN 8 and hi gher, M i croLogi x 1500 FRN 9 and hi gher)
Error
Code
Error Description Received Exception
Code
Modbus RTU Link Layer Error Codes
Error Code Description
0 No error.
1 No recei ve buf f er avai l abl e f or repl y.
2 Too short message recei ved.
3 Too l ong message recei ved.
4 UART error duri ng repl y recept i on.
5 Bad CRC i n repl y packet .
6 CTS one-second t i meout pri or t o t ransmi ssi on.
7 CTS dropped i n mi d-packet t ransmi ssi on.
9 Packet recei ve f rom unknown sl ave or bad sl ave.
10 Funct i on code mi smat ch.
11 Funct i on code not support ed.
13 Repl y t i meout .
TIP Onl y ASCII i nst ruct i ons can be used when a channel i s conf i gured f or
ASCII. If you use a M essage (M SG) i nst ruct i on t hat ref erences t he channel ,
an error occurs.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Prot ocol Conf i gurat i on 457
The channel configuration screen is shown below:
The controller updates changes to the channel configuration at the next execution
of a Service Communications (SVC) instruction, I/O Refresh (REF) instruction,
or when it performs Communications Servicing, whichever comes first.
When the driver is set to ASCII, the following parameters can be changed:
ASCII Channel Configuration Parameters
(M i croLogi x 1200; M i croLogi x 1500 1764-LSP Seri es B and hi gher, and M i croLogi x 1500 1764-LRP)
Parameter Description Programming
Software Default
Channel M i croLogi x 1200, and M i croLogi x 1500 1764-LSP Seri es B and hi gher: Channel 0
M i croLogi x 1500 1764-LRP: Channel 0 or 1
0 (1200 & LSP)
0 or 1 (LRP)
Dri ver ASCII
Baud Rat e Toggl es bet ween t he communi cat i on rat e of 300, 600, 1200, 2400, 4800, 9600, 19.2K, and 38.4K. 1200
Pari t y Toggl es bet ween None, Odd, and Even. None
Termi nat i on 1 Speci f i es t he f i rst t ermi nat i on charact er. The t ermi nat i on charact er def i nes t he one or t wo charact er
sequence used t o speci f y t he end of an ASCII l i ne recei ved. Set t i ng t he f i rst ASCII t ermi nat i on
charact er t o undef i ned (\f f ) i ndi cat es no ASCII recei ver l i ne t ermi nat i on i s used.
\d
Termi nat i on 2 Speci f i es t he second t ermi nat i on charact er. The t ermi nat i on charact er def i nes t he one or t wo
charact er sequence used t o speci f y t he end of an ASCII l i ne recei ved. Set t i ng t he second ASCII
Termi nat i on charact er t o undef i ned (\f f ) and t he f i rst ASCII Termi nat i on charact er t o a def i ned val ue
(\d) i ndi cat es a si ngl e charact er t ermi nat i on sequence.
\f f
Cont rol Li ne Toggl es bet ween No Handshaki ng, Hal f -Dupl ex M odem, and Ful l -Dupl ex M odem No Handshaki ng
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
458 Prot ocol Conf i gurat i on
Del et e M ode The Del et e M ode al l ows you t o sel ect t he mode of t he del et e charact er. Toggl es bet ween Ignore,
CRT, and Pri nt er.
Del et e M ode af f ect s t he charact ers echoed back t o t he remot e devi ce. When Del et e M ode i s enabl ed,
t he previ ous charact er i s removed f rom t he recei ve buf f er.
In CRT mode, when a del et e charact er i s encount ered, t he cont rol l er echos t hree charact ers t o t he
devi ce: backspace, space, and backspace. Thi s erases t he previ ous charact er on t he t ermi nal .
In Pri nt er M ode, when a del et e charact er i s encount ered, t he cont rol l er echos t he sl ash charact er,
t hen t he del et ed charact er.
Enabl e t he Echo paramet er t o use Del et e M ode.
Ignore
Echo When Echo M ode i s enabl ed, al l of t he charact ers recei ved are echoed back t o t he remot e devi ce. Thi s
al l ows you t o vi ew charact ers on a t ermi nal connect ed t o t he cont rol l er. Toggl es bet ween Enabl ed and
Di sabl ed.
Di sabl ed
XON/ XOFF Al l ows you t o Enabl e or Di sabl e XON/ XOFF sof t ware handshaki ng. XON/ XOFF sof t ware handshaki ng
i nvol ves t he XON and XOFF cont rol charact ers i n t he ASCII charact er set .
When t he recei ver recei ves t he XOFF charact er, t he t ransmi t t er st ops t ransmi t t i ng unt i l t he recei ver
recei ves t he XON charact er. If t he recei ver does not recei ve an XON charact er af t er 60 seconds, t he
t ransmi t t er aut omat i cal l y resumes sendi ng charact ers.
Al so, w hen t he recei ve buf f er i s more t han 80% f ul l , an XOFF charact er i s sent t o t he remot e devi ce t o
pause t he t ransmi ssi on. Then, when t he recei ve buf f er drops t o l ess t han 80% f ul l , an XON charact er
i s sent t o t he remot e devi ce t o resume t he t ransmi ssi on.
Di sabl ed
RTS Of f Del ay
(x20 ms)
Al l ows you t o sel ect t he del ay bet ween when a t ransmi ssi on i s ended and when RTS i s dropped.
Speci f y t he RTS Of f Del ay val ue i n i ncrement s of 20 ms. Val i d range i s 0 t o 65535.
0
RTS Send
Del ay (x20 ms)
Al l ows you t o sel ect t he del ay bet ween when RTS i s rai sed and t he t ransmi ssi on i s i ni t i at ed. Speci f y
t he RTS Send Del ay val ue i n i ncrement s of 20 ms. Val i d range i s 0 t o 65535.
0
ASCII Channel Configuration Parameters
(M i croLogi x 1200; M i croLogi x 1500 1764-LSP Seri es B and hi gher, and M i croLogi x 1500 1764-LRP)
Parameter Description Programming
Software Default
459 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Appendix F
Knowledgebase Quick Starts
The following Quick Start topics are included:
17583 Quick Start Pulse Train Output (PTO) on page 459
17585 Quick Start Pulse Width Modulation (PWM) on page 462
17586 Quick Start High Speed Counter (HSC) on page 463
17605 Quick Start Message (MSG) on page 468
17653 Quick Start Selectable Timed Interrupt (STI) on page 471
17655 Quick Start Real Time Clock (RTC) on page 473
17657 Quick Start Trim Pots on page 475
17712 Quick Start User Interrupt Disable (UID) on page 477
18689 Quick Start RTC Synchronization Between Controllers on page 478
18728 Quick Start Data Logging (DLG) on page 481
17583 Quick Start
Pulse Train Output (PTO)
Locate the Function Files under Controller in RSLOGIX 500 v4.00 or later and
select the PTO tab, then select the [+] next to PTO:0 (See Below).
TIP The PWM f unct i on i s onl y avai l abl e when usi ng t he BXB model s of t he
M i croLogi x 1200 or 1500
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
460 Knowl edgebase Qui ck St art s
Enter the following parameters as the Minimum Configuration required for the
PTO to generate pulses.
Example
The following example will generate 10,000 pulses on Output O:0/2 at a frequency
of 500Hz and 100 pulses will be used for Accelerating and 100 pulses will be used
for Decelerating.
PTO:0.OUT Select Destination Output for pulses: Output O:0/2 or O:0/3
PTO:0.OF Output Frequency - Frequency of pulses: 0 to 20,000 Hz
Data less then zero and greater then 20,000 generates a PTO error
PTO:0.TOP Total Output Pulses - Determines total number of pulses to be
generated by the controller
PTO:0.ADP Accel/Decel Pulses - How many of the total pulses will be used for
the Accel/Decel component
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 461
The following ladder logic will need to be entered into File #2
By toggling Bit B3/0 the PTO can be activated. Once running the PTO will
generate the number of pulses entered into the PTO:0.TOP word and then stop.
To restart, toggle B3/0.
General Information on the PTO
Once running the PTO will continue to generate pulses until all pulses have been
generated or the PTO:0/EH (Enable Hard Stop) bit has been activated.
Once the EH bit is set the instruction will generate a PTO error of 1 (hard stop
detected). In order to clear this error the PTO 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 PTO:0.TOP by using the MOV command.
IMPORTANT Once t he PTO has been i ni t i at ed and i s generat i ng pul ses a new TOP val ue
wi l l not t ake ef f ect unt i l t he PTO has ei t her compl et ed generat i ng pul ses
and has been rest art ed or has been Hard St opped usi ng PTO:0/ EH bi t and
been rest art ed.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
462 Knowl edgebase Qui ck St art s
17585 Quick Start
Pulse Width Modulation
(PWM)
Locate the Function Files under Controller in RSLOGIX 500 v4.50.00 or later and
select the PWM tab, then select the [+] next to PWM:0 (See Below).
Enter the following parameters as the Minimum Configuration required for the
PWM to generate a waveform at the specified frequency.
TIP The PWM f unct i on i s onl y avai l abl e w hen usi ng t he BXB model s of t he
M i croLogi x 1200 or 1500
PWM:0.OUT Select Destination Output for pulses: Output O:0/2 or O:0/3
PWM:0.OFS Output Frequency - Frequency of the PWM: 0 to 20,000 Hz
PWM:0.DC PWM Duty Cycle - Controls the output signal of the PWM: 1 to 1000
DC = 1000 100% Output ON (Constant no waveform)
DC = 0750 075% Output ON 025% Output OFF
DC = 0500 050% Output ON 050% Output OFF
DC = 0250 025% Output ON 075% Output OFF
DC = 0000 000% Output OFF (Constant no Waveform)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 463
Example
The following example will generate a waveform on Output O:0/2 at a frequency
of 250Hz and a 50% Duty Cycle.
The following ladder logic will need to be entered into File #2
By toggling Bit B3/0 the PWM can be activated.
17586 Quick Start High
Speed Counter (HSC)
General Information
The MicroLogix 1200 has one 20Khz high-speed counter. The counter has four
dedicated inputs that are isolated from all other inputs on the unit. The HSC can
utilize inputs 0 through 3. Input device connection depends on the counter mode
selected. The MicroLogix 1200 uses a 32-bit signed integer for the HSC this allows
for a count range of (+/-) 2,147,483,647.
TIP Once act i vat ed t he PWM wi l l cont i nue t o generat e a wavef orm unt i l B3/ 0 i s
t oggl ed OFF or t he PWM :0/ EH (Enabl e Hard St op) bi t has been act i vat ed.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
464 Knowl edgebase Qui ck St art s
The MicroLogix 1500 has two 20Khz high-speed counters. Each counter has
four dedicated inputs that are isolated from all other inputs on the base unit
HSC:0 can utilize inputs 0 through 3, and HSC: 1 can utilize inputs 4 through 7.
Input device connection depends on the counter mode selected. Each counter is
completely independent and isolated from the other. The MicroLogix 1500 uses a
32-bit signed integer for the HSC this allows for a count range of (+/-)
2,147,483,647.
Getting Started
Locate the Function Files under Controller in RSLOGIX 500 and select the HSC
tab, then select the [+] next to HSC:0 (See Below)
Enter the following parameters for the Minimum Configuration required
for the HSC to count pulses.
TIP There i s no addi t i onal l adder l ogi c requi red t o enabl e t he Hi gh Speed
Count er. In ot her words t here i s no HSC i nst ruct i on needed f or t he l adder
l ogi c 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 to 255).
HSC:0/AS Auto-Start defines if the HSC function will automatically start when the MicroLogix 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.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 465
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.
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.
Proper wiring of a single ended encoder (Typical Allen-Bradley 845TK) when
configuring HSC.MOD for Mode 6 (Quadrature Counter)
The following diagram illustrates connecting an encoder to the MicroLogix 1500,
but the same wiring can be applied for the MicroLogix 1200.
TIP Each mode f or t he HSC w i l l conf i gure t he i nput s f or di f f erent f unct i onal i t y.
IMPORTANT It i s assumed t hat t he user has connect ed a devi ce t o I:0/ 0 t o generat e pul ses.
TIP The f ol l owi ng l adder l ogi c does not need t o be ent ered i nt o Fi l e #2, however
t hi s al l ows f or easy vi ewi ng of t he accumul at ed count s f rom t he HSC:0.ACC.
IMPORTANT Ladder Logi c Subrout i ne f i l e #3 must be creat ed i n order f or t hi s exampl e t o
work. If t he subrout i ne i s not creat ed t he CPU wi l l f aul t due t o an
HSC Error Code 1- Inval i d Fi l e Number f or PFN has been ent ered.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
466 Knowl edgebase Qui ck St art s
The minimum configuration required for Mode 6 operation is to enter a file
number for the PFN parameter, set the AS and CE bits to a (1) and enter a (6) for
the MOD parameter.
TROUBLESHOOTING
Problem #1:The input LEDS on the Micrologix Base unit turn 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.
Follow the steps below....
Select I/O Configuration
Highlight the 1764-Micrologix 1500
Select Adv Config
Select the Embedded I/O Configuration Tab
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 467
Adjust Input filters as needed
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
then (3) or greater then (255) or the file number entered was correct, however the
file does not exist.
Create the NEWprogram file by Right mouse clicking on Program Files
Problem #3: Some of my outputs will 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(s) has been assigned to the
HSC for control, then the output(s) will not be controlled anywhere else in the
ladder program. Only the HSC will have control over these outputs.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
468 Knowl edgebase Qui ck St art s
17605 Quick Start
Message (MSG)
Communications Specifications:
The MicroLogix 1200 & 1500 processors contain a total of (12) Message Buffers.
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.
How quickly a message is actually sent or received to/by a destination device
depends on a number of issues, including the selected channels communication
protocol, baud rate of the communications port, number of retries, destination
devices readiness to receive, ladder logic scan time, etc.
Definition of the Message (MSG) instruction:
The message instruction (MSG) is an output instruction which when configured
correctly allows data to be sent or received to other compatible devices.
The MSG instruction in the MicroLogix 1200/1500 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).
Continuous Message Example:
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 ML1500 and the other either a ML1000 or ML1500. The
ML1500 will need to be configured as Node 1 and the other processor as node 4.
(8) Incoming Any incoming MSG's, Communications, and/or
responses to a command the ML1200/1500 initiated.
(4) Outgoing Any outgoing MSG's, Communications and/or
responses to incoming request for data.
TIP If a message has been wai t i ng i n t he queue, at t he moment of buf f er
avai l abi l i t y, t he most current dat a wi l l be sent , not t he dat a t hat was
avai l abl e at t he t i me t he message i nst ruct i on w as f i rst scanned t rue.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 469
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 ML1500 (Node 1) and enter the value 63.
Micrologix 1500 (Node 1) Ladder Logic
MSG Setup Screen
Micrologix 1000 (Node 4) Ladder Logic
No ladder logic is required in the destination processor, however the
communications channel must be configured to match the source processor. Since
the default settings for the ML1500 communications channel is DF1 protocol,
19,200 Kbaud the ML1000 must be configured to match. (See Below)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
470 Knowl edgebase Qui ck St art s
Micrologix 1000 Channel Configuration
Verifying data has been sent:
To verify the data has been sent to node 4 disconnect the HM02 cable and connect
the PC running RSLogix 500 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 is being 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 ML1000, the address would be O:0.0 This will
display, in binary on the output LEDS, what ever number that was entered into
N7:0 of the ML1500.
If a 16 Point MicroLogix 1000 is being used as the destination processor (Node 1),
and the number 63 is entered into the above example, all the outputs will be
energized or turn. If the number entered is greater then 63 then a fault may occur
with an error stating that the extended I/O bit (S:0/8) was not set. In this case
clear the fault, go offline, set bit (S:0/8) and re-download the ladder program.
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 Af t er t he l adder l ogi c has been ent ered i nt o t he M L1500 and t he M L1000
channel conf i gurat i on has been changed, i n order f or t hi s exampl e t o
f unct i on connect t he cont rol l ers usi ng a 1761-CBL-HM 02 cabl e, l eave
connect ed unt i l t he COM M 0 LED on t he M L1500 st art s t o bl i nk.
IMPORTANT By addressi ng O:0.0 t he out put s of t he dest i nat i on processor wi l l be
energi zed upon successf ul t ransmi ssi on of dat a. Veri f y t hat not hi ng i s
connect ed t o t he out put s t o ensure saf e operat i on of t he cont rol l er.
TIP Thi s exampl e was wri t t en usi ng a M L1500 communi cat i ng t o a M L1000,
however any DF1 or DH485 devi ce coul d have been subst i t ut ed f or t he M L1000.
(i .e. M i croLogi x 1200, SLC 5/ 03, 5/ 04, 5/ 05, PLC-5, Bar Code Scanners, et c.)
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 471
17653 Quick Start
Selectable Timed
Interrupt (STI)
What is an Interrupt?
An interrupt is an event that causes the processor to suspend the task it is currently
performing, perform a different task, and then return to the suspend task at the
point where it suspended.
STI Definition
The 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.
Example: A Block of logic that needs to be scanned more often then the rest of the
ladder program.
Getting Started:
Locate the Function Files under Controller in RSLOGIX 500 v4.00 or later and
select the STI tab (See Below)
Enter the following parameters as the Minimum Configuration required for
theSTI
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 to 255).
STI:0/AS Auto-Start defines if the STI function will automatically start when
the MicroLogix 1500 enters run or test.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
472 Knowl edgebase Qui ck St art s
Example
The following example configures the STI to execute sub-routine file #3 (PFN=3)
every 2 seconds (SPM=2000). In the subroutine file there is an ADD instruction
simply adding the value of 1 to N7:0 each time the sub-routine is scanned.
This example also sets the User Interrupt Enable bit and the Auto Start bit
allowing the STI to execute.
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.
IMPORTANT Ladder Logi c Subrout i ne f i l e #3 must be creat ed i n order f or t hi s exampl e t o
work. If t he subrout i ne i s not creat ed t he CPU wi l l f aul t due t o a STI Error
Code 1- Inval i d Fi l e Number f or PFN has been ent ered.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 473
Notes on using Interrupt bits
If the Auto Start bit (AS) is set this will start the interrupt on power up and set the
Timed Interrupt Enabled bit (TIE) automatically, allowing the interrupt to execute.
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.
17655 Quick Start Real
Time Clock (RTC)
General Information:
The RTC provides Year, Month, Day, Day of Month, Day of Week, Hour, Minute,
and Second information to the RTC Function file in the controller.
The RTC module is located in the processor unit, under the processor cover
(Shown Below). Like the Memory Module the RTC can be removed or inserted
under power without risk of damage to the RTC or the processor module. If the
module is installed while the ML1200/1500 is executing, the module will not be
recognized until a power cycle occurs or the controller is placed into program
mode or faults.
ML1200 ML1500
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
474 Knowl edgebase Qui ck St art s
Getting Started:
Locate the Function Files under Controller in RSLOGIX 500 v4.00 or later and
select the RTC tab (See Below)
Values can be entered for the Year, Month, Day, Hour, Minute, and Seconds
offline, once downloaded the values will take effect immediately.
Pressing this will set the ML1200/1500 clock to the same
Date & Time as the PC connected online.
TIP The Day of t he week i s cal cul at ed by t he RTC Onl i ne.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 475
Pressing will disable the RTC from functioning and decrease
the drain on the battery during storage.
17657 Quick Start Trim
Pots
General
On the ML1200 the trim pots are located next to the communication port. On the
ML1500 the trim pots are located below the mode switch under the left access
door of the processor. Each of the trim pots can be used to manipulate data within
the controller. The data value of the trim pots can be used throughout the control
program as timer, counter, analog presets, etc.
ML1200 ML1500
Adjust the trim pots using a small flathead screwdriver. By turning the trim pot the
data will change within a range of 0 to 250 (fully clockwise). The maximum
rotation of each pot is three quarters of a turn.
RTC:0/BL The Battery Low bit will be set (1) when the battery is low. This
means that the battery will fail in less than 14 Days after which the
RTC data may become invalid. At this time the RTC module will
need to be replaced.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
476 Knowl edgebase Qui ck St art s
Getting Started:
Locate the Function Files under Controller in RSLOGIX 500 v4.00 or later and
select the TPI tab (See Below)
There is no configuration needed for the trim pots. The values are read only. While
online, turn the trim pots and watch the values change.
TrimPot Example Ladder Logic
The following example will MOVe the value from trim pot 0 (POT0) into the
preset word of the free running timer at T4:0
Using a trimpot to adjust a value larger then 250
By using the SCP instruction a ladder program can be written which will allow the
trim pot to adjust between:
-32768 to 32767 using standard word
-2,147,483,648 to 2,147,483,647 using long words
TIP Si nce t he t ri m pot s onl y adj ust f rom 0 t o 250 t he t i mer preset i s onl y adj ust abl e
f rom 0 t o 250 seconds.
IMPORTANT Remember t hat t he t ri m pot s onl y have 3/ 4 of a t urn resol ut i on.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 477
The following example takes the input value of trim pot 0 (0 - 250) and scales it
from 0 to 600 using the Scale with Parameters instruction (SCP). The scaled value
is placed in the preset of the free running timer at T4:0. This allows for POT 0 to
adjust from 0 to 10 minutes (600 Sec.).
17712 Quick Start User
Interrupt Disable (UID)
The UID instruction can be used as an output instruction to disable selected
userinterrupts.
Once a user interrupt is disabled the User Interrupt Enable bit (UIE) for the
selected interrupt will be cleared or reset to a 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.
To disable interrupt(s) follow these steps....
1. Select which Interrupt(s) to disable from the above table.
2. Locate the decimal value for each Interrupt(s).
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
478 Knowl edgebase Qui ck St art s
3. Add the decimal values together if more then one Interrupt was selected.
4. Enter the sum into the UID instruction.
For example, to disable EII Event 1 and EII Event 3....
EII Event 1 = 32 EII Event 3 = 04
32 + 04 = 36 (Enter this value in the UID instruction)
Notes on using Interrupt bits
If the Auto Start bit (AS) is set this will start the interrupt on power up and set the
Timed Interrupt Enabled bit (TIE) automatically, allowing the interrupt to execute.
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.
18689 Quick Start RTC
Synchronization
Between Controllers
The following example illustrates a message write from an SLC 5/03 or higher
processor to a Micrologix 1500 processor with an installed RTC module that has
been enabled.
This example can also be applied for messaging between Micrologix 1200 and 1500
controllers. When messaging from a Micrologix 1200/1500 controller to another
Micrologix 1200/1500 it is recommended that RTC:0 be used as the source instead
of (S:37 - S:42).
MinimumHardware/Software requirements
Micrologix 1200 Series B FRN 2
Micrologix 1500 Series B FRN 4
RSLOGIX 500 is 4.10.00.02
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 479
Example
The example shows network connections using DH-485, however DF1 Full or
Half Duplex will also work.
1) Configure the SLC's Channel 0 port for DH-485 protocol.
2) Enter the following ladder logic into the SLC processor.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
480 Knowl edgebase Qui ck St art s
The example above messages the SLC 500 Date and Time data (S:37 - S:42)to the
Micrologix 1500 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 (i.e. N100:0 = MSG1 | N100:20 = MSG2 | N100:40 =
MSG3, etc.) and specifying a different node address in the MSG set-up screen.
ATTENTION: Val i d years f or t he M i crol ogi x 1200 and 1500 begi n wi t h 1998.
Any dat e/ t i me/ year val ues, pri or t o 1998, t hat are sent t o a M i crol ogi x
cont rol l er wi l l generat e a M SG Error Code 10h.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 481
18728 Quick Start Data
Logging (DLG)
General Information
The Data logging feature allows the creation of memory queues to capture or store
application data as a record for later retrieval. Each record is stored in a
user-configured battery backed queue. The size of memory where queues are stored is
48K bytes, this is independent of the rest of the processor memory.
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 48K bytes, independent of the rest of the
processormemory.
Configuring the DLG instruction in the Micrologix 1500 (LRP)
1. Create a new RSLogix 500 project for the 1764-LRP processor
2. Create a new rung of ladder logic in File 2 as shown below.
FYI - The DLG instruction ONLY captures data on a false-to-true
rungtransition.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
482 Knowl edgebase Qui ck St art s
3. Double Click Data Logging - Configuration in the controller organizer to
access the Data Log Queue Configuration window
FYI - Every time Configuration above is double-clicked a new queue is
added. To delete queues, simply select the queue with the mouse and press
the <delete> key on the keyboard.
4. Double-Click on Data Log configuration to open the
Configurationwindow.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 483
5. Complete the Data Log Queue as shown below. The Number of records and
Addresses selected were arbitrary for this example.
6. Click OK when completed
7. Click OK and accept the Data Log Que window
8. Once the N10 file has been created enter the following values for each
9. Download the program to your MicroLogix 1500 LRP.
10. Go On-Line
11. Toggle the Data Logging Enable(B3:0/0) bit Off to On a total of 5 times.
IMPORTANT Int eger f i l e N10 must be creat ed wi t h a l engt h of 5 or t he sof t ware wi l l not
compi l e t he l adder program. Al so a 1764-RTC, 1764-M M 1RTC,
1764-M M 2RTC must be i nst al l ed and conf i gured i f t he Dat e and Ti me st amp
are t o be used. If an RTC modul e i s not i nst al l ed & conf i gured t he dat a f or
t hese f i el ds wi l l cont ai n zeros.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
484 Knowl edgebase Qui ck St art s
Using the Data Logging Utility Software to recover data
The Data Logging utility is the only supported method for
retrieving data, that has been stored in the processor.
1. Install the DLOG utility (found at http://www.ab.com/plclogic/
micrologix/)
2. Execute DLCA1764.EXE
3. Configure Port, Baud Rate, and DF1 Node as shown below.
4. Click Connect.
FYI - By default the MicroLogix 1500 communications are configured for
19200 baud If using defaults select 19200 above, otherwise select the baud
rate configured in the MicroLogix Channel Configuration Screen.
If a correct configuration has been selected the utility software will indicate that it
has connected to the processor as shown below.
5. Click Read Status once a valid connection is established
ATTENTION: If any ot her sof t ware package, such as RSLINX has cont rol of
t he comput ers communi cat i on port or i f t he wrong COM port i s sel ect ed or a
processor ot her t hen t he 1764-LRP i s connect ed t o t he comput er you wi l l not
be abl e t o cont i nue.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 485
The DLOG utility will now retrieve the status information from the
ML1500processor.
In this example you can see that Que#0 has 100 records allocated and 5 recorded.
6. Select Read Log. This will retrieve the data from the ML1500 processor
Once the Read Log has completed the following screen will appear confirming the
number of records that have been read from the Queue(s)
7. Click Save Data.
8. Enter a file name. In our example My_DLG_Data was used.
IMPORTANT If you do not see 5 records veri f y your Dat a Loggi ng Enabl e bi t was t oggl ed
5 t i mes causi ng t he 5 ent ri es t o be recorded i n t he Que.
TIP Dat a CANNOT be vi ewed i n t he Dat a Log Ut i l i t y. The ut i l i t y onl y al l ows
ret ri eval of t he dat a st ored i n t he Queues and creat es an of f -l i ne f i l e.
TIP Remember t hat once t he dat a records have been read f rom t he M i croLogi x
t he queue i s aut omat i cal l y cl eared.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
486 Knowl edgebase Qui ck St art s
Make note of the filename about to be created and the directory it is being saved to
for later reference.
9. Using Microsoft Excel open the data file that was created.
FYI - 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
forreadability.)
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.
Frequently Asked Questions
Q1: Can I write my own software application to retrieve the data stored in the Data
Logging queue?
A1: Yes - In the MicroLogix 1200/1500 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.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Knowl edgebase Qui ck St art s 487
Q2: Can the MicroLogix 1500 - LRP processor automatically send the information
stored in the Data Logging queue directly to a printer?
A2: No - To retrieve the data either the free Data Logging Utility software must be
used 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.
Using the DATALOG Utility to retrieve data remotely via a Remote
Access ModemKit (RAD)
For more information on Remote Access Modem Kits visit http://
support.rockwellautomation.com/modem/modem_Main.asp
The following outlines the configuration and steps that can be used to read data
log records from an MicroLogix 1500 (1764-LRP) controller remotely via a
1747CH0RAD (Remote Access Modem Kit)
This example assumes that the programmer has configured the DLG instruction in
the ML1500 to log data and that HyperTerminal is installed, configured and the
user is familiar with its use.
ESTABLISHING CONNECTIONS
1. Connect the modem to Channel 1 of the 1764-LRP
2. Configure Channel 1 (9-Pin) for DF1 Full Duplex, 9600 baud, no parity, and
full duplex modem handshaking. This setting is critical, as the system will
not communicate if full duplex modem handshaking isn't applied to the comms
channel connected to the modem.
3. Configure HyperTerminal for direct connection to the PC COMM port the
modem is connected to. Make sure the HyperTerminal connection is
configured for 9600 baud.
4. Save configuration as DataLog .
5. Send the following dial-out string using HyperTerminal to dial the modem
and establish the connection:
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
488 Knowl edgebase Qui ck St art s
AT&C1DT(Phone number of destination Modem) then press enter
your modem will respond: CONNECT 9600
Once the connection is established, exit HyperTerminal by selecting File/Exit
from the pull-down menu. When asked Do you want to close connection select
Yes. This will only close the connection from HyperTerminal to the RS-232 port.
The connection will remain active.
FYI - It will appear as though HyperTerminal has disconnected. It has not;
the connection is still established only HyperTerminal is no longer running.
6. Open the Data Logging Utility.
7. Select in the DLG Utility the COMM port that the PC modem is
configuredfor.
8. Click Connect.
DISCONNECTING MODEM
1. 1. Ensure the DLG Utility has been shutdown.
2. 2.Start HyperTerminal (Do not re-connect)
3. 3.Open the previously configured Datalog
4. Type +++ to place modem in command mode,
Do not press the ENTER KEY!
Your modem will respond: OK
5. Type ATH
6. Press Enter. This will send the disconnect command to modem.
489 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Glossary
The following terms are used throughout this manual. Refer to the Allen-Bradley
Industrial Automation Glossary, Publication Number 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.
AIC+Advanced Interface Converter
A device that provides RS-232 isolation to an RS-485 Half-Duplex communication
link. (Catalog Number 1761-NET-AIC.)
application
1) A machine or process monitored and controlled by a controller. 2) The use of
computer- or processor-based routines for specific purposes.
ASCII
American Standard Code for Information Interchange. A standard for defining
codes for information exchange between equipment produced by different
manufacturers. The basis of character sets used in most microcomputers; a string
of 7 binary digits represents each character.
baud rate
The speed of communication between devices. Baud rate is typically displayed in K
baud. For example, 19.2K baud = 19,200 bits per second.
bit
The smallest unit of memory used in discrete or binary logic, where the value 1
represents ON and 0 represents OFF.
block diagrams
A method used to illustrate logic components or a sequence of events.
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.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
490 Gl ossary
branch
A parallel logic path within a rung of a ladder program. Its primary use is to build
OR logic.
communication scan
A part of the controllers operating cycle. Communication with devices (such as
other controllers and operator interface devices) takes place during this period.
control program
User logic (the application) that defines the controllers operation.
controller
A device, such as a programmable controller, used to control output devices.
controller overhead
A portion of the operating cycle used for housekeeping purposes (memory checks,
tests, communications, etc.).
control profile
The means by which a controller determines which outputs turn on under
whatconditions.
counter
A device that counts the occurrence of some event.
CPU (Central Processing Unit)
The decision-making and data storage section of a programmable controller.
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
Manufactured according to Deutsche Industrie Normenausshus (DIN) standards,
a metal railing designed to ease installation and mounting of your devices.
download
The transfer of program or data files to a device.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Gl ossary 491
DTE
Data Terminal Equipment
EMI
Electromagnetic interference.
embedded I/O
Embedded I/O is the controllers on-board I/O. For MicroLogix controllers,
embedded I/O is all I/O residing at slot 0.
expansion I/O
Expansion I/O is I/O that is connected to the controller via a bus or cable.
MicroLogix 1200 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
Any run or test mode.
false
The status of an instruction that does not provide a continuous logical path on a
ladder rung.
FET
Field Effect Transistor. DC output capable of high-speed operation.
FIFO (First-In-First-Out)
The order that data is stored and retrieved from a file.
file
A collection of data or logic organized into groups.
full-duplex
A mode of communication where data may be transmitted and received
simultaneously (contrast with half-duplex).
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
492 Gl ossary
half-duplex
A mode of communication where data transmission is limited to one direction at
atime.
hard disk
A storage device in a personal computer.
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
thecontroller.
input scan
The controller reads all input devices connected to the input terminals.
inrush current
The temporary surge of current produced when a device or circuit is
initially energized.
instruction
A mnemonic defining an operation to be performed by the processor. A rung in a
program consists of a set of input and output instructions. The input instructions
are evaluated by the controller as being true or false. In turn, the controller sets the
output instructions to true or false.
instruction set
The set of instructions available within a controller.
I/O
Input and Output
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Gl ossary 493
jump
Changes the normal sequence of program execution. In ladder programs a JUMP
(JMP) instruction causes execution to jump to a specific rung in the user program.
ladder logic
A graphical programming format resembling a ladder-like diagram. The ladder
logic programing language is the most common programmable controller language.
least significant bit (LSB)
The element (or bit) in a binary word that carries the smallest value of weight.
LED (Light Emitting Diode)
Used as status indicator for processor functions and inputs and outputs.
LIFO (Last-In-First-Out)
The order that data is stored and retrieved from a file.
low byte
Bits 0 to 7 of a word.
logic
A general term for digital circuits or programmed instructions to perform required
decision making and computational functions.
Master Control Relay (MCR)
A hard-wired relay that can be de-energized by any series-connected emergency
stop switch.
mnemonic
A simple and easy to remember term that is used to represent a complex or lengthy
set of information.
Modbus RTU Slave
A half-duplex serial communication protocol.
modem
Modulator/demodulator. Equipment that connects data terminal equipment to a
communication line.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
494 Gl ossary
modes
Selected methods of operation. Example: run, test, or program.
negative logic
The use of binary logic in such a way that 0 represents the desired voltage level.
network
A series of stations (nodes) connected by some type of communication medium. A
network may be made up of a single link or multiple links.
nominal input current
The typical amount of current seen at nominal input voltage.
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
isactivated.
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
When a device is not scanning/controlling or when a programming device is not
communicating with the controller.
offset
A continuous deviation of a controlled variable from a fixed point.
off-state leakage current
When a mechanical switch is opened (off-state), no current flows through the
switch. Semiconductor switches and transient suppression components which are
sometimes used to protect switches, have a small current flow when they are in the
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Gl ossary 495
off state. This current is referred to as the off-state leakage current. To ensure
reliable operation, the off-state leakage current rating must be less than the
minimum operating current rating of the device that is connected.
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
When a device is scanning/controlling or when a programming device is
communicating with the controller.
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
outputterminals.
PCCC
Programmable Controller Communications Commands
processor
A Central Processing Unit. (See CPU.)
processor files
The set of program and data files resident in the controller.
program file
Areas within a processor that contain the logic programs. MicroLogix controllers
support multiple program files.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
496 Gl ossary
program mode
When the controller is not scanning the control program.
program scan
A part of the controllers operating cycle. During the program scan, the logic
program is processed and the Output Image is updated.
programming device
Programming package used to develop ladder logic diagrams.
protocol
The rules of data exchange via communications.
read
To acquire data. For example, the processor reads information from other devices
via a read message.
relay
An electrically operated device that mechanically switches electrical circuits.
relay logic
A representation of binary or discrete logic.
restore
To transfer a program from a device to a controller.
reserved bit
A location reserved for internal use.
retentive data
Information (data) that is preserved through power cycles.
RS-232
An EIA standard that specifies electrical, mechanical, and functional characteristics
for serial binary communication circuits.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
Gl ossary 497
run mode
An executing mode during which the controller scans or executes the
logicprogram.
rung
A rung contains input and output instructions. During Run mode, the inputs on
arung are evaluated to be true or false. If a path of true logic exists, the outputs
aremade true (energized). If all paths are false, the outputs are made
false(de-energized).
RTU
Remote Terminal Unit
save
To save a program to a computer hard disk.
scan
The scan is made up of four elements: input scan, program scan, output scan,
andhousekeeping.
scan time
The time required for the controller to complete one scan.
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
The condition of a circuit or system.
terminal
A point on an I/O module that external devices, such as a push button or pilot
light, are wired to.
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
498 Gl ossary
throughput
The time between when an input turns on and a corresponding output turns on
oroff. Throughput consists of input delays, program scan, output delays,
andoverhead.
true
The status of an instruction that provides a continuous logical path on a
ladder rung.
upload
Data is transferred from the controller to a programming or storage device.
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.
Publ i cat i on 1762-RM001G-EN-P - Sept ember 2011
Index
A
ABL i nst ruct i on 20-291
ABS i nst ruct i on 10-176
absol ut e val ue i nst ruct i on 10-176
ACB i nst ruct i on 20-293
accuracy, t i mer 8-154
ACI i nst ruct i on 20-294
ACL i nst ruct i on 20-284
ACN i nst ruct i on 20-295
act i ve nodes st at us C-403
ADD i nst ruct i on 10-174
address 1-489
Addressi ng
consi derat i ons E-431
addressi ng
di rect addressi ng 4-83
I/ O 1-24
i mmedi at e addressi ng 4-83
i ndi rect addressi ng 4-83
i ndi rect addressi ng of a bi t 4-85
i ndi rect addressi ng of a f i l e 4-84
i ndi rect addressi ng of a word 4-84
modes 4-82
usi ng i n-l i ne i ndi rect i on 20-305
AEX i nst ruct i on 20-296
AHL i nst ruct i on 20-298
AIC i nst ruct i on 20-286
AIC+ Advanced Int erf ace Convert er 1-489
Al l en-Bradl ey
cont act i ng f or assi st ance D-421
al l ow f ut ure access set t i ng 2-53
AND i nst ruct i on 12-192
appl i cat i on 1-489
ARD i nst ruct i on 20-299
ari t hmet i c f l ags C-390
ARL i nst ruct i on 20-301
ASC i nst ruct i on 20-302
ASCII
def i ni t i on 1-489
ASCII charact er set 20-307
ASCII cl ear buf f ers i nst ruct i on 20-284
ASCII cont rol dat a f i l e 20-283
ASCII f i l e 20-282
ASCII handshake l i nes i nst ruct i on 20-298
ASCII i nst ruct i on error codes 20-306
ASCII i nst ruct i ons 20-279
error codes 20-306
st at us bi t s 20-282, 20-283
t i mi ng di agram 20-305
ASCII i nt eger t o st ri ng i nst ruct i on 20-286
ASCII number of charact ers i n buf f er i nst ruct i on 20-293
ASCII prot ocol paramet ers 20-281
ASCII read charact ers i nst ruct i on 20-299
ASCII read l i ne i nst ruct i on 20-301
ASCII st ri ng compare i nst ruct i on 20-304
ASCII st ri ng concat enat e 20-295
ASCII st ri ng ext ract 20-296
asci i st ri ng mani pul at i on error C-401
ASCII st ri ng search i nst ruct i on 20-302
ASCII st ri ng t o i nt eger i nst ruct i on 20-294
ASCII t est buf f er f or l i ne i nst ruct i on 20-291
ASCII t i mi ng di agram 20-305
ASCII wri t e i nst ruct i on 20-289
ASCII w ri t e wi t h append i nst ruct i on 20-287
ASR i nst ruct i on 20-304
AWA and AWT t i mi ng di agram 20-305
AWA i nst ruct i on 20-287
AWT i nst ruct i on 20-289
B
base hardware i nf ormat i on f i l e 3-66
bat t ery
l i f e expect ancy 3-58
operat i on 3-58
bat t ery l ow st at us bi t C-401
baud rat e 1-489
baud rat e st at us C-404
BHI Funct i on Fi l e 3-66
bi t 1-489
bi t i nst ruct i ons 7-147
bi t shi f t l ef t i nst ruct i on 14-203
bi t shi f t ri ght i nst ruct i on 14-204
bi t -wi se AND i nst ruct i on 12-192
bl ock di agrams 1-489
Bool ean operat ors 1-489
branch 1-490
BSL i nst ruct i on 14-203
BSR i nst ruct i on 14-204
C
carry f l ag C-390
cat al og number st at us C-410
channel 0
communi cat i ons st at us C-405
CS0 communi cat i ons st at us f i l e 3-66
channel conf i gurat i on
DF1 f ul l -dupl ex paramet ers E-426
DF1 hal f -dupl ex paramet ers E-433, E-438
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
500 Index
DF1 radi o modem paramet ers E-441, E-442
DH485 paramet ers E-424
M odbus RTU M ast er paramet ers E-449
M odbus RTU Sl ave paramet ers E-450, E-451
cl ear i nst ruct i on 10-176
cl eari ng
cont rol l er f aul t s D-413
cont rol l er memory 2-53
cl ock, f ree runni ng C-398
CLR i nst ruct i on 10-176
common t echni ques used i n t hi s manual 1-13
communi cat i on i nst ruct i ons 21-309
communi cat i on prot ocol s
DF1 f ul l -dupl ex E-426
DF1 hal f -dupl ex E-427
DH485 E-423
M odbus Sl ave RTU E-447
communi cat i on scan 1-490
communi cat i ons
act i ve st at us bi t C-406
channel 0 st at us C-405
mode sel ect i on st at us bi t C-406
st at us f i l e 3-66
compare i nst ruct i ons 9-163
compi l er revi si on
bui l d number st at us C-411
rel ease st at us C-411
cont act i ng Rockwel l Aut omat i on f or assi st ance D-421
cont rol prof i l e 1-490
cont rol program 1-490
cont rol regi st er error st at us bi t C-399
cont rol l er
def i ni t i on 1-490
f aul t messages D-414
mode C-394
mode st at us C-391
overhead A-380, B-386, 1-490
st at us f i l e C-389
cont rol l er propert i es 2-47
conversi on i nst ruct i ons 11-181
convert f rom bi nary coded deci mal (BCD) i nst ruct i on 11-184
convert t o bi nary coded deci mal (BCD) i nst ruct i on 11-187
COP i nst ruct i on 14-200
copy f i l e i nst ruct i on 14-200
copy word i nst ruct i on 14-199
count down i nst ruct i on 8-159
count up i nst ruct i on 8-159
count ers
count er f i l e 8-158
count er f i l e and st at us bi t s 8-159
def i ni t i on 1-490
how count ers work 8-157
CPU (cent ral processi ng uni t ), def i ni t i on 1-490
CPW i nst ruct i on 14-199
CS f unct i on f i l e 3-66
CTD i nst ruct i on 8-159
CTU i nst ruct i on 8-159
D
DAT
conf i gurat i on 3-63
f unct i on f i l e 3-63
dat a f i l e downl oad prot ect i on 2-49
dat a f i l e overwri t e prot ect i on l ost st at us bi t C-407
dat a f i l es 2-43, 2-46, 2-48
bi t (B) 2-48
cont rol (R) 2-48
count er (C) 8-158
f l oat i ng poi nt (F) 2-48, 10-171
I/ O i mages f or expansi on modul es (M i croLogi x 1200) 1-17
I/ O i mages f or expansi on modul es (M i croLogi x 1500) 1-26
i nput (I) 2-48
i nput and out put addressi ng exampl es 1-37
i nt eger (N) 2-48
l ong word (L) 2-48
message (M G) f i l e 21-314
organi zat i on and addressi ng 20-282
out put (O) 2-48
PID (PD) 19-254
programmabl e l i mi t swi t ch (PLS) 5-112
prot ect i ng dat a f i l es 2-49
st at us (S) f i l e C-389
st ri ng (ST) f i l e 20-282
t i mer (T) 8-153
dat a l oggi ng 22-364, 22-370
Qui ck St art exampl e F-481
dat a t abl e 1-490
DCD i nst ruct i on 11-182
decode 4 t o 1-of -16 i nst ruct i on 11-182
Def aul t s
Out put Array 1-33
Devi ceNet net work conf i gurat i on 21-338
DF1 f ul l -dupl ex prot ocol E-426
conf i gurat i on paramet ers E-426
descri pt i on E-426
DF1 hal f -dupl ex prot ocol E-427
conf i gurat i on paramet ers E-433, E-438, E-441, E-442
descri pt i on E-427
Publ i cat i on 1762-RM001G-EN-P - Sept ember 2011
Index 501
DF1 prot ocol
hal f -dupl ex E-427
DH485 communi cat i on prot ocol E-423
conf i gurat i on paramet ers E-424, E-425
descri pt i on E-423
prot ocol E-424
t oken rot at i on E-424
DIN rai l 1-490
DIV i nst ruct i on 10-175
di vi de i nst ruct i on 10-175
DLG
Qui ck St art exampl e F-481
DLG Inst ruct i on 22-370
downl oad 1-490
DTE, def i ni t i on 1-491
E
EII f unct i on f i l e 18-247
embedded I/ O 1-15
EM I 1-491
ENC i nst ruct i on 11-182
encode 1-of -16 t o 4 i nst ruct i on 11-182
encoder
def i ni t i on 1-491
quadrat ure 5-104
END i nst ruct i on 16-226
EQU i nst ruct i on 9-164
equal i nst ruct i on 9-164
error codes D-413, D-414
ASCII i nst ruct i on error codes 20-306
EII error codes 18-248
f aul t messages and error codes D-413
HSC error codes 5-91
maj or error code st at us C-402
mat h overf l ow t rap bi t 10-171
mat h st at us bi t s 10-170
M SG i nst ruct i on error codes 21-351
PID runt i me errors 19-268
PTO error codes 6-136
PWM error codes 6-144
STI error code 18-244
t roubl eshoot i ng gui de D-414
errors, i dent i f yi ng D-413
event i nput i nt errupt (EII) f unct i on f i l e 18-247
exami ne i f cl osed i nst ruct i on 7-147
exami ne i f open i nst ruct i on 7-147
exampl e
act i ve st at i on f i l e 3-79, E-437
DLG Qui ck St art F-481
HSC Qui ck St art F-463
M SG Qui ck St art F-468
PTO Qui ck St art F-459
PWM Qui ck St art F-462
RTC Qui ck St art F-473
RTC Synchroni zat i on Qui ck St art F-478
STI Qui ck St art F-471
t ri m pot s Qui ck St art F-475
user i nt errupt di sabl e (UID) Qui ck St art F-477
excl usi ve OR i nst ruct i on 12-193
execut i ng mode 1-491
execut i on t i me
M i croLogi x 1200 i nst ruct i ons A-375
M i croLogi x 1500 i nst ruct i ons B-381
expansi on I/ O 1-16, 1-24
anal og I/ O conf i gurat i on 1-19, 1-29
di scret e I/ O conf i gurat i on 1-17, 1-26
F
f al se 1-491
f aul t messages D-413, D-414
f aul t overri de at power-up bi t C-392
f aul t recovery procedure D-414
f aul t rout i ne
descri pt i on of operat i on 18-236
f i l e number st at us C-405
manual l y cl eari ng f aul t s D-414
operat i on i n rel at i on t o mai n cont rol program 18-233
pri ori t y of i nt errupt s 18-235
f aul t s
aut omat i cal l y cl eari ng D-413
i dent i f yi ng D-413
manual l y cl eari ng usi ng t he f aul t rout i ne D-414
recoverabl e and non-recoverabl e 18-236
FET 1-491
FFL i nst ruct i on 14-206
FFU i nst ruct i on 14-208
FIFO (Fi rst -In-Fi rst -Out ) 1-491
FIFO l oad i nst ruct i on 14-206
FIFO unl oad i nst ruct i on 14-208
f i l e 1-491
f i l e i nst ruct i ons 14-199
f i l l f i l e i nst ruct i on 14-201
f i l t eri ng, i nput s 1-38
f i rst scan st at us bi t C-395
FLL i nst ruct i on 14-201
f orces enabl ed st at us bi t C-392
f orces i nst al l ed st at us bi t C-392
f orci ng, i nput s and out put s 1-38
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
502 Index
FRD
exampl e 11-186
i nst ruct i on 11-184
f ree runni ng cl ock C-398
f ree runni ng cl ock st at us C-398
f ul l -dupl ex 1-491
f unct i on f i l es 3-55
base hardware i nf ormat i on (BHI) 3-66
communi cat i ons st at us (CS) f i l e 3-66
DAT f unct i on f i l e 3-63
event i nput i nt errupt (EII) 18-247
hi gh-speed count er (HSC) 5-87
i nput / out put st at us f i l e (IOS) 3-79
memory modul e i nf ormat i on (M M I) 3-60
pul se t rai n out put (PTO) 6-123
pul se wi dt h modul at i on (PWM ) 6-138
real -t i me cl ock (RTC) 3-56
sel ect abl e t i med i nt errupt (STI) 18-242
t ri m pot i nf ormat i on (TPI) 3-59
f ut ure access st at us bi t C-395
G
GCD i nst ruct i on 11-189
GEQ i nst ruct i on 9-165
Gray code i nst ruct i on 11-189
great er t han i nst ruct i on 9-165
great er t han or equal t o i nst ruct i on 9-165
GRT i nst ruct i on 9-165
H
hal f -dupl ex E-431, 1-492
hard di sk 1-492
hi gh byt e 1-492
hi gh-speed count er
Qui ck St art exampl e F-463
hi gh-speed count er f unct i on f i l e 5-87
hi gh-speed count er l oad i nst ruct i on 5-110
hi gh-speed out put s 6-119
housekeepi ng 1-492
HSC
Qui ck St art exampl e F-463
HSC f unct i on f i l e 5-87
HSL i nst ruct i on 5-110
I
I/ O 1-492
I/ O addressi ng 1-24
I/ O conf i gurat i on 1-15
I/ O f orci ng 1-38
I/ O ref resh i nst ruct i on 17-231
i dent i f yi ng cont rol l er f aul t s D-413
IIM i nst ruct i on 17-229
i mmedi at e i nput wi t h mask i nst ruct i on 17-229
i mmedi at e out put wi t h mask i nst ruct i on 17-230
i n-l i ne i ndi rect i on 20-305
i nput and out put i nst ruct i ons 17-229
i nput devi ce 1-492
i nput f i l t er sel ect i on modi f i ed st at us bi t C-401
i nput f i l t eri ng 1-38
i nput scan 1-492
i nput / out put st at us f i l e 3-79
i nrush current 1-492
i nst ruct i on 1-492
i nst ruct i on execut i on t i me B-381
i nst ruct i on set
def i ni t i on 1-492
M i croLogi x 1200 execut i on t i mes A-375
M i croLogi x 1500 execut i on t i mes B-381
overvi ew 4-81
INT i nst ruct i on 18-237
i nt errupt subrout i ne i nst ruct i on 18-237
i nt errupt s
i nt errupt i nst ruct i ons 18-237
i nt errupt subrout i ne (INT) i nst ruct i on 18-238
l at ency 18-236
overvi ew 18-233
sel ect abl e t i med st art (STS) i nst ruct i on 18-238
user f aul t rout i ne 18-236
user i nt errupt di sabl e (UID) i nst ruct i on 18-239
user i nt errupt enabl e (UIE) i nst ruct i on 18-240
user i nt errupt f l ush (UIF) i nst ruct i on 18-241
IOM i nst ruct i on 17-230
IOS f unct i on f i l e 3-79
J
JM P i nst ruct i on 16-223
JSR i nst ruct i on 16-224
j ump 1-493
j ump t o l abel i nst ruct i on 16-223
j ump t o subrout i ne i nst ruct i on 16-224
L
l abel i nst ruct i on 16-224
l adder l ogi c 1-493
l ast 100 Sec scan t i me st at us C-407
l at chi ng i nput s 1-39
Publ i cat i on 1762-RM001G-EN-P - Sept ember 2011
Index 503
LBL i nst ruct i on 16-224
l east si gni f i cant bi t (LSB) 1-493
LED (l i ght emi t t i ng di ode) 1-493
LEQ i nst ruct i on 9-165
LES i nst ruct i on 9-165
l ess t han i nst ruct i on 9-165
l ess t han or equal t o i nst ruct i on 9-165
LFL i nst ruct i on 14-210
LFU i nst ruct i on 14-212
LIFO (Last -In-Fi rst -Out ) 1-493
LIFO l oad i nst ruct i on 14-210
LIFO unl oad i nst ruct i on 14-212
LIM i nst ruct i on 9-167
l i mi t i nst ruct i on 9-167
l oad memory modul e al ways bi t C-393
l oad memory modul e on error or def aul t program bi t C-393
l ocal messages 21-324
l ogi c 1-493
l ogi cal i nst ruct i ons 12-191
l ogi cal NOT i nst ruct i on 12-194
l ogi cal OR i nst ruct i on 12-193
l ow byt e 1-493
M
maj or error code st at us C-402
maj or error det ect ed i n user f aul t rout i ne st at us bi t C-400
maj or error hal t ed st at us bi t C-395
manual s, rel at ed 1-14
mask compare f or equal i nst ruct i on 9-166
masked move i nst ruct i on 13-197
mast er cont rol rel ay (M CR) 1-493
mast er cont rol reset i nst ruct i on 16-226
mat h i nst ruct i ons 10-169
mat h overf l ow sel ect i on bi t C-397
mat h regi st er st at us C-403
maxi mum scan t i me st at us C-404
M CR i nst ruct i on 16-226
memory 2-43
cl eari ng cont rol l er memory 2-53
memory mappi ng
M i croLogi x 1200 I/ O 1-17
M i croLogi x 1500 Compact I/ O 1-26
memory modul e boot st at us bi t C-400
memory modul e compare bi t C-396
memory modul e i nf ormat i on f unct i on f i l e 3-60
f aul t overri de 3-62
f unct i onal i t y t ype 3-61
l oad al ways 3-62
l oad on error 3-62
mode behavi or 3-62
modul e present 3-61
program compare 3-62
wri t e prot ect 3-61
memory modul e password mi smat ch st at us bi t C-400
memory usage
checki ng cont rol l er memory usage 2-47
M i croLogi x 1200 i nst ruct i ons A-375
M i croLogi x 1500 i nst ruct i ons B-381
M EQ 9-166
M EQ i nst ruct i on 9-166
message
Qui ck St art exampl e F-468
message (M G) f i l e 21-314
message errors 21-351
message i nst ruct i on 21-313
message repl y pendi ng st at us bi t C-406
messages
l ocal 21-324
l ocal messagi ng exampl es 21-333
remot e 21-346
messagi ng
l ocal Devi ceNet message 21-338
remot e st at i on-t o-remot e st at i on E-431
messagi ng overvi ew 21-309
mi nor error bi t s C-399
M M I f unct i on f i l e 3-60
mnemoni c 1-493
M odbus def i ni t i on 1-493
M odbus RTU prot ocol E-447
M odbus t o M i croLogi x memory map E-452, E-453, E-454, E-455
mode behavi or C-394
mode st at us C-391
modem 1-493
modes 1-494
moni t ori ng cont rol l er operat i on, f aul t recovery procedure
D-414
M OV i nst ruct i on 13-195
move i nst ruct i ons 13-195
M SG
Qui ck St art exampl e F-468
M SG i nst ruct i on 21-313
error codes 21-351
l adder l ogi c 21-323
l ocal messai ng exampl es 21-333
t i mi ng di agram 21-320
M UL i nst ruct i on 10-175
mul t i pl y i nst ruct i on 10-175
M VM i nst ruct i on 13-197
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
504 Index
N
NEG i nst ruct i on 10-175
negat e i nst ruct i on 10-175
negat i ve l ogi c 1-494
NEQ i nst ruct i on 9-164
net work 1-494
node address st at us C-404
nomi nal i nput current 1-494
normal l y cl osed 1-494
normal l y open 1-494
not equal i nst ruct i on 9-164
NOT i nst ruct i on 12-194
O
OEM l ock 2-53
OEM l ock st at us bi t C-395
of f l i ne 1-494
of f set 1-494
of f -st at e l eakage current 1-494
one shot 1-495
one shot f al l i ng i nst ruct i on 7-151
one shot i nst ruct i on 7-150
one shot ri si ng i nst ruct i on 7-151
onl i ne 1-495
ONS i nst ruct i on 7-150
operat i ng syst em
cat al og number st at us C-410
FRN st at us C-410
seri es l et t er st at us C-410
operat i ng vol t age 1-495
OR i nst ruct i on 12-193
OSF i nst ruct i on 7-151
OSR i nst ruct i on 7-151
OTE i nst ruct i on 7-148
OTL i nst ruct i on 7-149
OTU i nst ruct i on 7-149
out goi ng message command pendi ng st at us bi t C-406
out put devi ce 1-495
out put i nst ruct i on 7-148
out put l at ch i nst ruct i on 7-149
out put scan 1-495
out put unl at ch i nst ruct i on 7-149
overf l ow f l ag C-390
overf l ow t rap st at us bi t C-399
P
password prot ect i on 2-52
PCCC 1-495
PD dat a f i l e 19-254
PID
anal og I/ O scal i ng 19-269
appl i cat i on exampl es 19-274
appl i cat i on not es 19-270
errors 19-268
PID concept 19-253
PID equat i on 19-254
PID i nst ruct i on 19-255
t uni ng paramet ers 19-260
PLS f i l e 5-112
Pol l ed report -by-except i on, def i ned E-431
power save t i meout 3-63
power-up mode behavi or bi t C-393
process cont rol i nst ruct i on 19-253
processor 1-495
processor bat t ery l ow st at us bi t C-401
processor cat al og number st at us C-410
processor f i l es 1-495
processor revi si on st at us C-411
processor seri es st at us C-410
program cont rol i nst ruct i ons 16-223
program end i nst ruct i on 16-226
program f i l e
def i ni t i on 1-495
program f i l es 2-46
program mode 1-496
program scan
def i ni t i on 1-496
M i croLogi x 1200 scan t i me worksheet A-380
M i croLogi x 1500 scan t i me worksheet B-386
programmabl e l i mi t swi t ch 5-87, 5-112
programmabl e l i mi t swi t ch f i l e 5-112
programmi ng devi ce 1-496
programmi ng i nst ruct i ons 4-81
proport i onal i nt egral deri vat i ve
appl i cat i on not es 19-270
PID i nst ruct i on 19-255
PID t uni ng 19-274
runt i me errors 19-268
t he PID concept 19-253
t he PID equat i on 19-254
prot ocol 1-496
DF1 f ul l -dupl ex E-426
DF1 hal f -dupl ex E-427
DF1 radi o modem E-439
DH485 communi cat i on E-423
M odbus RTU E-447
prot ocol conf i gurat i on E-423, F-459
Publ i cat i on 1762-RM001G-EN-P - Sept ember 2011
Index 505
PTO
f unct i on f i l e 6-123
i nst ruct i on 6-119
Qui ck St art exampl e F-459
publ i cat i ons, rel at ed 1-14
pul se t rai n out put
f unct i on f i l e 6-123
i nst ruct i on 6-119
Qui ck St art exampl e F-459
pul se wi dt h modul at i on
f unct i on f i l e 6-138
i nst ruct i on 6-137
Qui ck St art exampl e F-462
Purpose of t hi s M anual 1-13
PWM
f unct i on f i l e 6-138
i nst ruct i on 6-137
Qui ck St art exampl e F-462
Q
quadrat ure encoder 5-104
queue 22-359
R
RAC i nst ruct i on 5-111
RCP i nst ruct i on 22-359
read 1-496
real t i me cl ock
accuracy 3-57
bat t ery l ow i ndi cat or bi t 3-58
di sabl i ng 3-57
f unct i on f i l e 3-56
real -t i me cl ock
Qui ck St art exampl e F-473
real -t i me cl ock adj ust i nst ruct i on 3-58
reci pe 22-359
reci pe i nst ruct i on 22-359
REF i nst ruct i on 17-231
ref resh i nst ruct i on 17-231
rel at ed publ i cat i ons 1-14
rel ay 1-496
rel ay l ogi c 1-496
rel ay-t ype i nst ruct i ons 7-147
remot e messages 21-346
remot e packet support E-426
RES i nst ruct i on 8-160
reserved bi t 1-496
reset accumul at ed val ue i nst ruct i on 5-111
reset i nst ruct i on 8-160
rest ore 1-496
RET i nst ruct i on 16-225
ret ent i ve dat a 1-496
ret ent i ve dat a l ost st at us bi t C-401
ret ent i ve t i mer on-del ay i nst ruct i on 8-156
ret urn f rom subrout i ne i nst ruct i on 16-225
RS-232, def i ni t i on 1-496
RTA i nst ruct i on 3-58
RTC
day of mont h st at us C-408
day of week st at us C-409
f unct i on f i l e 3-56
hours st at us C-408
mi nut es st at us C-409
mont h st at us C-408
Qui ck St art exampl e F-473
seconds st at us C-409
year st at us C-407
RTC Synchroni zat i on
Qui ck St art exampl e F-478
RTC synchroni zat i on
Qui ck St art exampl e F-478
RTO i nst ruct i on 8-156
RTU, def i ni t i on 1-497
run mode 1-497
rung 1-497
S
save 1-497
SBR i nst ruct i on 16-224
scal e i nst ruct i on 10-177
scal e wi t h paramet ers i nst ruct i on 10-178
scan 1-497
scan t i me 1-497
l ast 100 Sec scan t i me st at us C-407
maxi mum scan t i me st at us C-404
scan t i me worksheet
M i croLogi x 1200 A-380
M i croLogi x 1500 B-386
scan t oggl e st at us bi t C-407
SCL i nst ruct i on 10-177
SCP i nst ruct i on 10-178
sel ect abl e t i med i nt errupt
Qui ck St art exampl e F-471
sel ect abl e t i med i nt errupt (STI) f unct i on f i l e 18-242
sel ect abl e t i med st art i nst ruct i on 18-238
sequencer compare i nst ruct i on 15-215
sequencer i nst ruct i ons 15-215
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
506 Index
sequencer l oad i nst ruct i on 15-221
sequencer out put i nst ruct i on 15-218
servi ce communi cat i ons i nst ruct i on 21-310
si gn f l ag C-391
si nki ng 1-497
SLC 5/ 03,5/ 04, and 5/ 05
Act i ve st at i ons, moni t ori ng E-437
Channel St at us E-436
sourci ng 1-497
SQC i nst ruct i on 15-215
SQL i nst ruct i on 15-221
SQO i nst ruct i on 15-218
SQR i nst ruct i on 10-180
square root i nst ruct i on 10-180
st art up prot ect i on f aul t bi t C-392
st at i c f i l e prot ect i on 2-51
St at i on addresses
def i ni ng E-431
St at i on l i st
vi ewi ng E-437
st at us 1-497
st at us f i l e C-389
STI
enabl ed bi t C-396
execut i ng bi t C-396
f i l e number st at us C-405
f unct i on f i l e 18-242
l ost st at us bi t C-400
mode st at us C-396
pendi ng st at us bi t C-396
Qui ck St art exampl e F-471
set poi nt st at us C-405
st ri ng dat a f i l e 20-282
STS i nst ruct i on 18-238
SUB i nst ruct i on 10-174
subrout i ne l abel i nst ruct i on 16-224
subt ract i nst ruct i on 10-174
SUS i nst ruct i on 16-225
suspend code st at us C-402
suspend f i l e st at us C-402
suspend i nst ruct i on 16-225
SVC i nst ruct i on 21-310
swap i nst ruct i on 14-214
SWP i nst ruct i on 14-214
T
t arget bi t f i l e 3-63, 3-65
t arget i nt eger f i l e 3-63
t emporary end i nst ruct i on 16-225
t ermi nal 1-497
t hroughput 1-498
t i mer accuracy 8-154
t i mer and count er i nst ruct i ons 8-153
t i mer f i l es 8-153
t i mer of f -del ay i nst ruct i on 8-156
t i mer on-del ay i nst ruct i on 8-155
t i mi ng di agrams
ASCII 20-305
AWA and AWT i nst ruct i ons 20-305
l at chi ng i nput s 1-39
M SG i nst ruct i on 21-320
PTO rel at i ve t i mi ng 6-121
quadrat ure encoder 5-104
TND i nst ruct i on 16-225
TOD i nst ruct i on 11-187
changes t o t he mat h regi st er 11-188
exampl e 11-188
TOF i nst ruct i on 8-156
TON i nst ruct i on 8-155
TPI
Qui ck St art exampl e F-475
TPI f unct i on f i l e 3-59
t ri m pot s 3-60
error condi t i ons 3-60
f unct i on f i l e 3-59
Qui ck St art exampl e F-475
t roubl eshoot i ng D-414, D-421
aut omat i cal l y cl eari ng f aul t s D-413
cont act i ng Al l en-Bradl ey f or assi st ance D-421
i dent i f yi ng cont rol l er f aul t s D-413
manual l y cl eari ng f aul t s D-414
usi ng t he f aul t rout i ne D-414
t rue 1-498
U
UID
Qui ck St art exampl e F-477
UID i nst ruct i on 18-239
UIE i nst ruct i on 18-240
UIF i nst ruct i on 18-241
upl oad 1-498
user appl i cat i on mode st at us C-391
user f aul t rout i ne
creat i ng a user f aul t rout i ne 18-237
f i l e number st at us C-405
maj or error det ect ed st at us bi t C-400
recoverabl e and non-recoverabl e f aul t s 18-236
user i nt errupt di sabl e i nst ruct i on 18-239
Publ i cat i on 1762-RM001G-EN-P - Sept ember 2011
Index 507
user i nt errupt enabl e i nst ruct i on 18-240
user i nt errupt f l ush i nst ruct i on 18-241
user memory 2-44
user program f unct i onal i t y t ype st at us C-411
W
w at chdog scan t i me C-397
wri t e 1-498
X
XIC i nst ruct i on 7-147
XIO i nst ruct i on 7-147
XOR i nst ruct i on 12-193
Z
zero f l ag C-390
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
508 Index
Notes:
509 Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
MicroLogix 1200 and 1500 List of Instructions and Function Files
Instruction- Description Page Instruction- Description Page
ABL - Test Buf f er f or Li ne 291 NEG - Negat e 175
ABS - Absol ut e Val ue 176 NEQ - Not Equal 164
ACB - Number of Charact ers i n Buf f er 293 NOT - Logi cal NOT 194
ACI - St ri ng t o Int eger 294 ONS - One Shot 150
ACL - ASCII Cl ear Buf f ers 284 OR - Logi cal OR 193
ACN - St ri ng Concat enat e 295 OSF - One Shot Fal l i ng 151
ADD - Add 174 OSR - One Shot Ri si ng 151
AEX - St ri ng Ext ract 296 OTE - Out put Energi ze 148
AHL - ASCII Handshake Li nes 298 OTL - Out put Lat ch 149
AIC - ASCII Int eger t o St ri ng 286 OTU - Out put Unl at ch 149
AND - Bi t -Wi se AND 192 PID - Proport i onal Int egral Deri vat i ve 255
ARD - ASCII Read Charact ers 299 PTO - Pul se Trai n Out put 119
ARL - ASCII Read Li ne 301 PWM - Pul se Wi dt h M odul at i on 137
ASC - St ri ng Search 302 RAC - Reset Accumul at ed Val ue 111
ASR - ASCII St ri ng Compare 304 RCP - Reci pe (M i croLogi x 1500 onl y) 359
AWA - ASCII Wri t e wi t h Append 287 REF - I/ O Ref resh 231
AWT - ASCII Wri t e 289 RES - Reset 160
BSL - Bi t Shi f t Lef t 203 RET - Ret urn f rom Subrout i ne 225
BSR - Bi t Shi f t Ri ght 204 RTA - Real Ti me Cl ock Adj ust Inst ruct i on 58
CLR - Cl ear 176 RTO - Ret ent i ve Ti mer, On-Del ay 156
COP - Copy Fi l e 200 SBR - Subrout i ne Label 224
CPW - Copy Word 199 SCL - Scal e 177
CTD - Count Down 159 SCP - Scal e wi t h Paramet ers 178
CTU - Count Up 159 SQC- Sequencer Compare 215
DCD - Decode 4 t o 1-of -16 182 SQL - Sequencer Load 221
DIV - Di vi de 175 SQO- Sequencer Out put 218
DLG - Dat a Log Inst ruct i on 370 SQR - Square Root 180
ENC - Encode 1-of -16 t o 4 182 STS - Sel ect abl e Ti med St art 238
END - Program End 226 SUB - Subt ract 174
EQU - Equal 164 SUS - Suspend 225
FFL - Fi rst In, Fi rst Out (FIFO) Load 206 SWP - Swap 214
FFU - Fi rst In, Fi rst Out (FIFO) Unl oad 208 TND - Temporary End 225
FLL - Fi l l Fi l e 201 TOD - Convert t o Bi nary Coded Deci mal (BCD) 187
FRD - Convert f rom Bi nary Coded Deci mal (BCD) 184 TOF - Ti mer, Of f -Del ay 156
GCD - Gray Code 189 TON - Ti mer, On-Del ay 155
GEQ - Great er Than or Equal To 165 UID - User Int errupt Di sabl e 239
GRT - Great er Than 165 UIE - User Int errupt Enabl e 240
HSL - Hi gh-Speed Count er Load 110 UIF - User Int errupt Fl ush 241
IIM - Immedi at e Input wi t h M ask 229 XIC - Exami ne i f Cl osed 147
INT - Int errupt Subrout i ne 238 XIO - Exami ne i f Open 147
IOM - Immedi at e Out put w i t h M ask 230 XOR - Excl usi ve OR 193
JM P - Jump t o Label 223 Function File- Description Page
JSR - Jump t o Subrout i ne 224 BHI - Base Hardware Inf ormat i on 66
LBL - Label 224 CS - Communi cat i ons St at us 66
LEQ - Less Than or Equal To 165 DAT - Dat a Access Tool Inf ormat i on 63
LES - Less Than 165 EII - Event Input Int errupt 247
LFL - Last In, Fi rst Out (LIFO) Load 210 HSC - Hi gh Speed Count er 87
LFU - Last In, Fi rst Out (LIFO) Unl oad 212 IOS - I/ O St at us 79
Publ i cat i on 1762-RM 001G-EN-P - Sept ember 2011
510 M i croLogi x 1200 and 1500 Li st of Inst ruct i ons and Funct i on Fi l es
LIM - Li mi t Test 167 M M I - M emory M odul e Inf ormat i on 60
M CR - M ast er Cont rol Reset 226 PTO - Pul se Trai n Out put 123
M EQ - M ask Compare f or Equal 166 PWM - Pul se Wi dt h M odul at i on 138
M OV - M ove 195 RTC - Real Ti me Cl ock 56
M SG - M essage 313 STI - Sel ect abl e Ti med Int errupt 242
M UL - M ul t i pl y 175 TPI - Tri m Pot Inf ormat i on 59
M VM - M asked M ove 197
Instruction- Description Page Instruction- Description Page
Rockwell Otomasyon Ticaret A.., Kar Plaza Merkezi E Blok Kat:6 34752 erenky, stanbul, Tel: +90 (216) 5698400
Publ i cat i on 1762-RM001G-EN-P - Sept ember 2011 512
Supersedes Publ i cat i on 1762-RM 001F-EN-P - Oct ober 2009 Copyri ght 2011 Rockwel l Aut omat i on, Inc. Al l ri ght s reserved. Pri nt ed i n t he U.S.A.
Rockwell Automation Support
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.
New Product Satisfaction Return
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.
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/.
Uni t ed St at es or Canada 1.440.646.3434
Out si de Uni t ed St at es or
Canada
Use t he Worl dwi de Locat or at ht t p:/ / www.rockwel l aut omat i on.com/ support / ameri cas/ phone_en.ht ml , or cont act
your l ocal Rockwel l Aut omat i on represent at i ve.
Uni t ed St at es Cont act your di st ri but or. You must provi de a Cust omer Support case number (cal l t he phone number above t o obt ai n
one) t o your di st ri but or t o compl et e t he ret urn process.
Out si de Uni t ed St at es Pl ease cont act your l ocal Rockwel l Aut omat i on represent at i ve f or t he ret urn procedure.