1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

09 programming comparison instructions Training PLC Allen Bradley

17 46 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 17
Dung lượng 405,35 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

After completing this module, you will be able to • Describe the function of equal EQ and not equal NEQ instructions • Describe the function of less than LES and greater than GRT instr

Trang 1

DAY 3

SESSION 1

LADDER LOGIC PROGRAMMING –

COMPARISON INSTRUCTIONS

Trang 2

After completing this module, you will be able to

Describe the function of equal (EQ) and not equal (NEQ)

instructions

Describe the function of less than (LES) and greater than

(GRT) instructions

Describe the function of less than or equal to (LEQ) and

greater than or equal to (GEQ) instructions

Describe the function of limit test (LIM)

Describe the function of mask compare equal to (MEQ)

Trang 3

SUB-WINDOW : COMPARE

The comparison instructions let you compare values using an

expression or a specific comparison instruction

Trang 4

COMPARE (CMP)

The CMP instruction performs a comparison on the arithmetic

operations you specify in the expression.

Trang 5

EQUAL TO (EQU)

Use the EQU instruction to test whether two values are equal

Source A and source B can either be immediate values or tag name that

contain values

Floating point values are rarely absolutely equal If you need to

determine the equality of floating point values, use the LIM instruction

(instead of the EQU)

EQU Equal Source A N7:5

0 Source B N7:10

0 EQU

If the value in N7:5 is equal to the value in N7:10, set output bit O:013/1

Trang 6

NOT EQUAL TO (NEQ)

NEQ Not Equal

?

?

NEQ

Use the NEQ instruction to test whether two values are not equal

Source A and source B can either be immediate values or tag name

that contain values

If the value in N7:5 is not equal to the value in N7:10, set output bit O:013/1

Trang 7

GREATER THAN OR EQUAL TO

Grtr Than or Eql (A>=B) Source A N7:5

0

Source B N7:10

0

GEQ

Use the GEQ instruction to test whether one value (Source A) is greater

than or equal to another value (Source B)

Source A and source B can either be immediate values or tag name that

contain values

If the value in N7:5 is greater than or equal to the value in N7:10, set output bit O:013/1

Trang 8

GREATER THAN (GRT)

GRT Greater Than (A>B) Source A N7:5

0

Source B N7:10

0

GRT

Use the GRT instruction to test whether one value (Source A) is greater

than another value (Source B)

Source A and source B can either be immediate values or tag name that

contain values

If the value in N7:5 is greater than the value in N7:10, set output bit O:013/1

Trang 9

LEQ Less Than or Eql (A<=B) Source A N7:5

0

Source B N7:10

0

LEQ LESS THAN OR EQUAL TO (LEQ)

Use the LEQ instruction to test whether one value (Source A) is less than

or equal to another value (Source B)

Source A and source B can either be immediate values or tag name that

contain values

If the value in N7:5 is less than or equal to the value in N7:10, set output bit O:013/1

Trang 10

LESS THAN (LES)

LES Less Than (A<B) Source A N7:5

0

Source B N7:10

0

LES

Use the LEQ instruction to test whether one value (Source A) is less than

another value (Source B)

Source A and source B can either be immediate values or tag name that

contain values

If the value in N7:5 is less than the value in N7:10, set output bit O:013/1

Trang 11

LIM Limit Test Low Lim N7:10

0<

Test N7:15

0<

High Lim N7:20

0<

LIM LIMIT TEST (LIM)

Use the LIM instruction to test for a value inside of or outside of a

specified range

The instruction is false until it detects that the test value is within certain

limit Then the instruction goes true.

If the value in N7:15 is greater than or equal to the value in N7:10 and less than or equal to the value

in N7:20, set output bit O:013/1

Trang 12

COMPARE (CMP)

CMP Comparison Expression ?

CMP

The CMP instruction compares value and performs logical expressions

The CMP instruction is an input instruction that performs a comparison on arithmetic operation you specify in the expression

The expression defines the operation you want to perform Define the

expression with operators and addresses or program constant

If the sum of the value in N7:0 and N7:1 is greater than the sum of the value in N7:2 and N7:3, set output bit O:013/1

Trang 13

VALID OPERATOR FOR USE IN CMP

EXPRESSION

CMP Comparison Expression ?

CMP

Trang 14

CASE STUDY I

Trang 15

CASE STUDY II

Trang 16

Test whether one value is greater than or equal to a second value GEQ

Test whether one value is greater than a second value GRT

Test whether one value is less than or equal to a second value LEQ

Test whether one value is less than a second value LES

Test whether one value is between two other values LIM

Comparison Instruction

Trang 17

SESSION 2

FUNCTION BLOCK DIAGRAM (FBD)

PROGRAMMING I

Ngày đăng: 15/05/2019, 20:44