UNIT - 1 Basics of Microcontroller & Intel 8051 Architecture
UNIT - 1 Basics of Microcontroller & Intel 8051 Architecture
Basics of Microcontroller
& Intel 8051 architecture
Dr. Pawar Bhalchandra B.
Architecture of 8051
The 8051 Architecture - specific features
The 8 bit CPU with Registers A (Accumulator) and B
As the CPU fetches the opcode from the program ROM, the
program counter is increasing to point to the next instruction.
The first 6 crystal pulses (clock cycle) is used to fetch the Opcode
and the second 6 pulses are used to perform the operation on the
operands in the ALU.
1.Working register:
Thirty-two bytes from address 00h to 1Fh that make up 32 working
register organized as Four bank of eight bit each.
Bits RS0 and RS1 in the PSW determine which bank of register is
currently Is use.
Bank 0 is selected upon reset
2.Bit addressable:
A bit addressable area of 16 bytes occupies RAM bytes addresses
20h to 2Fh,forming A total of 128 addressable bits.
An addressable bit may be specified by its bit address of 00h to
7Fh.
3.General purpose:
A general-purpose RAM area above the bit area,form 30h to
7Fh,addresable as bytes.
Internal RAM Organization
Serial I/O:
- SCON : Serial port control.
- SBUF : Serial data registers.
Other:
- PCON : Power control
Summary – SFR’s
Register Bit Primary Function Bit Addressable Register
A 8 Math, data manipulation Y A
B 8 Math Y B
PC 16 Addressing program bytes N PC
DPTR 16 Addressing code and external data N DPTR
SP 8 Addressing internal RAM stack data N SP
PSW 8 Processor status Y PSW
P0-P3 8 Store I/O port data Y P0-P3
TH0/TL0 8/8 Timer/counter 0 N TH0/TL0
TH1/TL1 8/8 Timer/counter 1 N TH1/TL1
TCON 8 Timer/counter control Y TCON
TMOD 8 Timer/counter control N TMOD
SBUF 8 Serial port data N SBUF
SCON 8 Serial port control Y SCON
PCON 8 Serial port control. user flags N PCON
IE 8 Interrupt enable control Y IE
IP 8 Interrupt priority control Y IP
8051 Microcontroller - PIN Diagram
I/O Ports
- Quasi-bidirectional:
Port
0
- Port 0 is a dual purpose port, it is located from pin 32 to pin 39
(8 pins).
- To use this port as both input/output ports each pin must be connected
externally to pull-up resistor.
- As an I/O port.
- Alternate functions:
As a multiplexed data bus.
8-bit instruction bus, strobed by PSEN.
Low byte of address bus, strobed by
ALE. 8-bit data bus, strobed by WR and
RD.
Port
1
- Port 1 is a dedicated I/O port from pin 1 to pin 8.
- Upon reset it is configured as outport.
- It is generally used for interfacing to external device
- thus if you need to connect to switches or LEDs, you could make use of
these 8 pins,
- but it doesn’t need any pull- up resistors as it is having internally
- As an I/O port: Standard quasi-bidirectional.
Port
2
- Like port 0, port 2 is a dual-purpose port.(Pins 21 through 28)
-It can be used for general I/O or as the high byte of the address bus for
designs with external code memory.
- Like P1 ,Port2 also doesn’t require any pull-up resistors
- As an I/O port:
Standard quasi-bidirectional.
- Alternate functions:
High byte of address bus for externalprogram and data
memory accesses.
Port
3
- Port 3 is also dual purpose but designers generally avoid using this
port unnecessarily for I/O because the pins have alternate functions
which are related to special features of the 8051.
- Indiscriminate use of these pins may interfere with the normal
operation of the 8051.
- As an I/O port:
Standard quasi-bidirectional.
- Alternate functions:
Serial I/O -
- T0, T1 Interrupts -
I/O Port structure