0% found this document useful (0 votes)
22 views42 pages

Chapter 2 Introduction To 8051

Chapter 2 provides an introduction to the 8051 microcontroller, detailing its architecture, memory organization, instruction set, and addressing modes. It highlights the historical development of the 8051, its features, and its applications, as well as comparisons with other microcontrollers like the PIC family. The chapter also discusses the microcontroller's operational basics, including memory management, clock connections, and reset operations.

Uploaded by

shimels chekole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views42 pages

Chapter 2 Introduction To 8051

Chapter 2 provides an introduction to the 8051 microcontroller, detailing its architecture, memory organization, instruction set, and addressing modes. It highlights the historical development of the 8051, its features, and its applications, as well as comparisons with other microcontrollers like the PIC family. The chapter also discusses the microcontroller's operational basics, including memory management, clock connections, and reset operations.

Uploaded by

shimels chekole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Chapter 2

Introduction to 8051 microcontrollers


Contents
• The 8051 microcontroller architecture
• Memory organization, Registers
• 8051 Instruction set
• 8051 Addressing mode
• Application area of 8051
• PIC microcontroller
General architecture of microcontroller
• A typical microcontroller consists of
– CPU from 4bit to 64 bit
– RAM for data storage
– ROM, EPROM or EEPROM or flash memory for
program storage
– Timers and counters
– Serial input and output ports
– ADC and DAC
– Clock
– Data bus
General architecture of microcontroller
Microcontroller basics
• First developed in 1970s by Intel as 4bit device
but after that many developments have taken
4 bit (2300 PMOS
Intel 4004 1971
trans, 108 kHz)
Intel 8048 8 bit 1976
Intel 8031 8 bit (ROM-less) .
Intel 8051 8 bit (Mask ROM) 1980
Microchip PIC16C64 8 bit 1985
Motorola 68HC11 8 bit (on chip ADC) .
Intel 80C196 16 bit 1982

Atmel AT89C51 8 bit (Flash memory) .

8 bit (Flash memory +


Microchip PIC 16F877 .
ADC)
A brief history of the 8051

In 1981, Intel Corporation introduced an 8-bit microcontroller


called the 8051. This microcontroller had 128 bytes of RAM, 4K
bytes of on-chip ROM, two timers, one serial port, and four
ports (each 8-bits wide) all on a single chip. At the time it was
also referred to as a “system on a chip.” The 8051 is an 8-bit
processor, meaning that the CPU can work on only 8 bits of
data at a time. Data larger than 8 bits has to be broken into 8-
bit pieces to be processed by the CPU. The 8051 has a total of
four I/O ports, each 8 bits wide. The 8051 can have a maximum
of 64K bytes
6
Basics 8051 Microcontroller Architecture
• The most famous type of microcontroller is 8051
• Architecture
– 3 system inputs
• Vcc power supply and ground
• Clock inputs (XTAL 1 and XTAL 2)
• Reset
– 3 control signals
• EA (External Access)
• PSEN (program store enable)
• ALE (Address latch enable)
– 4 ports
• Port 0, port 1, port 2 and port 3
• Each 8 bit is programmable for I/O
• Used to connect ADC, DAC, LED, 7 segment display etc
Block Diagram
External interrupts
On-chip Timer/Counter

Interrupt ROM for


On-chip Timer 1 Counter
Control program
RAM Timer 0 Inputs
code

CPU

Bus Serial
4 I/O Ports
OSC Control Port

P0 P1 P2 P3 TxD RxD
Address/Data
Microcontroller basics 8051 family
• The microcontroller usually referred as 8051
has many variants from different
manufacturers
Comparison of the 8051 Family Members

Feature 8051 8052 8031


