8051 Microcontroller Features and its Applications

Slides:



Advertisements
Similar presentations
Autumn 2012C.-S. Shieh, EC, KUAS, Taiwan1 The 8051 Family Microcontroller Chin-Shiuh Shieh Department of Electronic Engineering.
Advertisements

Chapter Microcontroller Objectives  Understand the 8051 Architecture  Use SFR in C  Use I/O ports in C.
Chapter 2 HARDWARE SUMMARY
8051 Core Specification.
Microcontroller 8051.
INTERRUPTS PROGRAMMING
The 8051 Microcontroller architecture
Microcontroller 8051.
ECE/CS-352: Embedded Microcontroller Systems Embedded Microcontroller Systems.
Microcontroller Intel 8051 [Architecture]. The Microcontroller Microcontrollers can be considered as self-contained systems with a processor, memory and.
CoE3DJ4 Digital Systems Design Hardware summary. Microprocessors vs. Microcontrollers Microprocessors are single-chip CPU used in microcomputers Microcontrollers.
Lecture Set 9 MCS-51 Serial Port.
1. Registers Used in Timer/Counter  TH0, TL0, TH1, TL1  TMOD (Timer mode register)  TCON (Timer control register) 2.
8051 Micro controller. Architecture of 8051 Features of 8051.
Microcontrollers Class : 4th Semister E&C and EEE Subject Code: 06ES42
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
Presented by Sadhish Prabhu
8051 Micro Controller. Microcontroller versus general-purpose microprocessor.
Kustanto,S.T.,M.EngECE/CS-352: Embedded Microcontroller Systems Embedded Systems By: Kustanto,S.T.,M.Eng.
HOME AUTOMATION USING PC DONE BY RAJESHKUMAR S SRI HARSHA D.
Prepared by:- Man Mohan Krishna ECE  Advance technology  Establishment 1999  Location chandigarh  Working area  Products  Key area of training.
Timer Programming in Assembly and C Prepared By:
HJD Institute of Technical Education & Research- Kera(Kutch) The 8051 Microcontroller architecture PREPARED BY: RAYMA SOHIL( )
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Introduction to Microcontroller Technology
Unit Microprocessor.
Serial I/O Port.
Embedded Microcontroller Systems
The 8051 Microcontroller architecture
Microcontroller.
COURSE OUTCOMES OF Microprocessor and programming
8051 Pin - out PORT 0 PORT 1 PORT 2 PORT 3.
Embedded Microcontroller Systems
UNIT – Microcontroller.
8051 Timers Timers are the peripherals of the 8051 Microcontroller.
8086 Microprocessor.
SERIAL PORT PROGRAMMING
Introduction of microprocessor
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Introduction to Micro Controllers & Embedded System Design Interrupt
UNIT 5 TIMRERS/COUNTERS
Introduction to Micro Controllers & Embedded System Design I/O Processing and Serial Port Operation Department of Electrical & Computer Engineering Missouri.
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Data bus CPU General Purpose microprocessor RAM ROM I/O Port Timer
Microcontroller Intel 8051
* * * * * * * 8051 Interrupts Programming.
Introduction to Microprocessors and Microcontrollers
Source: Serial Port Source:
8051 Timers Prof. Rajiv R Bhandari.
Interrupt.
Introduction to Micro Controllers & Embedded System Design Timer Operation Department of Electrical & Computer Engineering Missouri University of Science.
8051 Timers / Counters It has two timers Timer 0 and Timer 1.
The 8051 Microcontroller (8 bit )
8051 Microcontroller.
Interrupt Source: under
First Design Key board R L S.
Interrupt.
Important 8051 Features On chip oscillator 4K bytes ROM 128 bytes RAM
UNIT-VIII 8051 Microcontroller Architecture Register set of 8051
JANAKIRAMAN E G S PILLAY ARTS AND SCIENCE COLLAGE NAGAPATTINAM DEPARTMENT OF PHYSICS.
Interrupt Source: under
INTRODUCTION TO 8051, A 8-BIT MICROCONTROLLER
8051 Micro Controller.
The 8051 Microcontroller (8 bit )
Source: Serial Port Source:
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
Compiled by Dr. N.Shanmugasundaram, HOD, ECE Dept, SECE.
Source: Serial Port Source:
Presentation transcript:

8051 Microcontroller Features and its Applications By: Prof. Rajiv R Bhandari

