8051 microcontroller Microcontroller _2024.pptx

rohithansaliya2 112 views 30 slides Apr 06, 2024
Slide 1
Slide 1 of 30
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30

About This Presentation

Microprocessor


Slide Content

8051 Microcontroller Dr. Tarun Chaudhary Assistant Professor ECE, NIT Jalandhar

The Microcontroller A microcontroller is a compact integrated circuit designed to govern a specific operation in embedded system . An Embedded system is a combination of a computer hardware and software designed for a specific function or functions. E.g. Mobile phone, AC, washing machine, microwave oven, ATM machine, medical devices and vending machines etc… Microcontrollers can be considered as self-contained systems with a processor, memory and I/O ports .

Technically called as Intel MCS-51 Architecture, the 8051-microcontroller series was developed by Intel in the year 1980 and were very popular in the 80’s (still are popular). 8051 Microcontroller has many features like Serial Communication, Timers, Interrupts, Harvard architecture and uses RISC. Even though 8051 Microcontroller might seem a little bit out of fashion, but it is one of the best platforms to get started with Microcontrollers, Embedded Systems and Programming (both C and Assembly). The AVR (Advanced virtual RISC) microcontroller developed by Atmel in 1996. Programmable interface controller (PIC) from Microchip Technology. Various licensed Advanced RISC Machines (ARM) microcontrollers. ARM7- The best in class Microcontroller for smartphone users.

Difference Between Microprocessor and Microcontroller MICROPROCESSOR MICROCONTROLLER Microprocessor assimilates the function of a central processing unit (CPU) on to a single integrated circuit (IC). Microcontroller can be considered as a small computer which has a processor and some other components in order to make it a computer. Microprocessors are mainly used in designing general purpose systems from small to large and complex systems like super computers. Microcontrollers are used in automatically controlled devices. Microprocessors are basic components of personal computers. Microcontrollers are generally used in embedded systems Computational capacity of microprocessor is very high. Hence can perform complex tasks. Less computational capacity when compared to microprocessors. Usually used for simpler tasks. A microprocessor based system can perform numerous tasks. A microcontroller based system can perform single or very few tasks. Microprocessors have integrated Math Coprocessor. Complex mathematical calculations which involve floating point can be performed with great ease. Microcontrollers do not have math coprocessors. They use software to perform floating point calculations which slows down the device. Generally microprocessors are not used in real time systems as they are severely dependent on several other components. Microcontrollers are used to handle real time tasks as they are single programmed, self sufficient and task oriented devices. The main task of microprocessor is to perform the instruction cycle repeatedly. This includes fetch, decode and execute. In addition to performing the tasks of fetch, decode and execute, a microcontroller also controls its environment based on the output of the instruction cycle. In order to build or design a system (computer), a microprocessor has to be connected externally to some other components like Memory (RAM and ROM) and Input / Output ports. The IC of a microcontroller has memory (both RAM and ROM) integrated on it along with some other components like I / O devices and timers. The overall cost of a system built using a microprocessor is high. This is because of the requirement of external components. Cost of a system built using a microcontroller is less as all the components are readily available. Generally power consumption and dissipation is high because of the external devices. Hence it requires external cooling system. Power consumption is less.

The clock frequency is very high usually in the order of Giga Hertz. Clock frequency is less usually in the order of Mega Hertz. Instruction throughput is given higher priority than interrupt latency. In contrast, microcontrollers are designed to optimize interrupt latency. Have few bit manipulation instructions Bit manipulation is powerful and widely used feature in microcontrollers. They have numerous bit manipulation instructions.

Architecture Von Neuman and Harvard: These two architecture are based on how memory is used in the system . RISC and CISC: The fundamental difference between the two is that RISC has less number of instructions, with each one capable of performing a single operation, while CISC has a large number of complex instructions capable of carrying out multiple internal operations. Von Neuman Harvard

