Reading Four
The following program shows you how to read all four channels in one scan by using
Channels in
a FOR/NEXT loop. Remember, this routine will lengthen the scan time. If you do not
One Scan,
need to read the analog data on every scan, change the SP1 to a permissive
contact (such as X input, CR, or stage bit) to only enable the loop when it is required.
DL440/450 Only
5
4
4
430
440
450
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 that reads one
channel per scan.
Scaling the Input
Most
Data
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.
F4-04ADS 4-Channel Isolated Analog Input
SP1
K4
FOR
SP1
LDIF
X20
K12
BCD
LDIF
X34
K4
ENCO
OUTX
V3000
NEXT
Note: This example uses SP1, which is always on. You could also use an X, C, etc. permissive contact.
applications
usually
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 are using 3 channels.
Loads immediate 12 bits of the data word into the accumulator. The
LDIF instruction retreives the I/O points without waiting for the CPU
to finish the scan.
Changes the value in the accumulator to BCD. You can leave this out
if it is not required (such as for PID loops).
Loads immediate 4 bits of the data word into the accumulator. The
LDIF instruction retreives the I/O points without waiting for the CPU
to finish the scan.
The ENCO instruction encodes the bit position in the accumulator
having a value of 1, and returns the corresponding binary
representation.
The OUTX instruction copies a 16 bit value from the accumulator to
V3000.
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.
require
Units + A H * L
H = high limit of the EU range
L = low limit of the EU range
A = Analog value (0 – 4095)
4–15
4095
Need help?
Do you have a question about the DL405 and is the answer not in the manual?
Questions and answers