D
3--
04
A
D
4-
C
ha
nn
el
A
na
lo
g
In
pu
t
2--15
D3--04AD 4-Channel Analog Input
The following instructions are required to scale the data. We’ll continue to use the
42.9 PSI example. In this example we’re using channel 1. Input 110 is the active
channel indicator for channel 1. Of course, if you were using a different channel, you
would use the active channel indicator point that corresponds to the channel you
were using.
110
DSTR
R400
F50
DIV
K256
F74
This instruction brings the analog value (in BCD)
into the accumulator.
This instruction moves the two-byte decimal
portion into the accumulator for further operations.
Scale the data
The analog value is divided by the resolution of the
module, which is 256. (110 / 256 = 0.4296)
DSTR
R576
F50
MUL
K100
F73
DSTR
R576
F50
DOUT
R450
F60
0
1
1
0
Accumulator
0
0
0
0
Aux. Accumulator
0
0
0
0
Accumulator
4
2
9
6
Aux. Accumulator
This example assumes you have already read the analog data
and stored the BCD equivalent in R400 and R401
4
2
9
6
Accumulator
4
2
9
6
Aux. Accumulator
The accumulator is then multiplied by the scaling
factor, which is 100. (100 x 4296 = 429600). Notice
that the most significant digits are now stored in
the auxilliary accumulator. (This is different from
the way the Divide instruction operates.)
9
6
0
0
Accumulator
0
0
4
2
Aux. Accumulator
R577
R576
R577
R576
R577
R576
R577
R576
This instruction moves the two-byte auxilliary
accumulator for further operations.
0
0
4
2
Accumulator
0
0
4
2
Aux. Accumulator
R577
R576
This instruction stores the accumulator to R450
and R451. R450 and R451 now contain the PSI,
which is 42 PSI.
0
0
4
2
Accumulator
0
0
4
2
Store in R451 & R450
R451
R450