Features od 8051 Microcontroller 8051 Microcontroller Features 8 – Bit ALU : ALU or Arithmetic Logic Unit is the heart of a microcontroller. It performs arithmetic and bitwise operation on binary numbers. The ALU in 8051 is an 8 – Bit ALU i.e. it can perform operations on 8 – bit data. 8 – Bit Accumulator : The Accumulator is an important register associated with the ALU. The accumulator in 8051 is an 8 – bit register. RAM : 8051 Microcontroller has 128 Bytes of RAM which includes SFRs and Input / Output Port Registers. ROM : 8051 has 4 KB of on-chip ROM (Program Memory). I/O Ports : 8051 has four 8 – bit Input / Output Ports which are bit addressable and bidirectional. Timers / Counters : 8051 has two 16 – bit Timers / Counters. Serial Port : 8051 supports full duplex UART Communication. External Memory : 8051Microcontroller can access two 16 – bit address line at once: one each for RAM and ROM. The total external memory that an 8051 Microcontroller can access for RAM and ROM is 64KB (2 16  for each type). Additional Features : Interrupts, on-chip oscillator, Boolean Processor, Power Down Mode, etc.

Pin configuration 8051 Microcontroller is available in a variety of IC Packaging Types. The most popular and commonly used 8051 Microcontroller Packaging is Dual in-line or DIP. It is often available as a 40 – pin PDIP or Plastic DIP IC. The other common packaging type is 44 – Lead PLCC (Plastic Leaded Chip Carrier). It is a kind of surface mount package. Another surface mount packaging for 8051 microcontroller is 44 – Lead TQFP (Thin Quad Flat Package). 8051 Microcontroller is available in a variety of packages like 40 – pin DIP or 44 – lead PLCC and TQFP. The pin orientation of an 8051 Microcontroller may change with the package but the Pin Configuration is same

The following image shows the 8051 Microcontroller Pin Diagram with respect to a 40 – pin Dual In-line Package (DIP). Since it is a 40 – pin DIP IC, each side contains 20 Pins. There are other packages of 8051also, like the 44 – Lead PLCC and the 44 – Lead TQFP. The following image shows the 8051 Microcontroller Pin Diagram for these packages specifically. 

8051 Microcontroller Pin Description The Pin Description or Pin Configuration of the 8051 Microcontroller will describe the functions of each pins of the 8051 Microcontroller. Let us now see the pin description. Pins 1 – 8 (PORT 1):  Pins 1 to 8 are the PORT 1 Pins of 8051. PORT 1 Pins consists of 8 – bit bidirectional Input / Output Port with internal pull – up resistors. In older 8051 Microcontrollers, PORT 1 doesn’t serve any additional purpose but just 8 – bit I/O PORT. In some of the newer 8051 Microcontrollers, few PORT 1 Pins have dual functions. P1.0 and P1.1 act as Timer 1 and Timer 2 Trigger Input respectively. P1.5, P1.6 and P1.7 act as In-System Programming Pins i.e. MOSI, MISO and SCK respectively.

Pin 9 (RST):  Pin 9 is the Reset Input Pin. It is an active HIGH Pin i.e. if the RST Pin is HIGH for a minimum of two machine cycles, the microcontroller will be reset. During this time, the oscillator must be running. Pins 10 – 17 (PORT 3):  Pins 10 to 17 form the PORT 3 pins of the 8051 Microcontroller. PORT 3 also acts as a bidirectional Input / Output PORT with internal pull-ups. Additionally, all the PORT 3 Pins have special functions. The following table gives the details of the additional functions of PORT 3 Pins.

Pins 18 & 19:  Pins 18 and 19 i.e. XTAL 2 and XTAL 1 are the pins for connecting external oscillator. Generally, a Quartz Crystal Oscillator is connected here. Pin 20 (GND):  Pin 20 is the Ground Pin of the 8051 Microcontroller. It represents 0V and is connected to the negative terminal (0V) of the Power Supply. Pins 21 – 28 (PORT 2):  These are the PORT 2 Pins of the 8051 Microcontroller. PORT 2 is also a Bidirectional Port i.e. all the PORT 2 pins act as Input or Output. Additionally, when external memory is interfaced, PORT 2 pins act as the higher order address byte. PORT 2 Pins have internal pull-ups. Pin 29 (PSEN):  Pin 29 is the Program Store Enable Pin (PSEN). Using this pins, external Program Memory can be read. Pin 30 (ALE/PROG):  Pin 30 is the Address Latch Enable Pin. Using this Pins, external address can be separated from data (as they are multiplexed by 8051). During Flash Programming, this pin acts as program pulse input (PROG). Pin 31 (EA/VPP):  Pin 31 is the External Access Enable Pin i.e. allows external Program Memory. Code from external program memory can be fetched only if this pin is LOW. For normal operations, this pins is pulled HIGH. During Flash Programming, this Pin receives 12V Programming Enable Voltage (VPP).