CONTENTS Microcontrollers Applications Of Microcontrollers Microprocessor Vs Microcontrollers History Of 8051 Microcontroller Features Of Microcontroller Block Diagram And Pin Description Of 8051 Registers Memory Mapping In 8051 Timers And Counters Serial Communication Interrupts Applications Of 8051 Microcontroller

Microcontrollers A single chip Microcontrollers are small computing systems on a single chip. A microcontroller will also be referred to as an MCU. Central Processing Unit (CPU) Program memory Random Access Memory (RAM) EEPROM - Electrically Erasable Programmable Read Only Memory USARTs, Timer/Counters, ADC, DAC, I/O Ports, CANs, SPIs, etc. Examples : Motorola’s 6811,Intel’s 8051,Zilog’s Z8 and PIC 16X. CPU RAM ROM A single chip Serial Port I/O Port Timer

Applications Of Microcontrollers Cell phone Pager Watch Calculator Video Games Alarm clock Air Conditioner TV remote Microwave Oven Washing Machines An Electronic Smart Weight Display System Robotic System An Anti-Lock Braking System Monitor

Applications cont’d

Microprocessor vs Microcontroller CPU is stand-alone, RAM, ROM, I/O, timer are separate Designer can decide on the amount of ROM, RAM and I/O ports. Expansive Versatility General-purpose Microcontroller CPU, RAM, ROM, I/O and timer are all on a single chip Fix amount of on-chip ROM, RAM, I/O ports Highly bit addressable For applications in which cost, power and space are Critical Single-purpose

History of 8051 Microcontroller In the year 1980 Intel corporation introduced an 8 bit microcontroller called 8051. It has 4K bytes of ROM,128 Bytes of RAM , a serial port, two 16-bit Timers and 32 I/O pins. CPU can work with 8 bit of data at a time. Data larger than 8 bit can be broken into 8 bit pieces to be processed by the CPU

Important Features of 8051 4K bytes ROM 128 bytes RAM Four 8-bit I/O ports Two 8/16 bit timers Serial port 64K external code memory space 64K data memory space Multiple internal and external interrupt sources

Architecture of 8051 Microcontroller Oscillator and timing 4096 Bytes Program Memory (ROM) 128 Bytes Data Memory (RAM) Two 16 Bit Timer/Event Counters Internal data bus 8051 CPU Programmable I/O Programmable Serial Port Full Duplex UART Synchronous Shifter 64 K Byte Bus Expansion Control subsystem interrupts Parallel ports Address Data Bus I/O pins Control Serial Output External interrupts Serial Input

8051 CPU Registers A (8-bit Accumulator) B (8-bit register for Mul &Div) PSW (8-bit Program Status Word) SP (8-bit Stack Pointer) PC (16-bit Program Counter) DPTR (16-bit Data Pointer)

Flag Register Flags are 1-bit registers provided to store the results of certain program instructions Other instructions can test the condition of the flags and make decisions based on the flag states Flags are grouped inside the Program Status Word (PSW) and the Power Control (PCON) registers for convenient addressing Math Flags: respond automatically to the outcomes of math operations (CY, AC, OV, P) PSW contains the register select bits (RS1, RS0) that identify which of the four general-purpose register banks is currently in use by the program

7 6 5 4 3 2 1 CY AC F0 RS1 RS0 OV -- P Bit Symbol Function 7 CY CY AC F0 RS1 RS0 OV -- P Bit Symbol Function 7 CY Carry Flag; used in arithmetic, JUMP, ROTATE, and BOOLEAN instruction 6 AC Auxiliary carry flag; used for BCD arithmetic 5 F0 User flag 0 4 RS1 Register bank select bit 1 3 RS0 Register bank select bit 0 2 OV Overflow flag; used in arithmetic instructions 1 -- Reserved for future use P Parity flag; shows parity of register A: 1 = Odd Parity

Pin Description of 8051 The 8051 is a 40 pin device, but out of these 40 pins, 32 are used for I/O. 24 of these are dual purpose, i.e. they can operate as I/O or a control line or as part of address or data bus.

List of registers

List of registers contd..

Internal Memory 8051 has internal RAM (128 bytes) and ROM (4Kbytes) A functioning computer must have memory for program code bytes, commonly in ROM, and RAM memory for variable data that can be altered as the program runs 8051 has internal RAM (128 bytes) and ROM (4Kbytes) 8051 uses the same address but in different memories for code and data Internal circuitry access the correct memory based on the nature of the operation in progress Can add memory externally if needed

