Page 227 - Programmable Logic Controllers, Fifth Edition - Mobile version
P. 227
10.1 Data Manipulation
Data manipulation instructions allow numerical data MOV MVM AND OR XOR NOT CLR
stored in the controller’s memory to be operated on
within the control program. It includes operations involv- Compare Compute/Math Move/Logical File/Misc
ing moving or transferring numeric information stored in
one memory word location to another word in a different Figure 10-2 Move/Logical menu tab.
location, and carrying out simple operations such as con-
verting from one data format to another.
The use of data manipulation extends a controller’s ca- can be placed in two broad categories: data transfer and
pability from that of simple on/off control based on bi- data comparison.
nary logic, to quantitative decision making involving data The manipulation of entire words is an important fea-
comparisons, arithmetic, and conversions—which in turn ture of a programmable controller. This feature enables
can be applied to analog and positioning control. PLCs to handle inputs and outputs containing multiple
There are two basic classes of instructions to accom- bit configurations such as analog inputs and outputs.
plish data manipulation: instructions that operate on word Arithmetic functions also require data within the pro-
data and those that operate on file, or block, data, which grammable controller to be handled in word or register
involve multiple words. format. To simplify the explanation of the various data
Each data manipulation instruction requires words of manipulation instructions available, the instruction proto-
data memory for operation. The words of data memory in col for the Allen-Bradley SLC 500 families of PLCs will
singular form may be referred to either as registers or as be used. Again, even though the format and instructions
words, depending on the manufacturer. The terms table or vary with each manufacturer, the concepts of data manip-
file are generally used when a consecutive group of related ulation remain the same.
data memory words is referenced. Figure 10-1 illustrates the Figure 10-2 shows the Move/Logical menu tab for the
difference between a word and a file. The data contained in SLC 500 PLC and its associated RSLogix software. The
files and words will be in the form of binary bits represented commands can be summarized as follows:
as series of 1s and 0s. A group of consecutive elements or
words in an Allen-Bradley SLC 500 are referred to as a file. MOV (Move)—Moves the source value to the
The data manipulation instructions allow the move- destination.
ment, manipulation, or storage of data in either single- or MVM (Masked Move)—Moves data from a source
multiple-word groups from one data memory area of the location to a selected portion of the destination.
PLC to another. Use of these PLC instructions in applica- AND (And)—Performs a bitwise AND operation.
tions that require the generation and manipulation of large OR (Or)—Performs a bitwise OR operation.
quantities of data greatly reduces the complexity and
quantity of the programming required. Data manipulation XOR (Exclusive Or)—Performs a bitwise XOR
operation.
NOT (Not)—Performs a bitwise NOT operation.
Section of CLR (Clear)—Sets all bits of a word to zero.
memory map
Binary bit
Word or
register 10.2 Data Transfer Operations
10 11 01 11 01 01 01 1 1
Data transfer instructions simply involve the trans-
fer of the contents from one word or register to another.
Figure 10-3a and b illustrate the concept of moving
1 0 0 1 1 0 0 1 1 0 1 1 1 1 0 1
1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 numerical binary data from one memory location to
File or 0 1 1 0 1 0 0 0 0 1 0 1 1 0 1 1 another. Figure 10-3a shows the original data are in reg-
table 1 1 1 0 1 0 1 1 1 1 0 1 1 0 0 0
1 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 ister N7:30 and N7:20. Figure 10-3b shows that after
0 0 0 1 1 0 1 1 1 1 0 1 0 1 1 1 the data transfer has occurred register N7:20 now holds
0 0 0 0 1 0 0 0 0 0 1 1 1 0 1 1 a duplicate of the information that is in register N7:30.
1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1
The previously existing data stored in register N7:20 have
been replaced with those of N7:30. This process is re-
Figure 10-1 Data files, words, and bits. ferred to as writing over the existing data.
208 Chapter 10 Data Manipulation Instructions
pet73842_ch10_207-233.indd 208 03/11/15 4:02 PM