Pins 32 – 39 (PORT 0):  Pins 32 to 39 are PORT 0 Pins. They are also bidirectional Input / Output Pins but without any internal pull-ups. Hence, we need external pull-ups in order to use PORT 0 pins as I/O PORT. In addition to acting as I/O PORT,  PORT  0 also acts as lower order address/data bus when external memory is accessed. Pin 40 (VCC):  Pin 40 is the power supply pin to which the supply voltage is given (+5V).

8051 Microcontroller Basic Circuit Now that we have seen the 8051 Microcontroller Pin Diagram and corresponding Pin Description, we will proceed to the basic circuit or schematic of the 8051 Microcontroller. The following image shows the basic circuit of the 8051 Microcontroller.

This basic circuit of 8051 microcontroller is the minimal interface required for it to work. The basic circuit includes a Reset Circuit, the oscillator circuit and power supply. Let us discuss a little bit deeper about this basic circuit of 8051 Microcontroller. First is the power supply. Pins 40 and 20 (VCC and GND) of the 8051 Microcontroller are connected to +5V and GND respectively. Next is the Reset Circuit. A logic HIGH (+5V) on Reset Pin for a minimum of two machine cycles (24 clock cycles) will reset the 8051 Microcontroller. The reset circuit of the 8051 Microcontroller consists of a capacitor, a resistor and a push button and this type of reset circuit provides a Manual Reset Option. If you remove the push button, then the reset circuit becomes a Power-On Reset Circuit.

The next part of the basic circuit of the 8051 Microcontroller is the Oscillator Circuit or the Clock Circuit. A Quartz Crystal Oscillator is connected across XTAL1 and XTAL2 pins i.e. Pins 19 and 18. The capacitors C1 and C2 can be selected in the range of 20pF to 40pF. As mentioned in the 8051 Microcontroller Pin Description, PORTS 1, 2 and 3, all have internal pull – ups and hence can be directly used as Bidirectional I/O Ports. But, we need to add external Pull – ups for PORT 0 Pins in order to use it as an I/O Port. Generally, a 1KΩ Resistor Pack of 8 Resistors is used as a Pull – up for the PORT 0 of the 8051 Microcontroller.

Architecture of Intel’s 8051 microcontroller Features 8051 microcontroller is designed by Intel in 1981 The data width is 8 bits Registers are 8 bits 4kb of ROM storage and 128 bytes of RAM storage It consists of four parallel 8-bit ports, which are programmable as well as per the requirement. An on-chip crystal oscillator is integrated in the microcontroller having crystal frequency of 12MHz.

Bus: Bus is a group of wires which is used to transfer data. The buses comprise 8, 16 or more cables. There are two types of buses: Address Bus: Microcontroller 8051 consists of 16-bit address bus. Data Bus: Microcontroller 8051 comprise of 8 bit data bus. It is employed to cart data.

Register A accumulator : It is an 8 bit register. It holds a source operand and receives the result of the arithmetic instructions (Addition, Subtraction, Multiplication and Division). B registers : B register is used during multiply and divide operations which can be performed only upon numbers stored in the A and B registers. All other instructions in the program can use this register as a spare accumulator (A). 8-bit ALU:

Data Memory Data memory is often called as RAM, which a type of volatile memory. Program written into it will not be retained when power is down or the system is reset. Data memory is used to store temporary data, intermediate results. Program Memory It is usually implemented a ROM. Program written in to it will be retained even when the power is down or the system is reset. The instructions are stored in the program memory.

Oscillator: An on-chip crystal oscillator is integrated in the microcontroller having crystal frequency of 12 MHz. It provides time source for CPU (Central Processing Unit).

Need of Ports
Tags