Automation Direct DL405 User Manual page 338

Analog
Hide thumbs Also See for DL405:
Table of Contents

Advertisement

16–24
F4–16DA–1 16-Ch. Analog Current Output
Example 4
Continued
Channels 9 to 16
SP1
LD
V1500
Always On
LDX
V3010
BIN
ANDD
KFFF
OR
V1501
ORD
K8000
OUT
V40502
Increment Channel Index
INCB
V1500
Reset Channel Index
V1500
K8
LD
=
K0
OUT
V1500
Load the channel selection from V1500 once again.
Use the channel selection value, which is now on the data stack, as an
offset from V3010 to load the channel data into the accumulator.
Convert the BCD data to binary. Since the value can never be above
4095, only the least significant 12 bits of the accumulator are used.
Mask off the upper four bits of the word, just in case the data value is out
of range (greater than 4095).
Earlier in the program the channel selection portion of the data word
was created and stored in V1501. Now we can OR this location with
the data word currently in the accumulator to get the final data word
that is ready to send to the analog module.
Set the Output Enable bit, by combining the value of 8000 hex with the
accumulator value. This sets bit 15 to "1", enabling channels 9 through
16.
Send the data stored in the lower half of the accumulator to the analog
module (the OUT instruction ignores the upper 16 bits of the
accumulator). The most significant four bits of the analog word contain
the channel selection bits and the output enable bit. The remaining 12
bits contain the analog data. This example uses V40502, but the actual
value depends on the location of the module in your application.
Increment the channel index value. This allows the logic to cycle
through all sixteen channels (8 pairs).
When channels 8 and 16 have been updated, then reset the channel
selection memory location to 0 (remember, 0 represents channel 1 and
channel 9).

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DL405 and is the answer not in the manual?

Questions and answers

Table of Contents