3. Instruction Set

6.Substitute the above parameters into y = kx + b and the operation instruction can be obtained. y = kx + b = D = k S1 + b = slope × S1 + offset = slope × S1 + min. destination value – min. source value × slope = slope × (S1 – min. source value) + min. destination value = (S1 – min. source value) × (max. destination value – min. destination value) ÷ (max. source value – min. source value) + min. destination value

7.If S1 > max. source value, S1 will be set as max. source value. If S1 < min. source value, S1 will be set as min. source value. When the source value and parameters are set, the following output figure can be obtained:

Destination value

Max. Destination value

D

Source value

Min.

1

Max.

source value

source value

 

Min. destination value

Program Example 1:

1.Assume source value S1 = 500, max. source value D0 = 3000, min. source value D1 = 200, max. destination value D2 = 500, and min. destination value D3 = 30. When X0 = ON, SCLP instruction executes and the result of proportional calculation will be stored in D10.

2.Equation: D10 = [(500 – 200) × (500 – 30)] ÷ (3000 – 200) + 30 = 80.35. Rounding off the result into an integer, D10 =80.

X0

MOV K3000 D0

MOV K200 D1

MOV K500 D2

MOV K30 D3

X0

SCLP K500 D0 D10

3 - 4 5 7

Page 573
Image 573
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Destination value Max. Destination value Source value