Omron CP - PROGRAMMING MANUAL 05-2007 Programming Manual page 687

Cp1h/cp1l cpu unit
Table of Contents

Advertisement

Data Control Instructions
Flags
Precautions
Examples
654
The following equations are used for the conversion.
(Bd – Ad)
R = Bd
BCD conversion of (Bs – As)
The slope of the line is as follows:
(Bd – Ad)
R = Bd
BCD conversion of (Bs – As)
Points A and B can define a line with either a positive or negative slope. Using
a negative slope enables reverse scaling.
The result will be rounded to the nearest integer. If the result is less than
0000, 0000 will be output as the result. If the result is greater than 9999, 9999
will be output.
R (unsigned BCD)
Point B
Point A
SCL(194) can be used to scale the results of analog signal conversion values
from Analog Input Units according to user-defined scale parameters. For
example, if a 1 to 5-V input to an Analog Input Unit is input to memory as 0000
to 0FA0 hexadecimal, the value in memory can be scaled to 50 to 200 C
using SCL(194).
SCL(194) converts unsigned binary to unsigned BCD. To convert a negative
value, it will be necessary to first add the maximum negative value in the pro-
gram before using SCL(194) (see example).
SCL(194) cannot output a negative value to the result word, R. If the result is
a negative value, 0000 will be output to R.
Name
Label
Error Flag
ER
Equals Flag
=
An error will occur and the Error Flag will turn ON if the values for Ar (C) and
Br (C+2) are not in BCD, or if the values for As (C+1) and Bs (C+3) are equal.
The Equals Flag will turn ON when the contents of the result word D is 0000.
In the following example, it is assume that an analog signal from 1 to 5 V is
converted and input to D0 as 0000 to 0FA0 hexadecimal. SCL(194) is used to
convert (scale) the value in CIO 200 to a value between 0000 and 0300 BCD.
When CIO 0.00 is ON, the contents of D0 is scaled using the linear function
defined by point A (0000, 0000) and point B (0FA0, 0300). The coordinates of
these points are contained in D100 to D103, and the result is output to D200.
BCD conversion of (Bs – S)
Scaling is performed according
to the linear function defined by
points A and B.
P
(BCD)
Converted value
(BIN)
P1+1
P1+2
(BCD)
Converted value
P1+3
(BIN)
S (unsigned binary)
Operation
ON if the contents of C (Ar) or C+1 (Br) is not BCD.
ON if the contents of C+1 (As) and C+3 (Bs) are equal.
OFF in all other cases.
ON if the result is 0.
OFF in all other cases.
Section 3-17

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents