0% found this document useful (0 votes)
9 views6 pages

8051 Microcontroller Overview and Code

The document discusses the 8051 microcontroller. It describes the 8051's specifications including its 40-pin DIP package, 4KB ROM, 128 bytes RAM, and four 8-bit I/O ports. It also details the pin configurations including ports 0-2, reset, crystal, and address/data pins. The document includes code to take a user input and print its multiplication table up to 10 times using loops and arithmetic operations.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

8051 Microcontroller Overview and Code

The document discusses the 8051 microcontroller. It describes the 8051's specifications including its 40-pin DIP package, 4KB ROM, 128 bytes RAM, and four 8-bit I/O ports. It also details the pin configurations including ports 0-2, reset, crystal, and address/data pins. The document includes code to take a user input and print its multiplication table up to 10 times using loops and arithmetic operations.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Microprocessor And

Microcontroller
Report#4

Name : Usman Dastagir Submitted to : Abdul Qadeer


Roll no : 180532 Department of electrical
Class : BEEP(5-B) engineering
Contents
“8051 Micro Controller” .......................................................................................................................... 2
Objectives: .......................................................................................................................................... 2
Introduction: ....................................................................................................................................... 2
Pin Configuration: ................................................................................................................................ 3
Write a code to print the table of the number entered by a user? ....................................................... 3
Conclusion: .......................................................................................................................................... 5
“8051 Micro Controller”
Objectives:
 To get familiar with 8051 micro controller architechture.

Introduction:
8051 microcontroller is designed by Intel in 1981. It is an 8-bit microcontroller. It has following
specifications:

 It is built with 40 pins DIP (dual inline package).


 4kb of ROM storage and 128 bytes of RAM storage.
 Two 16-bit timers.
 It consists of four parallel 8-bit ports, which are programmable as well as addressable as per the
requirement.
 An on-chip crystal oscillator is integrated in the microcontroller having crystal frequency of 12
MHz.

The system bus consists of an 8-bit data bus, a 16-bit address bus and bus control signals. All other devices
like program memory, ports, data memory, serial interface, interrupt control, timers, and the CPU are all
interfaced together through the system bus.
Pin Configuration:
 Pins 1 to 8: These pins are known as Port 1.
This port doesn’t serve any other functions. It
is internally pulled up, bi-directional I/O port.
 Pin 9: It is a RESET pin, which is used to reset
the microcontroller to its initial values.
 Pins 18 & 19: These pins are used for
interfacing an external crystal to get the
system clock.
 Pin 20: This pin provides ground to the power
supply of the circuit.
 Pins 21 to 28: These pins are known as Port 2.
It serves as I/O port. Higher order address bus
signals are also multiplexed using this port.
 Pin 29 (Active Low): This is PSEN pin which
stands for Program Store Enable. It is used to
read a signal from the external program
memory.
 Pin 30 (Active High): This is ALE pin which
stands for Address Latch Enable. It is used to
demultiplex the address-data signal of port.
 Pin 31: This is EA pin which stands for External
Access input. It is used to enable/disable the
external memory interfacing.
 Pins 32 to 39: These pins are known as Port 0. It serves as I/O port. Lower order address and data
bus signals are multiplexed using this port.
 Pin 40: This pin is used to provide power supply to the circuit.

Write a code to print the table of the number entered by a user?


 CODE:
.model small
.stack 100h mov ah,1; taking input from the user
.data int 21h
a db ? ; in this variable we will store which table mov a,al;storing the input in predifiened
to print and use it in the code variable
b db ? ; b is used to store 1 and then will
incremented to 10 in code mov dl,0ah; giving command to go on new line
ab db,'Table of $' mov ah,2
.code int 21h
.startup
mov b,1; giving 1 to predefined that will be used
lea dx,ab; displaying message using string in table
mov ah,9 mov cx,10; tell how many times loop will run
int 21h
L1:
cmp cx,1; this command is only used to jump od:; this full loop is used only when 10th
compiler to od when 10 multiplication will occur multiplication will occur
je od mov dl,a
mov dl,a; displaying first number of which table mov ah,2
is int 21h
mov ah,2
int 21h mov dl,'*'
mov ah,2
mov dl,'*' int 21h
mov ah,2
int 21h mov dl,1
add dl,48
mov dl,b mov ah,2
add dl,48 int 21h
mov ah,2
int 21h mov dl,0
add dl,48
mov dl,'=' mov ah,2
mov ah,2 int 21h
int 21h
mov dl,'='
mov al,b;transfering b into al for multiplication mov ah,2
mov dl,a int 21h
sub dl,48;converting a to actual value in acsii mov al,b
mul dl mov dl,a
AAM; this command is used to display 2 digit sub dl,48
number in decimal mul dl
mov dl,ah AAM
mov bl,al mov dl,ah
add dl,48 mov bl,al
mov ah,2 add dl,48
int 21h mov ah,2
int 21h
mov dl,bl
add dl,48 mov dl,bl
mov ah,2 add dl,48
int 21h mov ah,2
int 21h
inc b ;incrementing 1 at a time in b
mov dl,0ah; giving command to go on new line
mov dl,0ah; giving command to go on new line mov ah,2
mov ah,2 int 21h
int 21h
.exit
loop L1 end
 OUTPUT:
Conclusion:
 Learnt about the architecture of 8051 microprocessor.
 Learnt about the registers used in 8051 microprocessor.
 Learnt about the pin configuration of 8051 microprocessor.
 Also made the code to display the table of any number.

You might also like