Writing the Control Program
Once you have configured the F4–04ADS module, use the following examples to
get started writing the control program.
Multiple
Since all channels are multiplexed into a single data word, the control program must
Channels
be setup to determine which channel is being read. Since the module appears as X
input points to the CPU, it is very easy to use the active channel status bits to
Selected
determine which channel is being monitored.
Reading Values,
This program example shows how to read the analog data into V-memory locations
DL440/450
with DL440/DL450 CPUs. Once the data is in V-memory, you can perform math on
5
4
4
the data, compare the data against preset values and so forth. This example reads
one channel per scan, so it takes four scans to read all four channels.
430
440
450
F4-04ADS 4-Channel Isolated Analog Input
MSB
Active
Channel Bits
SP1
LDF
X20
K12
BCD
X34
OUT
V3000
X35
OUT
V3001
X36
OUT
V3002
X37
OUT
V3003
Note, this example uses SP1, which is always on and the
inputs are continually being updated. You could also use an
X, C, etc. permissive contact.
F4–04ADS
8pt
8pt
16pt
16pt
16pt
16pt
Input
Input
Input
Input
Output
Output
X0
X10
X20
X40
–
–
–
–
X7
X17
X37
X57
V40402
V40400
V40401
LSB
Data Bits
Loads the first 12 bits of the data word into the accumulator (starting
with location X20).
Converts the binary value in the accumulator to BCD and stores the
result in the accumulator. It is usually easier to perform math
operations in BCD, so it is best to convert the data to BCD
immediately . You can leave out this instruction if your application
does not require it. Do not use this instruction if you are going to
send the data to an internal PID loop because the PID loop requires
the PV (process variable) to be in binary format.
When contact X34 is on, channel 1 data is being sent to the CPU.
The OUT instruction moves the data from the accumulator to V3000.
When contact X35 is on, channel 2 data is stored in V3001.
When contact X36 is on, channel 3 data is stored in V3002.
When contact X37 is on, channel 4 data is stored in V3003.
4–13
Need help?
Do you have a question about the DL405 and is the answer not in the manual?
Questions and answers