D
3--
04
A
D
4-
C
ha
nn
el
A
na
lo
g
In
pu
t
2--13
D3--04AD 4-Channel Analog Input
The following example shows how you can use the same program to read either all
channels or a single channel of analog data into Register locations. Once the data is
in a Register, you can perform math on the data, compare the data against preset
values, etc.
Inputs 000 and 001 are used to select between
single channel scanning and all channel scanning.
These two points were arbitrarily chosen and could
be any permissive contacts. When output 117 is
on, all channels will be scanned.
Input 001 selects single channel scan. Inputs 002
and 003 select which channel by turning on
outputs 114 and 115 as necessary.
114
115
Channel
Off
Off
Ch. 1
On
Off
Ch. 2
Off
On
Ch. 3
On
On
Ch. 4
000
OUT
117
Select all channels
000
DSTR1
R001
F51
Read the data
001
This rung loads the data into the accumulator. This
rung executes for all channel scan or single
channel scan.
The DL305 performs math operations in BCD. This
instruction converts the binary data to BCD. (You
can omit this step if your application does not
require the data in BCD format.)
001
001
OUT
114
002
000
Single Channel
OUT
115
BCD
F86
110
DOUT
R400
F60
Store channel 1
111
DOUT
R402
F60
Store channel 2
112
DOUT
R404
F60
Store channel 3
113
DOUT
R406
F60
Store channel 4
The channel selection inputs are used to let the
CPU know which channel has been loaded into the
accumulator. By using these inputs to control a
DOUT instruction, you can easily move the data to
a storage register. Notice that the DOUT
instruction stores the data in two bytes. This is
because two bytes are required to store the BCD
number.
001
003
000
Single Channel
Single or Multiple
Channels