Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Course Name: Microprocessors and Microcontrollers Lab

Course Code: BECE204P

Dr Vishal Gupta
Assistant Professor
School of Electronics Engineering
Vellore Institute of Technology, Vellore, Tamil Nadu, India

1
Lab Notebook
Course Name: Microcontroller and Microprocessor
Course Code: BECE204P

Name: - SHERIFF SINGH

Register Number: - 22BCE0161

Slot: - L45+L46

2
Lab Record
➢ Aim
➢ Tool Required
➢ Relevant Theory or Diagram if require
➢ Assembly language program (ALP) Code
➢ Output{Screen Shot}(Result)
➢ Conclusion

3
Lab Assessment - 3

1. Write an assembly language program for 8051 Microcontroller to implement the


Half Adder circuit using KEIL development tool.
Ans.)
Aim:
To implement the Half Adder circuit using 8051 Microcontroller.

Tool Required:
KEIL development tool
8051 Microcontroller development board or simulator

Relevant Theory:
A half adder is a digital circuit that performs addition of two binary numbers. It
4
has two inputs (A and B) and two outputs: Sum (S) and Carry (C). The truth table
for a half adder is as follows:
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

Code: -
ORG 0000H
SETB ACC.0
SETB ACC.1
MOV C,ACC.1
CPL C
ANL C,ACC.0
5
MOV ACC.2, C
MOV ACC.0, C
CPL C
ANL C, ACC.1
ORL C,ACC.2
MOV ACC.3, C
MOV C, ACC.0
ANL C,ACC.1

Output: -

6
7
Conclusion:
The desired output is derived

2. Write an assembly language program for 8051 Microcontroller to implement the


following gates using KEIL development tool:
(a) XOR gate with the help of NOR Gate.
(b) XNOR gate with the help of NAND Gate
Ans.)
Aim:
To implement XOR gate using NOR gate and XNOR gate using NAND gate on
8051 Microcontroller.

Tool Required:
• KEIL development tool
8
• 8051 Microcontroller development board or simulator’

Relevant Theory:

(a) XOR Gate using NOR Gate: XOR gate gives a high output (1) when the
number of high inputs is odd.
Code: -
ORG 0000H
SETB ACC.0 ; INPUT X
SETB ACC.1; INPUT Y
MOV C, ACC.0
ORL C,ACC.0
CPL C
MOV ACC.2,C
MOV C,ACC.1
ORL C,ACC.1
9
CPL C
ORL C, ACC.2
CPL C
MOV ACC.3,C
MOV C,ACC.0
ORL C,ACC.1
CPL C
ORL C,ACC.3
CPL C
MOV ACC.3,C ; OUTPUT Q

Output: -

1
(b) XNOR Gate using NAND Gate: XNOR gate gives a high output (1) when
the number of high inputs is even.
1
Code: -
ORG 0000H
SETB ACC.0 ; INPUT X
SETB ACC.1; INPUT Y
MOV C,ACC.0
ANL C,ACC.1
CPL C
MOV ACC.2,C
MOV ACC.3,C
MOV C,ACC.0
ANL C,ACC.2
CPL C
MOV ACC.4,C
MOV C, ACC.1
ANL C,ACC.3
CPL C
1
ANL C, ACC.4
CPL C
MOV ACC.5,C
ANL C,ACC.5
CPL C
MOV ACC.6,C ; OUTPUT Q

Output: -

1
Conclusion:
The desired output is derived
1

You might also like