F
3--
16
A
D
16
-C
ha
nn
el
A
na
lo
g
In
pu
t
5--23
F3--16AD 16-Channel Analog Input
This example program shows how you can use the instructions to load these
equation constants into data registers. The example is written for channel 1, but you
can easily use a similar approach to use different scales for all channels if required.
You may 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.
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
R460
F60
DSTR
K1000
F50
DOUT
R462
F60
On the first scan, these first two instructions load
the analog resolution (constant of 4096) into R460
and R461.
These two instructions load the high limit of the
Engineering unit scale (constant of 1000) into
R462 and R463. 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
R460
F74
DSTR
R576
F50
MUL
R462
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 R460.
DSTR
R576
F50
DOUT
R400
F60
The accumulator is multiplied by the scaling factor,
which is stored in R462.
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
117
116