MC Lab Manual
MC Lab Manual
Aim:
To write an Assembly Language Program for multi byte addition and execute the same using 8051
microcontroller kit
Component Required:
1. 8051 Microcontroller Kit - 1
2. Power Supply & Connecting wires - As required
Procedure:
● Switch ON the Power supply
● Follow the General procedures to operate the 8051 microcontroller kit
● Enter the corresponding opcodes of the instruction in the program
● Execute the program
● Verify the outputs from the microcontroller kit with manual calculations
Manual Calculation:
Let us take two 16 bit (2 byte) numbers and add it manually.
Addend 83 A0
Adder 3F 95
Added Result
Result:
The Multi byte addition program was entered in 8051 Microcontroller kit and output was verified with
manual calculations.
Expt. No.2 Multiplication & Division
Aim:
To write an Assembly Language Program for multiplication and division and execute the same using an
8051 microcontroller kit.
Component Required:
1. 8051 Microcontroller Kit - 1
2. Power Supply & Connecting wires - As required
Procedure:
● Switch ON the Power supply
● Follow the General procedures to operate the 8051 microcontroller kit
● Enter the corresponding opcodes of the instruction in the program
● Execute the program
● Verify the outputs from the microcontroller kit with manual calculations
Manual Calculation:
Let us take two 8 bit (2 bytes) numbers and multiply it manually.
5 X 4 = 20
5 - Multiplicand (8 bits)
4 - Multiplier (8 bits)
20 - Multiplied result (16 bits)
21 / 4 = 5
21 - Dividend
4 - Divisor
5 - Quotient
1 - Remainder
Multiplication Program:
Address Label Mnemonics Opcode Comments
B register
(Multiplier)
Multiplied Result
B register
(Divisor)
Division Result
Result:
Thus the Multiplication & Division program was entered in 8051 Microcontroller kit and output was
verified with manual calculations.
Expt. No.3 Sorting an Array in Ascending order
Aim:
To write an Assembly Language Program for sorting operation in ascending order for a given array of
data and execute the same using an 8051 microcontroller kit.
Component Required:
1. 8051 Microcontroller Kit - 1
2. Power Supply & Connecting wires - As required
Procedure:
● Switch ON the Power supply
● Follow the General procedures to operate the 8051 microcontroller kit
● Enter the corresponding opcodes of the instruction in the program
● Execute the program
● Verify the outputs from the microcontroller kit with manual calculations
Flowchart:
Start
Compare A & B
and Check for
NO
YE
POP the DPTR address from
STACK
Stop
Program:
Address Label Mnemonics Opcode Comments
MOV R1, A
DPTR ← 9200
MOV A,B
MOVX @DPTR, A
Inner Loop
DJNZ R0, AGAIN Decrement R0 and Jump if
non zero to AGAIN pointed
memory location
Outer Loop
Actual output
:
INPUT OUTPUT
9200 45 9200
9201 58 9201
9202 8A 9202
9203 12 9203
9204 93 9204
Result:
Thus the 8051 microcontroller program for ascending order sorting was entered in the microcontroller
kit and the output was tabulated and verified.
Expt. No.4 ASCII to Binary Conversion
Aim:
To write an Assembly Language Program for ASCII to Binary Conversion and execute the same using
an 8051 microcontroller kit
Component Required:
1. 8051 Microcontroller Kit - 1
2. Power Supply & Connecting wires - As required
Procedure:
● Switch ON the Power supply
● Follow the General procedures to operate the 8051 microcontroller kit
● Enter the corresponding opcodes of the instruction in the program
● Execute the program
● Verify the outputs from the microcontroller kit with manual calculations
ASCII to Binary Conversion
Flow chart
Start
NO
YE
CARR
Y?
NO
Clear CARRY
Flag
Clear CARRY
Flag
Increment DPTR
Stop
Program:
Address Label Mnemonics Opcode Comments
MOVX A, @DPTR A ← 45
CLRC CF ← 0
SUBB A, # 07 H A ← 3E
Actual output:
INPUT OUTPUT
9100 9101
Result:
Thus the 8051 microcontroller program for ASCII to Binary Conversion was entered in the kit and the
output was tabulated and verified.
Expt. No.5 Parity Bit Generator
Aim:
To write an Assembly Language Program for parity bit generation and execute the same using an 8051
microcontroller kit.
Component Required:
1. 8051 Microcontroller Kit - 1
2. Power Supply & Connecting wires - As required
Procedure:
● Switch ON the Power supply
● Follow the General procedures to operate the 8051 microcontroller kit
● Enter the corresponding opcodes of the instruction in the program
● Execute the program
● Verify the outputs from the microcontroller kit with manual calculations
Parity Bit [Even] Generation
Flow chart
Start
NO
CARRY
FLAG
YE
Increment register R1 by
1
Stop
Program:
Address Label Mnemonics Opcode Comments
MOV B, # 02 H B←2
Actual output:
INPUT OUTPUT
8500 8501
Result:
Thus the 8051 microcontroller program for parity bit generation was entered in the kit and the output
was tabulated and verified.