Omron CJ - REFERENCE MANUAL 10-2009 Reference Manual page 703

Table of Contents

Advertisement

Flags
Name
Error Flag
Equals Flag
Function
SCL(194) is used to convert the unsigned binary data contained in the source word S into unsigned
BCD data and place the result in the result word R according to the linear function defined by points
(As, Ad) and (Bs, Bd). The address of the first word containing the coordinates of points (As, Ar) and
(Bs, Br) is specified for the first parameter word P1. These points define by 2 values (As and Bs) before
scaling and 2 values (Ar and Br) after scaling.
The following equations are used for the conversion.
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
Hint
• 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 program 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.
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Label
ER
• 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.
(Bd – Ad)
BCD conversion of (Bs – S)
Scaling is performed according
to the linear function defined by
points A and B.
P
(BCD)
P1+1
(BIN)
P1+2
(BCD)
P1+3
(BIN)
S (unsigned binary)
Operation
Converted value
Converted value
3. Instructions
3
665

Advertisement

Table of Contents
loading

Table of Contents