2-285
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Data Control Instructions
2
SCL3
Operand Specifications
Flags
Function
SCL3(487) is used to convert the signed BCD data (the BCD data contains the absolute value and the
Carry Flag shows the sign) contained in the source word S into signed binary data and place the result
in the result word R according to the linear function defined by the slope (X, Y) and an offset. The
maximum and minimum conversion values are also specified. The address of the first word containing
X, Y, the offset, the maximum conversion, and the minimum conversion is specified for the first
parameter word P1.
The sign of the result is indicated by the status of the Carry Flag (ON: negative, OFF: positive). Use
STC(040) and CLC(041) to turn the Carry Flag ON and OFF.
The following equations are used for the conversion.
The offset and slope can be a positive value, 0, or a negative value. Using a negative slope enables
reverse scaling.
The result will be rounded to the nearest integer.
The source value in S is treated as an absolute BCD value and the sign is indicated by the Carry
Flag. The source value can thus be between –9999 and 9999.
If the result is less than the minimum conversion value, the minimum conversion value will be output
as the result. If the result is greater than the maximum conversion value, the maximum conversion
value will be output.
Area Word addresses Indirect DM addresses Constants CF Pulse bits TR bits
CIO WR HR AR T C DM @DM *DM
S. P1,R OK OK OK OK OK OK OK OK OK --- --- --- ---
Name Label Operation
Error Flag P_ER ON if the contents of S is not BCD.
ON if the contents of C+1 (X) is not between 0001 and 9999 BCD.
OFF in all other cases.
Equals Flag P_EQ ON if the result is 0.
OFF in all other cases.
Negative Flag P_N ON when the MSB of the R (the result) is 1.
OFF in all other cases.
R = Y× ((Binary conversion of S) + (Offset))
Binary conversion of X
Note The slope of the line is Y/X.