![background image](http://html1.mh-extra.com/html/omron/sysmac-cs1d-cpu/sysmac-cs1d-cpu_reference-manual_742268842.webp)
803
Data Control Instructions
Section 3-18
SCL2(486) can be used to scale the results of analog signal conversion val-
ues 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 –100 to 200
°
C
using SCL2(486).
SCL2(486) converts signed binary to signed BCD. Negative values can thus
be handled directly for S. The result of scaling in R and the Carry Flag can
also be used to output negative values for the scaling result.
Flags
Precautions
An error will occur and the Error Flag will turn ON if the value for
∆
X (C+1) is
0000 or if the value for
∆
Y (C+2) is not BCD.
The Equals Flag will turn ON when the contents of the result word D is 0000.
The Carry Flag will turn ON if the value placed in the result word is negative.
Examples
Scaling 1 to 5-V Analog Input to 0 to 300
In the following example, it is assumed that an analog signal from 1 to 5 V is
converted and input to CIO 0205 as 0000 to 0FA0 hexadecimal. SCL2(486) is
used to convert (scale) the value in CIO 0205 to a value between 0000 and
0300 BCD.
When CIO 000000 is ON, the contents of CIO 0205 is scaled using the linear
function defined by
∆
X (0FA0),
∆
Y (0300), and the offset (0). These values are
contained in D00100 to D00102, and the result is output to D00200.
∆
Y
∆
X
∆
Y
∆
X
∆
Y
∆
X
∆
Y
∆
X
P1
P1+1
P1+2
R (signed BCD)
S (signed binary)
Offset
R (signed BCD)
S (signed binary)
Offset
R (signed BCD)
S (signed binary)
Offset of 0000
Offset = 0000 hex
Offset
(Signed binary)
(Signed binary)
(Signed BCD)
Positive Offset
Negative Offset
Name
Label
Operation
Error Flag
ER
ON if the contents of C+1 (
∆
X) is 0000.
ON if the contents of C+2 (
∆
Y) is not BCD.
OFF in all other cases.
Equals Flag
=
ON if the result is 0.
OFF in all other cases.
Carry Flag
CY
ON if the result is negative.
OFF if the result is zero or positive.
Summary of Contents for SYSMAC CS1D-CPU**
Page 3: ...iv...
Page 29: ...xxx...
Page 185: ...146 List of Instructions by Function Code Section 2 4...
Page 1389: ...1350 CJ series Instruction Execution Times and Number of Steps Section 4 2...
Page 1390: ...1351 Appendix A ASCII Code Table ASCII SP Four leftmost bits Four rightmost bits...
Page 1391: ...1352 ASCII Code Table Appendix A...