Compare strings (cmp), C.7.7 compare strings (cmp) – Nematron Pointe Controller User Manual

Page 418

Advertising
background image

Appendix C: Ladder Diagram Block Reference

Pointe Controller User Guide

416

C.7.7 Compare strings (CMP)

When used in a Ladder Diagram, the CMP block compares two strings (variable or
literal) and send the result to an output.

Select the

tool (from the

String Blocks

toolbar) and click on a ladder rung to

insert the following block:

Once the block is inserted, you can double-click on it to

configure

it.

Functional Description

This block always passes the Enable input state (EN) through to the Enable Out
output state (ENO) without change; when EN becomes on, ENO is turned on, and
when EN becomes off, ENO is turned off.

When EN becomes on, the block function is executed: the Input Strings 1 and 2
(IN1 and IN2) are compared and the result is placed in the Output Value (OUT).

Values for OUT are determined as follows:

When…

OUT is…

IN1 < IN2

-1

IN1 = IN2

0

IN1 > IN2

1

When two strings are identical up to the NULL terminator in the shorter string
(‘ain1’ and ‘ain100’ for example) the shorter string is considered less than the
longer.

The block function is executed every time the ladder is

scanned

, so long as EN

remains on. If EN becomes off, then OUT remains at its last calculated value until
EN becomes on and the block function is executed again.

Advertising