8051 Internal RAM Organisation 07 06 05 04 03 02 01 00 0F 0E 0D 0C 0B 0A 09 08 17 16 15 14 13 12 11 10 1F 1E 1D 1C 1B 1A 19 18 Bank 0 Bank 1 Bank 2 Bank 3 27 26 25 24 23 22 21 20 2F 2E 2D 2C 2B 2A 29 28 7F 78 77 70 6F 68 67 60 5F 58 57 50 4F 48 47 40 3F 38 37 30 2F 28 27 20 1F 18 17 10 0F 08 07 00 30 7F Working Registers Bit Addressable General Purpose

Program Status Word (PSW) Bank Select Bits, RS1, & RS0 to select 1 of 4 register bank

Special Function Registers (SFR) 8051 has 21 SFRs which occupy the addresses from 80H to FFH (128bytes) Not all of the addresses from 80H to FFH are used for SFRs Attempt to use the “empty” addresses may get unpredictable result

Special Function Register Map Bit addressable

Value of SFR at Reset

Internal ROM Internal ROM occupies the code address space from 0000H to 0FFFH (Size = 4K byte) Program addresses higher than 0FFFH will automatically fetch code bytes from external program memory Code bytes can also be fetched exclusively from an external memory by connecting the external access pin (EA) to ground

Timers /Counters The 8051 has 2 timers/counters: Timer/Counter 0 Used as a time delay generator. Many microcontroller application requires the counting of external events such as frequency, time delay.

Registers Used in Timer/Counter 8051 has two 16-bit Timer registers ,Timer 0 & Timer 1. As 8051 has 8-bit architecture , each Timer register is treated as two 8-bit registers namely TH0, TL0, TH1, TL1. One 8-bit mode register -TMOD. One 8-bit control register-TCON.

Timer Set the initial value of registers Start the timer and then the 8051 counts up. Input from internal system clock (machine cycle) When the registers equal to 0 and the 8051 sets a bit to denote time out 8051 P2 P1 to LCD Set Timer 0 TH0 TL0

Counter Count the number of events Show the number of events on registers External input from T0 input pin (P3.4) for Counter 0 External input from T1 input pin (P3.5) for Counter 1 External input from Tx input pin. We use Tx to denote T0 or T1. 8051 TH0 P1 to LCD TL0 P3.4 a switch T0

TMOD Register GATE C/T M1 M0 Timer 1 Timer 0 (MSB) (LSB) Both Timer 0 &Timer 1 use the Same Mode register TMOD. It is an-8-bit register . The lower 4-bits are meant for Timer 0 &the upper 4-bits are meant for Timer 1 It is used similar to any other register of 8051 .

Set for counter operation (input from Tx input pin). TMod contd…. C/T : Timer or counter selected cleared for timer operation (input from internal system clock). Set for counter operation (input from Tx input pin). M1,M0 : Used for mode selection. Because the Timers of 8051 can be set in 4-different modes. M1 M0 Mode Operation 0 0 0 13-bit timer mode 8-bit THx + 5-bit TLx 0 1 1 16-bit timer mode 8-bit THx + 8-bit TLx 1 0 2 8-bit auto reload THx holds a value which is to be reloaded into TLx each time it overflows. 1 1 3 Split timer mode

Gate Every timer has a mean of Starting and Stopping. GATE=0 Internal control The start and stop of the timer are controlled by way of software. GATE=1 External control The hardware way of starting and stopping the timer by software and an external source. Timer/counter is enabled only while the INT pin is high and the TR control pin is set (TR).

TCON Register Timer control register TMOD is a 8-bit register which is bit addressable and in which Upper nibble is for timer/counter, lower nibble is for interrupts

Tcon contd… TR (Timer run control bit) TR0 for Timer/counter 0; TR1 for Timer/counter 1. TR is set by programmer to turn timer/counter on/off. TR=0 : off (stop) TR=1 : on (start) TF (timer flag, control flag) TF0 for timer/counter 0; TF1 for timer/counter 1. TF is like a carry. Originally, TF=0. When TH-TL roll over to 0000 from FFFFH, the TF is set to 1. TF=0 : not reach TF=1: reach If we enable interrupt, TF=1 will trigger ISR.

