Single Active Channel; Reading Four Channels In One Scan, Dl440/450 - Automation Direct DL405 User Manual

Analog
Hide thumbs Also See for DL405:
Table of Contents

Advertisement

Single Active
If the module is configured for only one input channel you can omit the channel
selection logic; this simplifies the program.
Channel
4
4
4
430
440
450
Note: This example uses SP1, which is always on. You can also use an X, C, etc. permissive
contact. Also, the DL430 requires an additional instruction to mask off the most significant four
bits that are brought in with the LD instruction, before the BCD instruction is executed. This
method is shown in the previous example using an ANDD instruction.
The following program example shows how to read all four channels in one scan by
Reading Four
using a FOR/NEXT loop. Remember, the FOR/NEXT routine shown here will add
Channels in
about 5 ms (1.25 ms/loop) to the overall scan time. If you don't need to read the
One Scan,
analog data on every scan, change SP1 to a permissive contact (such as an X
DL440/450
input, CR, or stage bit) to only enable the FOR/NEXT loop when it is required. This
5
4
4
FOR/NEXT loop program will not work in a remote/slave arrangement; use one of
430
440
450
the programs shown that reads one channel per scan.
SP1
LD or LDF
BCD
OUT
V3000
SP1
K4
FOR
LDIF
X20
K32
OUTD
V40401
ANDD
KFFFF
BCD
X40
OUT
V3001
X41
OUT
V3002
X42
OUT
V3003
X43
OUT
V3004
NEXT
F4–04AD 4 Channel Analog Input
Channel 1 data is always being sent to the CPU. Use LD
or LDF, depending on the type of CPU you are using.
The BCD instruction converts the data from binary to
BCD. This instruction may be optional for your
application. Do not use with PID loops.
The OUT instruction stores the data in V3000.
Starts the FOR/NEXT loop. The constant (K4) specifies how many
times the loop will execute, equal to the number of channels you are
using. For example, enter K3 if you're using 3 channels.
Immediately loads all 32 bits of the data word into the accumulator.
The LDIF instruction retreives the I/O points without waiting on the
CPU to finish the scan.
Save the new input status which is in the accumulator to the image
register (V memory). Remember, the FOR–NEXT loop will do this
four times before the CPU's normal scan updates V40401 and 40402
again.
This ANDD instruction masks off the upper sixteen bits, leaving just
the lower 16 bits which contain the 12 or 16 bit analog value in the
accumulator.
Since the DL405 CPUs perform math operations in BCD, it is usually
best to convert the data to BCD immediately. You can leave out this
instruction if your application does not require it.
One of the four active channel bits will be on each time through the
FOR–NEXT loop, indicating the active channel. The corresponding
OUT instruction places the 12 or 16-bit value in the accumulator in
the proper V memory location.
Note: This example uses SP1, which is always on.
You could also use an X, C, etc. permissive contact.
3–29

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