beautypg.com

Chapter 4. programming – IAI America S-SEL-E User Manual

Page 159

background image

Page 154

Chapter 4. Programming

CPNE (Compare if not equal)

[Function]

Turns ON the post flag or the output port if the values in Operand 1 and 2 are equal. (Variable values remain

the same) When not equal (either greater or smaller), post section turns OFF.

* When real variables (100 ~ 199, 300 ~ 399) are used, it is almost impossible for the values to be equal after

floating point calculations. To compare position data, a calculation technique must be applied prior to
making the comparison, such as dividing by 100, then multiplying by 1000 to convert the number up to the
first decimal place into an integer.

[Example]

CPEQ 1

5

600

When the contents of variable 1 in Operand 1 equal the contents of Operand 2 (in this case, if it becomes 5),
then output 600 turns ON. If the value is other than 5, output 600 turns OFF.

CPEQ 1

*2

600

When the contents of variable 1 in Operand 1 equal the contents of the variable in Operand 2, output 600
turns ON. If the content is not equal to that of Operand 2 (variable 2), 600 turns OFF.

2-11

Calculation Comparison

CPEQ (Compare if equal)

E x p a n s io n

c o n d itio n

( A N D · O R )

In p u t

c o n d itio n

( I/O · F la g )

C o m m a n d

P o s t

( O u tp u t p o r t · F la g )

C o m m a n d

O p e r a n d 1

O p e r a n d 2

O p tio n a l

O p tio n a l

C P E Q

V a r ia b le n o .

D a ta ·V a r ia b le n o .

R e q u ir e d

E x p a n s io n

c o n d itio n

( A N D · O R )

In p u t

c o n d itio n

( I/O · F la g )

C o m m a n d

P o s t

( O u tp u t p o r t · F la g )

C o m m a n d

O p e r a n d 1

O p e r a n d 2

O p tio n a l

O p tio n a l

C P N E

V a r ia b le n o .

D a ta ·V a r ia b le n o .

R e q u ir e d

[Function]

Turns ON the post flag or the output port if the values in Operand 1 and 2 are not equal (equivalent to when

either the CPGT or CPLT condition is fulfilled). (Variable values remain the same) When the contents of
Operand 1 and Operand 2 are equal, post section turns OFF.

[Example]

CPNE 1

5

600

When the contents of variable 1 in Operand 1 does not equal the contents of Operand 2 (in this case, if it is
greater or smaller than 5), then output 600 turns ON. If variable 1 reaches a value of 5, output 600 turns OFF.

CPNE 1

*2

600

When the contents of variable 1 in Operand 1 does not equal the contents of the variable in Operand 2, output
600 turns ON. If the content equals the value in Operand 2, 600 turns OFF.

This manual is related to the following products: