F
3--
04
D
A
--1
4-
C
ha
nn
el
A
na
lo
g
O
utp
ut
7--13
F3--04DA--1 4-Channel Analog Output
This example shows how to send digital values to the module when you have more
than one channel. This example will automatically update all four channels over four
scans. The example is fairly simple and will work in most all situations, but there are
instances where problems can occur. The logic must be active on the first CPU scan
and all subsequent scans. If the logic gets stopped or disabled for some reason,
there is no way to restart it. If you’re using an RLL
PLUS
(Stage) program, put this logic
in an initial stage that is always active. Also, you should avoid using the this example
if you require the analog output logic to be used inside a Master Control Relay field of
control. Even if you do not have a need for the MCR, you can still accidentally disable
the analog output logic by inadvertently writing to the multiplexing control relays with
an operator interface or intelligent module, such as an ASCII BASIC module, etc.
The following program example shows how to send the digital values to multiple
channels. With this program, all channels will be updated within four scans. You must
use the rungs in the order shown, but you can include them anywhere in the program.
When channel 4 has been updated, 160 restarts
the update sequence.
When channel 3 has been updated, this rung loads
the data for channel 4 into the accumulator. By
turning on 117, this triggers the channel update.
(Since 117 is also used as an input, this results in
a one-shot.)
374
117
OUT RST
160
Ch4 Done
116
DSTR
R456
F50
Ch3 Done
OUT
117
115
Ch2 Done
114
Ch1 Done
160
Restart
374
On
First
Scan
When channel 2 has been updated, this rung loads
the data for channel 3 into the accumulator. By
turning on 116, this triggers the channel update.
(Since 116 is also used as an input, this results in
a one-shot.)
When channel 1 has been updated, this rung loads
the data for channel 2 into the accumulator. By
turning on 115, this triggers the channel update.
(Since 115 is also used as an input, this results in
a one-shot.)
This rung loads the data for channel 1 into the
accumulator. Since 374 is used, this rung
automatically executes on the first scan. After that,
160 restarts this rung. If you examine the first rung,
you’ll notice 160 only comes on after channel 4
has been updated.
DSTR
R454
F50
OUT
116
DSTR
R452
F50
OUT
115
DSTR
R450
F50
OUT
114
Always
on
Since the data is in BCD format, you have to
convert it to binary before you send the data to the
module. (You can omit this step if you’ve already
converted the data elsewhere.)
BIN
F85
DOUT1
R001
F61
SHFR
K 8
F80
DOUT3
R0011
F63
Send the 8 least significant data bits to the first
Register that corresponds to the module which is
R001.
Shift the 4 most significant data bits to the right 8
places. (The data is still in the accumulator).
Send the 4 most significant data bits to the second
Register that corresponds to the module which is
R011.
Sequencing the
Channel Updates
Sequencing
Example