F
3-
-0
8A
D
8-
C
ha
nn
el
A
na
lo
g
In
pu
t
4--16
F3--08AD 8-Channel Analog Input
This example program shows how you can use the instructions to load these
equation constants into data registers. The example was written for channel 1, but
you could easily use a similar approach to use different scales for all channels if
required.
You could just use the appropriate constants in the instructions dedicated for each
channel, but this method allows easier modifications. For example, you could easily
use an operator interface or a programming device to change the constants if they
are stored in Registers.
This rung loads the four most significant data bits
into the accumulator from Register 011 on every
scan. (You could use any permissive contact.)
Temporarily store the bits to Register 501.
DSTR3
R011
F53
DOUT1
R501
F61
374
Read the data
Store channel 1
374
DSTR
K4096
F50
DOUT
R430
F60
DSTR
K1000
F50
DOUT
R432
F60
On the first scan, these first two instructions load
the analog resolution (constant of 4096) into R430
and R431.
These two instructions load the high limit of the
Engineering unit scale (constant of 1000) into
R432 and R433. Note, if you have different scales
for each channel, you’ll also have to enter the
Engineering unit high limit for those as well.
Load the constants
DIV
R430
F74
DSTR
R576
F50
MUL
R432
F73
This instruction moves the decimal portion from the
auxilliary accumulator into the regular accumulator
for further operations.
The analog value is divided by the resolution of the
module, which is stored in R430.
DSTR
R576
F50
DOUT
R400
F60
The accumulator is multiplied by the scaling factor,
which is stored in R432.
This instruction moves most significant digits (now
stored in the auxilliary accumulator) into the
regular accumulator for further operations.
The scaled value is stored in R400 and R401 for
further use.
114
115
116