Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 31 of 55

Hand-Held Terminal (Catalog Number 1747-PT1) User Manual: 19 - Comparison Instructions

Pages 267 to 276 of 486, from Hand-Held Terminal (Catalog Number 1747-PT1) User Manual

The original document is the PDF (1.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1747-PT1

Page 267

Chapter

A–B

19

Comparison Instructions This chapter covers input instructions that allow you to compare values of data. Instructions for use with fixed, SLC 5/01, and SLC 5/02 processors: • Equal (EQU) • Not Equal (NEQ) • Less Than (LES) • Less Than or Equal (LEQ) • Greater Than (GRT) • Greater Than or Equal (GEQ) • Masked Comparison for Equal (MEQ) Instruction for use with SLC 5/02 processors only • Limit (LIM)

Comparison Instructions Overview

The following general information applies to comparison instructions.

Indexed Word Addresses With SLC 5/02 processors, you have the option of using indexed word addresses for instruction parameters specifying word addresses. Indexed addressing is discussed in chapter 4.

19–1

Page 268

Chapter 19 Comparison Instructions

Equal (EQU)

Equal

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

EQU

Input Instruction

EQU

ZOOM on EQU –|EQU|– NAME: EQUAL SOURCE A: N7:1 SOURCE B: 612

2.3.0.0.1 0 612

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: EQU EQUAL Source A Source B

N7:1 0 612

When the values at source A and source B are equal, the instruction is logically true. If these values are not equal, the instruction is logically false.

Entering Parameters You must enter a word address for source A. You can enter a program constant or a word address for source B. Signed integers are stored in two’s complementary form.

19–2

Page 269

Chapter 19 Comparison Instructions

Not Equal (NEQ)

Not Equal

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

NEQ

Input Instruction

NEQ

ZOOM on NEQ –|NEQ|– NAME: NOT EQUAL SOURCE A: N7:1 SOURCE B: 612

2.3.0.0.1 0 612

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: NEQ NOT EQUAL Source A Source B

N7:1 0 612

When the values at source A and source B are not equal, the instruction is logically true. If the two values are equal, this instruction is logically false.

Entering Parameters You must enter a word address for source A. You can enter a program constant or a word address for source B. Signed integers are stored in two’s complementary form.

19–3

Page 270

Chapter 19 Comparison Instructions

Less Than (LES)

Less Than

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

LES

Input Instruction

LES

ZOOM on LES –|LES|– NAME: LESS THAN SOURCE A: N7:1 SOURCE B: 612

2.3.0.0.1 0 612

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: LES LESS THAN Source A Source B

N7:1 0 612

When the value at source A is less than the value at source B, this instruction is logically true. If the value at source A is greater than or equal to the value at source B, this instruction is logically false.

Entering Parameters You must enter a word address for source A. You can enter a program constant or a word address for source B. Signed integers are stored in two’s complementary form.

19–4

Page 271

Chapter 19 Comparison Instructions

Less Than or Equal (LEQ)

Less Than or Equal

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

LEQ

Input Instruction

LEQ

ZOOM on LEQ –|LEQ|– NAME: LESS THAN OR EQUAL SOURCE A: N7:1 0 SOURCE B: 612 612

2.3.0.0.1

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: LEQ LESS THAN OR EQUAL Source A N7:1 0 Source B 612

When the value at source A is less than or equal to the value at source B, this instruction is logically true. If the value at source A is greater than the value at source B, this instruction is logically false.

Entering Parameters You must enter a word address for source A. You can enter a program constant or a word address for source B. Signed integers are stored in two’s complementary form.

19–5

Page 272

Chapter 19 Comparison Instructions

Greater Than (GRT)

Greater Than

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

GRT

Input Instruction

GRT

ZOOM on GRT –|GRT|– NAME: GREATER THAN SOURCE A: N7:1 0 SOURCE B: 612 612

2.3.0.0.1

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: GRT GREATER THAN Source A Source B

N7:1 0 612

When the value at source A is greater than the value at source B, this instruction is logically true. If the value at source A is less than or equal to the value at source B, this instruction is logically false.

Entering Parameters You must enter a word address for source A. You can enter a program constant or a word address for source B. Signed integers are stored in two’s complementary form.

19–6

Page 273

Chapter 19 Comparison Instructions

Greater Than or Equal (GEQ)

Greater Than or Equal

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

GEQ

Input Instruction

GEQ

ZOOM on GEQ –|GEQ|– 2.3.0.0.1 NAME: GREATER THAN OR EQUAL SOURCE A: N7:1 0 SOURCE B: 612 612

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: GEQ GRTR THAN OR EQUAL Source A N7:1 0 Source B 612

When the value at source A is greater than or equal to the value at source B, this instruction is logically true. If the value at source A is less than the value at source B, this instruction is logically false.

Entering Parameters You must enter a word address for source A. You can enter a program constant or a word address for source B. Signed integers are stored in two’s complementary form.

19–7

Page 274

Chapter 19 Comparison Instructions

Masked Comparison for Equal (MEQ)

Masked Comparison for Equal

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

MEQ

Input Instruction

MEQ

ZOOM on MEQ –|MEQ|– 2.3.0.0.1 NAME: MASKED EQUAL SOURCE A: B3:10 0100 0110 0000 0000 MASK: 00FF 00FF COMPARE: B3:11 0000 0000 0111 0101

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: MEQ MASKED EQUAL Source B3:10 0100011100000000 Mask 00FF Compare B3:11 0000000001110101

This input instruction compares data at a source address with data at a reference address and allows portions of the data to be masked by a separate word.

Entering Parameters • Source – the address of the value you want to compare. • Mask – a hex value or the address of the mask through which the instruction moves data. Refer to appendix B for more information regarding masks and hexadecimal numbering. • Compare – an integer value or the address of the reference. If the 16 bits of data at the source address are equal to the 16 bits of data at the compare address (less masked bits), the instruction is true. The instruction becomes false as soon as it detects a mismatch. Bits in the mask word mask data when reset, they pass data when set.

19–8

Page 275

Chapter 19 Comparison Instructions

Limit Test (LIM)

SLC 5/02 Processors Only Limit Test

HHT Ladder Display:

HHT Zoom Display: (online monitor mode)

LIM

Input Instruction

LIM

ZOOM on LIM –|LIM|– NAME: LIMIT TEST LOW LIM: N7:0 14 TEST: 50 50 HIGH LIM: N7:1 70

2.3.0.0.1

EDT_DAT F1

F2

F3

F4

F5

Ladder Diagrams and APS Displays: LIM LIMIT TEST Low Lim Test High Lim

N7:0 14 50 N7:1 70

This input instruction tests for values within or outside a specified range, depending on how you set the limits.

Entering Parameters Low Limit, Test, and High Limit values you program can be word addresses or decimal values, restricted to the following combinations: • If the Test parameter is a program constant, both the Low Limit and High Limit parameters must be word addresses. • If the Test parameter is a word address, the Low Limit and High Limit parameters can be be either a program constant or a word address.

19–9

Page 276

Chapter 19 Comparison Instructions

True/False Status of the Instruction If the Low Limit has a value equal to or less than the High Limit, the instruction is true when the Test value is between the limits or is equal to either limit. If the Test value is outside the limits, the instruction is false. This is illustrated in the figure below. False –32,768

True

False

Low Limit

+ 32,767

High Limit

Example, low limit less than high limit: Low Limit

High Limit

Instruction is true when Test value is

Instruction is false when Test value is

5

8

5 thru 8

–32,768 thru 4 and 9 thru 32,767

If the Low Limit has a value greater than the High Limit, the instruction is false when the Test value is between the limits. If the Test value is equal to either limit or outside the limits, the instruction is true. This is illustrated in the figure below. True –32,768

False High Limit

True + 32,767

Low Limit

Example, low limit greater than high limit:

19–10

Low Limit

High Limit

Instruction is true when Test value is

Instruction is false when Test value is

8

5

–32,768 thru 5 and 8 thru 32,767

6 thru 7