Data Manipulation Instructions Chapter 10 207
type), the instruction will stop at that point and set
the error (ER) bit. The scan will continue, but the in-
struction will not continue until the error bit is reset.
• If the instruction goes to completion, the enable bit
and the done bit will remain set until the instruction
goes false, at which point the position, the enable
bit, and the done bit will all be reset to 0.
Numeric Mode
• For this mode you enter a decimal number (1–1000).
• In the numeric mode, the le operation is distributed
over a number of program scans.
• The value you enter sets the number of elements to
be transferred per scan.
• The numeric mode can decrease the time it takes
to complete a program scan. Instead of waiting for
the total le length to be transferred in one scan, the
numeric mode breaks up the transfer of the le data
into multiple scans, thereby cutting down on the in-
struction execution time per scan.
Incremental mode
• For this mode you enter the letter I.
• In the incremental mode, one element of data is
operated on for every false-to-true transition of the
instruction.
• The rst time the instruction sees a false-to-true
transition and the position is at 0, the data in the rst
element of the le are operated on. The position will
remain at 0 and the UL bit will be set. The EN bit
will follow the instruction’s condition.
• On the second false-to-true transition, the position
will index to 1, and data in the second word of the
le will be operated on.
• The UL bit controls whether the instruction will
operate just on data in the current position, or
whether it will index the position and then trans-
fer data. If the UL bit is reset, the instruction—on
a false-to-true transition of the instruction—will
operate on the data in the current position and set
the UL bit. If the UL bit is set, the instruction—on
a false-to-true transition of the instruction—will
index the position by 1 and operate on the data in
their new position.
Destination
• Is the fth entry and is the address at which the pro-
cessor stores the result of the operation.
• The instruction converts to the data type speci ed
by the destination address.
• It may be either a le address or an element address.
Expression
• Is the last entry and contains addresses, program
constants, and operators that specify the source of
data and the operations to be performed.
• The expression entered determines the function of
the FAL instruction.
• The expression may consist of le addresses, ele-
ment addresses, or a constant and may contain only
one function because the FAL instruction may per-
form only one function.
Figure 10-12 shows an example of a le-to- le copy
function using the FAL instruction. The operation of the
program can be summarized as follows:
• When input A goes true, data from the expression
le #N7:20 will be copied into the destination le
#N7:50.
• The length of the two les is set by the value en-
tered in the control element word R6:1.LEN.
• In this instruction, we have also used the ALL
mode, which means all of the data will be trans-
ferred in the rst scan in which the FAL instruction
sees a false-to-true transition.
• The DN bit will also come on in that scan unless an
error occurs in the transfer of data, in which case the
ER bit will be set, the instruction will stop operation
at that position, and then the scan will continue at
the next instruction.
Figure 10-12 File-to-fi le copy function using the FAL
instruction.
EN
DN
ER
FAL
FILE ARITH/LOGICAL
Control
Length
Position
Mode
Destination
Expression
R6:1
6
0
All
#N7:50
528
#N7:20
L1
A
Input
Ladder logic program
528
621
778
986
342
135
N7:20
File
N7:25
528
621
778
986
342
135
N7:50
Destination
#N7:50
Expression
#N7:20
N7:55
A
pet10882_ch10_200-225.indd 207pet10882_ch10_200-225.indd 207 7/27/10 10:45 PM7/27/10 10:45 PM