FP2 Analog Unit
Sample Program for Analog Input
8 - 7
8.3
Scale Conversion Processing Program (CPU Unit with Analog I/O)
8.3
Scale Conversion Processing Program (CPU Unit
with Analog I/O)
Program outline
Using ch 0 to ch 2 (set for no execution of input conversion processing) of the CPU unit
with analog I/O, this program reads the
scale-converted*
analog input data to the data
registers DT104 and DT114 using the preparation completion flag.
*Scale-converted
: Conversion of the analog input data to numerical values that are
easier to manage.
(K)
0
(V)
+13107
+6553
+1
+3
+5
(K)
0
(V)
+5000
+3000
+1000
+1
+3
+5
Scale
conversion
For the sample program, the input data is converted to easy-to-use value using the
high-level instructions
F30 (
*
)
“16-bit multiplier”,
F33 (D%)
“32-bit subtractor” and F22
(+) “16-bit addition.”
In the case of ch 0, the data read to DT100 is multiplied by K4000, and the result is stored
in DT101 (as ch 0-conversion-1). The data stored in DT101 is divided by K13107, and
that result is stored in DT103 (as ch 0-conversion-2). Then the data stored in DT104
is added by K1000, and the result is stored in DT104 (as ch0-conversion-3).
Example:
Contents of DT100 “6553”
×
K4000
÷
K1000
→
3000
Contents of DT100 “13107”
×
K4000
÷
K1000
→
5000
Settings
Channels that execute analog input conversion processing
H11: ch 0 and ch 1 are set for execution and ch2 and ch 3 are not set for execution
I/O allocation
I/O number
Contents
WX0
Analog input data for ch 0
WX1
Analog input data for ch 1
Data register
DT104
Stores scale-converted input data (ch 0-conversion-3) for ch 0
DT114
Stores scale-converted input data (ch 1-conversion-3) for ch 1
next page
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: [email protected]