8051- SERIAL COMMUNICATION

RxD and TxD pins in the 8051 The 8051 has two pins for transferring and receiving data by serial communication. These two pins are part of the Port3(P3.0 &P3.1) These pins are TTL compatible and hence they require a line driver to make them RS232 compatible Max232 chip is one such line driver in use. Serial communication is controlled by an 8-bit register called SCON register, it is a bit addressable register.

SCON (Serial control) register

SM0 , SM1 These two bits of SCON register determine the framing of data by specifying the number of bits per character and start bit and stop bits. There are 4 serial modes. SM0 SM1 0 0 Serial Mode 0 0 1 Serial Mode 1, 8 bit data, 1 stop bit, 1 start bit 1 0 Serial Mode 2 1 1 Serial Mode 3

REN, TI, RI REN (Receive Enable) also referred as SCON.4. When it is high, it allows the 8051 to receive data on the RxD pin. So to receive and transfer data REN must be set to 1. When REN=0,the receiver is disabled.

TI,RI Contd… TI (Transmit interrupt) It is the D1 bit of SCON register. When 8051 finishes the transfer of 8-bit character, it raises the TI flag to indicate that it is ready to transfer another byte. The TI bit is raised at the beginning of the stop bit. RI (Receive interrupt) It is the D0 bit of the SCON register. When the 8051 receives data serially ,via RxD, it gets rid of the start and stop bits and places the byte in the SBUF register. Then it raises the RI flag bit to indicate that a byte has been received and should be picked up before it is lost. RI is raised halfway through the stop bit.

Interrupt Sources 8051 has 6 sources of interrupts Reset Timer 0 overflow Timer 1 overflow External Interrupt 0 External Interrupt 1 Serial Port events (buffer full, buffer empty, etc)

Interrupt Enable Register Upon reset all Interrupts are disabled and do not respond to the Microcontroller These interrupts must be enabled by software in order for the Microcontroller to respond to them. This is done by an 8-bit register called Interrupt Enable Register (IE).

EA : Global enable/disable. --- : Undefined. ET2 : Enable Timer 2 interrupt. ES : Enable Serial port interrupt. ET1 : Enable Timer 1 interrupt. EX1 : Enable External 1 interrupt. ET0 : Enable Timer 0 interrupt. EX0 : Enable External 0 interrupt.

Interrupt Priorities If two interrupt sources interrupt at the same time ,the interrupt with the highest PRIORITY gets serviced first. All interrupts have a power on default priority order. External interrupt 0 (INT0) Timer interrupt0 (TF0) External interrupt 1 (INT1) Timer interrupt1 (TF1) Serial communication (RI+TI) Priority can also be set to “high” or “low” by IP reg.

Interrupt Priorities (IP) Register --- PX0 PT0 PX1 PT1 PS PT2 IP.7: reserved IP.6: reserved IP.5: Timer 2 interrupt priority bit (8052 only) IP.4: Serial port interrupt priority bit IP.3: Timer 1 interrupt priority bit IP.2: External interrupt 1 priority bit IP.1: Timer 0 interrupt priority bit IP.0: External interrupt 0 priority bit

Interrupt inside an interrupt --- PX0 PT0 PX1 PT1 PS PT2 A high-priority interrupt can interrupt a low-priority interrupt All interrupt are latched internally Low-priority interrupt wait until 8051 has finished servicing the high-priority interrupt

Applications of 8051 microcontroller Embedded system Industrial Computer networking Power input to the 8051 is very simple and straight forward. 8051 could be used in low-power applications.

Applications cont’d The 8051 has been in use in a wide number of devices, mainly because it is easy to integrate into a project or build a device around. Energy Management: Efficient metering systems help in controlling energy usage in homes and industrial applications. These metering systems are made capable by incorporating microcontrollers.

Applications cont’d Touch screens: Automobiles: A high number of microcontroller providers incorporate touch-sensing capabilities in their designs. Portable electronics such as cell phones, media players and gaming devices are examples of microcontroller-based touch screens. Automobiles: The 8051 finds wide acceptance in providing automobile solutions. They are widely used in hybrid vehicles to manage engine variants. Functions such as cruise control and anti-brake system have been made more efficient with the use of microcontrollers.

Applications cont’d Medical Devices: Portable medical devices such as blood pressure and glucose monitors use microcontrollers will to display data, thus providing higher reliability in providing medical results.

Thank you