ROM (program space in bytes) 4K 8K 0K
RAM (bytes) 128 256 128
Timers 2 3 2
I/O pins 32 32 32
Serial port 1 1 1
Interrupt sources 6 8 6
• Connection for standalone operation
• Pin configuration
– 8051 uc has 40 pins
– Is the functional assignment of pins of a
microcontroller
– Some pins are dedicated pins, i.e used for one
purpose and others are multiplexed (used for
multiple functions)
– It can be used as a 4 i/o port standalone processor
without external memory or can be used with 16
bit address line for external memory and 8 bit data
line for external data access
Microcontroller basics 8051
Microcontroller basics 8051
• Pin 1-8 is port 1: dedicated port with internal pull up resistors
and quasi-bidirectional
• Pin 9 is reset
• Pin 10-17 is port 3 and it also serves for other functions
– Receive, transmit, interrupt 1 and 2, timer 1 and 2, write enable and
read enable
– When used as port 3, it is quasi bidirectional and has internal pull up
resistor
• Pin 18 and 19 crystal oscillator connector for clock
• Pin 20 is Vss ground
• Pin 21-28 is port 2, quasi bidirectional port and higher order
address lines (A8-A15)
• Pin 29/30/31 are control lines
• Pin 31-39 is port 0 which is true bidirectional port and needs
external pull up resistors. It is also used as Address and data bus
for external memory interfacing
8051 Memory organization
• Memory organization
– 8051 as it is built on Harvard architecture, has two
memory blocks
• Program memory and data memory
– In program memory, 8051 has two options
• Use of internal memory with external memory
interfacing , in this case pin 31 is connected to Vcc
• Use of external memory only, for this case pin 31 is
connected to ground
• Total memory capacity of 8051 is 64kbyte with internal
memory of 4Kbyte
• Memory organization
– Data memory
• This is the area used to store data to be used in a program
• Has 128bye internal memory and is capable of interfacing
external memory
• The 128 byte internal memory is divided into three parts
– Register banks (bank #0,#1, #2, #3)
– Bit addressable area (used to store bit values such as status of
motors, LEDS etc )
– General purpose storage area
• Special function registers (80-FF0) is used for
– Instruction register
– Data pointer
– Stack pointer
– PSW, timers, IO ports, ACC and B registers
128 bytes of Internal RAM Structure

20
128 bytes of Internal RAM Structure

The lower 32 bytes are divided into 4 separate banks. Each register
bank has 8 registers of one byte each. A register bank is selected
depending upon two bank select bits in the PSW register. Next
16bytes are bit addressable. In total, 128bits (16X8) are available
in bit addressable area. Each bit can be accessed and modified by
suitable instructions. The bit addresses are from 00H (LSB of the
first byte in 20H) to 7FH (MSB of the last byte in 2FH).
Remaining 80bytes of RAM are available for general purpose.

21
The microprocessor performs primarily four operations:
I. Memory Read: Reads data (or instruction) from memory.
II. Memory Write: Writes data (or instruction) into memory.
III. I/O Read: Accepts data from input device.
IV. I/O Write: Sends data to output device.
The 8051 processor performs these functions using address bus,
data bus and control bus.

22
Microcontroller basics 8051
• Clock connection
– For 8051 microcontroller operation, one of the
external inputs needed is the clock.
– There are three variations for this
Microcontroller basics 8051
• A machine cycle in 8051 contains six states or
12 clock cycles
Microcontroller basics 8051
• Reset operation
– The other external input in 8051 is the reset input
– It is activated by making pin 9 high
– When reset occurs
• Program counter is cleared
• Register bank 0 is selected
• Stack pointer is initialized to 07H
• All ports are written with FFh
Microcontroller basics 8051
The basic setup of microcontroller

27
The basic setup of microcontroller

28
The basic setup of microcontroller (Contd.)
This is a module that has been prepared by us. You can see that a
40 pin base has been mounted on the PCB (printed circuit board)
instead of directly soldering the microcontroller to PCB which
maybe damaged while soldering.

29
The basic setup of microcontroller (Contd.)

Here a microcontroller AT89S52 has been shown which is a


member of 8051 family. The above circuit is valid for all the
members of 8051 family except the AT89S51. In AT89S51, we also
have to add pull up resistor at port zero for Input/ Output.
(Check the data sheet of AT89S51 microcontroller for the same)

30
8051 Microcontroller Instruction set
• Instruction set
– Has more than 110 instructions
– Can be grouped into 5 categories
– These are
• Arithmetic instructions
• Logical instructions
• Data transfer instructions
• Bit manipulation instructions
• Program branching and control
8051 INSTRUCTION SET
Arithmetic logical Data transfer Bit Program
manipulation control
ADD, ADDC, ANL,ORL, MOV, MOVX, CLR, SETB, CPL, ACALL, LCALL,
SUBB, INC, XRL,CLR,CPL,RL MOVC, PUSH, ANL, ORL, RET, RETI,
DEC, MUL, DIV, ,RLC,RR,RRC,S POP, XCH, MOV, JC, JNC, AJMP, LJMP,
DA WAP XCHD JB, JNB, JBC SJMP, JMP, JZ,
JNZ, CJNE,
DJNC, NOP
8051 Addressing modes
• An instruction consists of an op code and
operand

• Addressing mode is the way the operand is


specified in an instruction
Addressing modes
• Immediate addressing
– MOV A, #09h
– MOV 52H, #3Ah
• Direct addressing
– MOV A,03h
– MOV 24h, A
– MOV 7Ch, 0Fh
– PUSH 49h
– POP 22h
• Register addressing
– MOV A, R3
– MOV R1,A
• Indirect addressing
– Can be performed in four different ways
• Using R0 and R1 of each bank
• Using DPTR and Acc
• Using PC and ACC
• Using XCHD instruction
Addressing modes
• Indirect addressing
– MOV A, @R1
– MOVX @RO, A
– MOVX A, @DPTR
– MOVC A, @A+DPTR
– MOVC A, @A+PC
– XCHD A,@R1
Three criteria in Choosing a Microcontroller

1. Meeting the computing needs of the task efficiently and cost


effectively
• speed, the amount of ROM and RAM, the number of I/O
ports and timers, size, packaging, power consumption
• easy to upgrade
• cost per unit
2. Availability of software development tools
• assemblers, debuggers, C compilers, emulator, simulator,
technical support
3. Wide availability and reliable sources of the
microcontrollers.
Applications of 8051

Applications of 8051:

37
PIC microcontrollers
• Originally product of general instruments but latter
transferred to microchip
– PIC 1650 and 1655 8 bit microcontroller
– Faster speed, low cost, easier prototyping and simpler
chip set
• Basic features
– 8 bit microcontrollers
– Self contained (have internal program and data memory)
– Have single accumulator

PIC microcontroller family
• Basic families of PIC controller
PIC microcontrollers
• The most famous family of the PIC
microcontrollers is the 16 series/ family
• As a family, they have identical core and
instruction set
• However, they have different package sizes,
internal memory capacity, number of
peripheral devices etc

You might also like