Reading Eight Channels In One Scan, Dl440/450; Scaling The Input Data - Automation Direct DL405 User Manual

Analog
Hide thumbs Also See for DL405:
Table of Contents

Advertisement

5–16
F4–08AD 8-Channel Analog Input
Reading Eight
Channels in
One Scan,
DL440/450
5
4
4
430
440
450
Scaling the
Input Data
The following program example shows how to read all eight channels in one scan
by using a FOR/NEXT loop. Before you choose this method, do consider its impact
on CPU scan time. The FOR/NEXT routine shown here will add about 16ms
(2ms/loop) to the overall scan time. If you do not need to read the analog data on
every scan, change SP1 to a permissive contact (such as an X input, CR, or stage
bit) to only enable the FOR/NEXT loop when it is required.
NOTE: Do not use this FOR/NEXT loop program to read the module in a
remote/slave arrangement; it will not work. Use one of the programs shown that
reads one channel per scan.
SP1
K8
FOR
SP1
LDIF
X20
K12
BCD
LDIF
X34
K4
OUTX
V3000
NEXT
Note, this example
uses SP1, which is
always on. You could
also use an X, C, etc.
permissive contact.
Most
applications
measurements in engineering units,
which provide more meaningful data.
This is accomplished by using the
conversion formula shown.
You may have to make adjustments to
the formula depending on the scale you
choose for the engineering units.
For example, if you wanted to measure pressure (PSI) from 0.0 to 99.9 then you
would have to multiply the analog value by 10 in order to imply a decimal place when
you view the value with the programming software or a handheld programmer.
Notice how the calculations differ when you use the multiplier.
Starts the FOR/NEXT loop. The constant (K8) specifies how many
times the loop will execute. Enter a constant equal to the number of
channels you are using. For example, enter K4 if you're using 4
channels.
Immediately loads the first 12 bits of the data word (starting with X20)
into the accumulator. The LDIF instruction will retreive the I/O points
without waiting on the CPU to finish the scan.
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 (such as PID loops).
This LDIF instruction immediately loads the three channel indicator
bits into the accumulator. (For this module, the last bit in the word
must be read also, that's why the K4 is used. Otherwise, only one
channel will be read).
The OUTX instruction stores the channel data to an address that
starts at V3000 plus the channel offset. For example, if channel 3
was being read, the data would be stored in V3002 (V3000 + 2).
Module Reading
Channel 1
Channel 2
Channel 3
Channel 4
Channel 5
Channel 6
Channel 7
Channel 8
usually
require
Acc. Bits
Offset
Data Stored in ...
000
0
V3000
001
1
V3001
010
2
V3002
011
3
V3003
100
4
V3004
101
5
V3005
110
6
V3006
111
7
V3007
Units + A H * L
4095
H = high limit of the Engineering
unit range
L = low limit of the Engineering
unit range
A = Analog value (0 – 4095)

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