Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 17 trang
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
Nội dung
DAY SESSION 9-1 LADDER LOGIC PROGRAMMING – COMPARISONINSTRUCTIONS Ladder Logic Programming – ComparisonInstructions – 10 December 2010 OBJECTIVES 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) 9-2 • Describe the function of mask compare equal to (MEQ) Ladder Logic Programming – ComparisonInstructions – 10 December 2010 SUB-WINDOW : COMPARE 9-3 The comparisoninstructions let you compare values using an expression or a specific comparison instruction Ladder Logic Programming – ComparisonInstructions – 10 December 2010 COMPARE (CMP) 9-4 The CMP instruction performs a comparison on the arithmetic operations you specify in the expression Ladder Logic Programming – ComparisonInstructions – 10 December 2010 EQUAL TO (EQU) EQU Equal Source A Source B N7:5 N7:10 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 If the value in N7:5 is equal to the value in N7:10, set output bit O:013/1 9-5 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) Ladder Logic Programming – ComparisonInstructions – 10 December 2010 NOT EQUAL TO (NEQ) NEQ Not Equal Source A Source B ? ? ? ? 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 9-6 If the value in N7:5 is not equal to the value in N7:10, set output bit O:013/1 Ladder Logic Programming – ComparisonInstructions – 10 December 2010 GREATER THAN OR EQUAL TO (GEQ) GEQ Grtr Than or Eql (A>=B) Source A N7:5 Source B N7:10 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 9-7 If the value in N7:5 is greater than or equal to the value in N7:10, set output bit O:013/1 Ladder Logic Programming – ComparisonInstructions – 10 December 2010 GREATER THAN (GRT) GRT Greater Than (A>B) Source A N7:5 Source B N7:10 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 9-8 If the value in N7:5 is greater than the value in N7:10, set output bit O:013/1 Ladder Logic Programming – ComparisonInstructions – 10 December 2010 LESS THAN OR EQUAL TO (LEQ) LEQ Less Than or Eql (A