Data Manipulation and Math Instruction
Data Manipulation and Math Instruction
Math Instruction
Data Manipulation and
Math Instruction
Data Manipulation and Math Instruction
Data Manipulation involves transfer of data and operation on data with math
instruction, data conversion, data comparison, and logical operations.
3. Math Instructions
Data Manipulation Instruction
Each data manipulation instruction requires two or more words of data memory for
operation
Source is the address of the data you want to move. The source can be a constant.
Destination is the address that identifies where the data is to be moved.
Data Transfer Operation
MOVE/LOGICAL
2. MVM (Masked Move)
Moves the source location to selected portion of the destination
Sources A and B of the XOR instruction are Exclusive ORed bit by bit and stored in
the destination. Sources A and B can be either word addresses or constants;
however, both sources cannot be a constant.
Data Transfer Operation
MOVE/LOGICAL
6. NOT (Not)
Performs a NOT operation
The source of the NOT instruction is NOTed bit by bit and stored in the
destination.
The source and destination must be word addresses
Data Transfer Operation
MOVE/LOGICAL
7. CLR (Clear)
Sets all bits of a word to zero.
When rung conditions are true, this output instruction sets all the bits in a
word to zero. The destination must be a word address.
Data Manipulation Application
Changing the preset value of a timer using the move (MOV) instuction
Data Manipulation Application
Moving data using file instruction
Data Manipulation Application
SLC 500 word and file address
(a) Adrress N7:30 is a word address that represents a single word: word number 30 in integer
file 7
(b) Address #N7:30 represents the starting address of a group of conssecutive words in integer
file 7. The length shown is eight words, which is determained by the instruction where the
file address is used
Data Transfer Operation
FILE/MISK
1. COP (Copy)
Example file copy instruction
Data Transfer Operation
FILE/MISK
2. FLL
Example FLL instruction.
Data Transfer Application
Using the FFL instruction to change all the data in a file to zero
Data Transfer Operation
1. Batch Process
Consist of a sequence of one or more steps in a difined order.
Data Transfer Operation
5. FAL (file arithmatic and logic)
Example FAL instruction.
Data Transfer Operation
9. BTD (bit distribute)
Example BTD instruction.
Data Compare Instructions
Basic PLC data compare instructions
Data Compare Instructions
Compare menu tab
Data Compare Instructions
EQU logic rung
(Tests whether two values are equal)
Data Compare Instructions
NEQ logic rung
(Tests whether one values is not equal to a second value)
Data Compare Instructions
GRT logic rung
(Tests whether one values is greater than a second value)
Data Compare Instructions
LES logic rung
(Tests whether one values is less than a second value)
Data Compare Instructions
GEQ logic rung
(Tests whether one values is greater than or equal to a second value)
Data Compare Instructions
LEQ logic rung
(Tests whether one values is less than or equal to a second value)
Data Compare Instructions
LIM instruction where the low limit value is less then the high limit value
(Tests whether one values is within the limit range of two other value)
Data Compare Instructions
LIM instruction where the low limit value is greater then the high limit
value
(Tests whether one values is within the limit range of two other value)
Data Compare Instructions
Masked comparison for equal (MEQ) logic rung
(Tests portion of two values to see whether they are equal. Compare 16-bit data of a source
address to 16-bit data at a reference address thrugh mask)
Application of Data Compare Instructions
Timer program using the EQU instruction
Application of Data Compare Instructions
Counter program using the LES instruction
Math Instructions
Compute/Math menu tab
Math Instructions
CPT ( compute) instruction
(Evaluate an expression and stores the result in the destination)
Math Instructions
ADD instruction
(Adds source A to source B and stores the result in the destination)
Application of Math Instructions
Counter program that uses the ADD instruction
Math Instructions
SUB instruction
(Subtracts source B from source A and stores the result in the destination)
Math Instructions
Multiply instruction (MUL)
(Multiplies sourch A by source B and stores the result in the destination)
Application of Math Instructions
Multiply (MUL) instruction used to calculate the product of two sources
Math Instructions
Divide instruction (DIV)
(Divide sourch A by source B and stores the result in the destination and math register)
Application of Math Instructions
Divide (DIV) instruction used to calculate the value that result from dividing sources
A by sources B
Math Instructions
Square instruction (SQR)
(Calculates the square root of the source and places the integer result in the destination)
Math Instructions
Negate instruction (NEG)
(Changes the sign of the source and places it in destination)
Math Instructions
TOD (convert to BCD) instruction
(Converts a 16-bit integer source value to BCD and stores it in the math register or the destination)
Math Instructions
FRD (convert from BCD) instruction
(Converts a BCD value in the math register or the source to an integer and stores it in the destination)
Application of Data Manipulation
Instructions Set-point control program
Application of Math Instructions
Converting Celsius temperature to Fahrenheit
Application of Math Instructions
Vessel overfill alarm program
Application of Math Instructions
Temperature control program