Professional Documents
Culture Documents
EXPERIMENT NO 9
Data presentation
Experimental results
Conclusion
Date: Signature:
AIR UNIVERSITY, ISLAMABAD
DEPARTMENT OF ELECTRICAL & COMPUTER ENGINEERING
Electrical Measurements & Instruments Lab
Submitted by
Izza Jamal (191850)
Fall-21
BEEP V-B
DATE:13/12/21
EXPERIMENT.NO.09
ADVANCE PROGRAMMING
Objective:
To get familiar with the concept of shift registers,mov and arithematic operations.
Get to know about the implementation on the software.
Apparatus:
PLC Allen Bradley.
LogixPro software.
Introduction:
SHIFT REGISTERS:
The Shift Register (SR) instruction shifts data through a predefined number of BIT locations.
These BIT locations can be a range of BITs, a single Word or DWord, or a range of Words or
DWords. The instruction has three inputs. Data, Clock and Reset. The data input will load the
beginning bit with a ‘1’ if it is on or ‘0’ if it is not. The clock input is used to shift the data
through the shift register. In our example, we will be using the encoder on the conveyor to
track the reject container. So each pulse of the clock represents a distance on the conveyor. The
last input is the reset. It will place ‘0’ in all of the bits within the shift register.
Application Note:If you wish to move one word of data without affecting the math flags, use a
copy (COP) instruction with a length of 1 word instead of the MOV instruction.
S:1/15 is a bit in the status date file that is energized for exactly one PLC scan when the PLC is
placed in run mode.
It Can be used to condition the initialization of variables used elsewhere in the ladder logic.
ARITHMETIC INSTRUCTIONS
Math instructions, like data manipulation instructions, enable the programmable controller to
take on more of the qualities of a conventional computer.
Addition Instruction:
Most math instructions take two input values, perform the specifi ed arithmetic function, and
output the result to an assigned memory location. For example, the ADD instruction performs
the addition of two values stored in the referenced memory locations. How these values are
accessed depends on the controller. Figure shows ;
Subtraction Instruction:
The SUB (subtract) instruction is an output instruction that subtracts one value from another
and stores the result in the destination address. When rung conditions are true, the subtract
instruction subtracts source B from source A and stores the result in the destination.
Figure shows the SUB instruction used with the SLC 500 controllers. The operation of the logic
rung can be summarized as follows:
Multiplication Instruction:
The multiply (MUL) instruction is an output instruction that multiplies two values and stores the
result in the destination address. Figure shows the MUL instruction used with the SLC 500
controllers. The operation of the logic rung can be summarized as follows: • When input switch
SW is closed the rung will be true.
Division Instruction:
The divide (DIV) instruction divides the value in source A by the value in source B and stores the
result in the destination and math register. Figure 11-11 shows an example of the DIV
instruction.
Square Root:
The operation of the logic rung can be summarized as follows • When input switch SW is closed
the SQR instruction is executed. • The number whose square root we want to determine (144)
is placed in the source. • The function calculates the square root and places it (12) in the
destination. • If the value of the source is negative, the instruction will store the square root of
the absolute (positive) value of the source at the destination
Negate:
This math function changes the sign of the source value from positive to negative. The
operation of the logic rung can be summarized as follows: • When input switch SW is closed the
NEG instruction is executed. • The positive value 101 stored at the source address N7:52 is
negated to 2101 and stored in destination address N7:53. • Positive numbers will be stored in
straight binary format, and negative numbers will be stored as 2’s complement.
Lab Tasks
Lab Task No.1:
Turn On 2 LED’s alternatively after 1s using BSL and BSR.
4. LSB (O:2/0) of port O:2 moves after 1s towards MSB(O:2/15) and back from MSB towards.LSB and
Operation must continue in loop.User can choose the sequence by
Part:2
Lab Task No.3:
Implement 8-bit Calculator which can perform following function. (Hint Use TOD to convert
Result to BCD)
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Square root
6. Negate
Additon:
Subtraction:
Multiplication:
Division:
Negate:
Square-Root:
Conclusions:
This lab was about advance programming using shift registers, data movement instruction and
arithematic operations.Few above mentioned ,are the lab tasks that explains the concept very
well.We basically use the sequence data table to generate the input given to the mov command.