1. Interval comparison ZCP/ZCPD/ZCPF

1. Interval comparison ZCP/ZCPD/ZCPF

1.1. Instruction Description

Compare the value IN3 with the lower limit IN1 and upper limit IN2, and output the comparison result to OUT and the following two bits.

Assuming IN1=D0, IN2=D2,IN3=D4,OUT=Y000。

The value of IN1 the value of IN2 the value of IN3 the current comparison result the output of Y000 the output of Y001 the output of Y002
100 200 50 D4<D0<=D2 ON OFF OFF
100 200 150 D0<=D4<=D2 OFF ON OFF
100 200 250 D0<=D2<D4 OFF OFF ON

The lower limit IN1 cannot be greater than the upper limit IN2

1.2. The valid operands of the instruction

1.2.1. Single word type(ZCP):

Input/Output Data Type operand Description
IN1 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) minimum
IN2 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) maximum
IN3 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) current value
OUT ON/OFF Y/M/S, word positioning (D/V/Z) Result

1.2.2. Double word type(ZCPD):

Input/Output Data Type operand Description
IN1 32-bit integer D/CV/K/H/FD, bit composite word (X/Y/M/C/T/S), local variable (LD) minimum
IN2 32-bit integer D/CV/K/H/FD, bit composite word (X/Y/M/C/T/S), local variable (LD) maximum
IN3 32-bit integer D/CV/K/H/FD, bit composite word (X/Y/M/C/T/S), local variable (LD) current value
OUT ON/OFF Y/M/S, word positioning (D/V/Z) Result

1.2.3. Float type(ZCPF):

Input/Output Data Type operand Description
IN1 32-bit real number D/K/FD, local variable (LF) minimum
IN2 32-bit real number D/K/FD, local variable (LF) maximum
IN3 32-bit real number D/K/FD, local variable (LF) current value
OUT ON/OFF Y/M/S, word positioning (D/V/Z) Result

1.3. Example

Command table:

NETWORK 000

LD M0

ZCP K100 K200 D0 Y000 // 当D0 < K100时 Y000 = ON ;当K100 <= D0 <= K200时 Y001 = ON ;当D0 > K200时 Y002 = ON。

ZCP

图1 ZCP