13–16
F4–04DA–1 Analog Current Output
Sequencing
Example 3,
DL440/DL450
5
4
4
430
440
450
The following program example shows how to send digital values to the module
when you have more than one channel. This example will not work with DL430
CPUs. This example assumes you are using the following data locations.
S
V3000 – channel 1 data
S
V3002 – channel 3 data
S
V1500 – channel to update: 0 = ch. 1, 1 = ch. 2, 2 = ch. 3, 3 = ch. 4
Always On
SP1
LD
V1500
LDX
V3000
BIN
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ANDD
KFFF
LD
V1500
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SHFL
K12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Program is continued on the next page.
V3001 – channel 2 data
V3004 – channel 4 data
This loads the number of the channel to be updated into the
accumulator. The channels are 1–4, but the values in V1500 range
from 0–3 and correspond to the channels. We'll use channel 2 as an
example.
0
0
0
0
0
0
0
0
Acc.
Use the channel selection value, which is now on the data stack, as an
offset from V3000 to load the channel data into the accumulator.
HEX Value in 1st stack location
Octal
V
3
0
0
0
0
1
=
V
+
Acc. 0
0
0
0
Convert the BCD data to binary. Since the value can never be above
4095, only the 12 least significant bits of the accumulator are used.
0
0
0
0
2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1
BCD Value converted to binary now in accumulator
Mask off the upper four bits of the word, just in case the data value is out
of range (greater than 4095).
Load the number of the channel to be updated back into the
accumulator again (the channel data is moved to the first data
stack location).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
This instruction moves the channel
select bit(s) into the proper location. We'll
use it later when we send the 16-bit data
word to the module.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
V1500
0
0
0
1
Octal
3
0
0
1
2
3
4
5
The value in V3001 is
2345, which is slightly
over half scale.
3
4
5
Need help?
Do you have a question about the DL405 and is the answer not in the manual?
Questions and answers