Introduction

Add to My manuals
704 Pages

advertisement

Introduction | Manualzz

Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ) Chapter 5

Greater Than (GRT)

Operands:

The GRT instruction tests whether Source A is greater than Source B.

IF sourceA > sourceB THEN

<statements>;

Relay Ladder

Operand

Source A

Source B

Type

SINT

INT

DINT

REAL string

SINT

INT

DINT

REAL string

Format

immediate tag

Description

value to test against Source B immediate tag value to test against Source A

If you enter a SINT or INT tag, the value converts to a DINT value by sign-extension.

String data types are:

default STRING data type

any new string data type that you create

To test the characters of a string, enter a string tag for both Source A and Source B.

Structured Text

Use the greater than sign “>” as an operator within an expression. This expression evaluates whether sourceA is greater than sourceB.

See Appendix C, Structured Text Programming for information on the syntax of expressions within structured text.

Function Block

Operand

GRT tag

Type

FBD_COMPARE

Format

structure

Description

GRT structure

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

219

Chapter 5 Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ)

FBD_COMPARE Structure

Input Parameter

EnableIn

SourceA

SourceB

Data Type

BOOL

REAL

REAL

Output Parameter

EnableOut

Dest

Data Type

BOOL

BOOL

Description

Enable input. If cleared, the instruction does not execute and outputs are not updated.

Default is set.

Value to test against SourceB.

Valid = any float

Value to test against SourceA.

Valid = any float

Description

The instruction produced a valid result.

Result of the instruction. This is equivalent to rung-condition-out for the relay ladder

GRT instruction.

Description:

The GRT instruction tests whether Source A is greater than Source B.

When you compare strings:

The hexadecimal values of the characters determine if one string is less than or greater than another string. For the hex code of a character, see the back cover of this manual.

When the two strings are sorted as in a telephone directory, the order of the strings determines which one is greater. s e r e s l e r a t g r e

A

AB

B

ASCII Characters Hex Codes

1ab $31$61$62

1b $31$62 a ab

$41

$41$42

$42

$61

$61$62

AB < B a > B

Arithmetic Status Flags:

not affected

Fault Conditions:

none

220

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ) Chapter 5

Condition

prescan rung-condition-in is false rung-condition-in is true

Execution:

Relay Ladder

Action

The rung-condition-out is set to false.

The rung-condition-out is set to false.

postscan

Condition

prescan instruction first scan instruction first run

EnableIn is cleared

EnableIn is set postscan

Source A

>

Source B yes no rung-condition-out is set to false rung-condition-out is set to true end

The rung-condition-out is set to false.

Function Block

Action

No action taken.

No action taken.

No action taken.

EnableOut is cleared.

The instruction executes.

EnableOut is set.

No action taken.

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

221

Chapter 5 Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ)

Example:

If value_1 is greater than value_2, set light_1. If value_1 is less than or equal to

value_2, clear light_1.

Relay Ladder

Structured Text

light_1 := (value_1 > value_2);

Function Block

222

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

advertisement

Related manuals

advertisement

Table of contents