CHAPTER1.pptx ON 8051 MICROCONTROLLER INTRODUCTION CHAPTER

NagarathnaRajur2 17 views 43 slides Sep 30, 2024
Slide 1
Slide 1 of 43
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
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43

About This Presentation

EWRWERRRRRRRRRRRRRRRRRRRRRRRRDSFFFFFFFFFFFFFFFFFFFFFF


Slide Content

MICROCONTROLLER 8051

OUTLINE What is microcontroller? What are different types of microcontroller? How to select controller for a given application? 8051 internal architecture 8051 pinout & pin description 8051 architecture details 8051 assembly programming 8051 addressing modes 8051 Timer,Interrupt,serial port programming

Intruduction Microprocessor = CPU on a single chip. ALU + registers + control +… Micro-computer = small computer uP + I/O + memory + peripheral + … Microcontroller (uC) u-Computer on a single chip of silicon

A Microprocessor System Contains the same 6 basic components: Arithmetic logic unit (ALU) Register array Control unit Memory Input unit Output unit Basic Microprocessor Systems

MICROPROCESSOR Microprocessor: a CPU on a single integrated chip (IC) a special type of CPU The brain of a computer E.g.: – 8086, 80286, 80386, 80486, Pentium, Core 2 Duo, Core 2 Quad, K5, K6, Atholon, Atholon 64, Opteron, Phenon, PowerPC G4, PowerPC G5, Xenon, Broadway, Cell, … Contains no RAM, no ROM, no I/O ports on chip.

Microcontrollers CPU ROM RAM I/O A single chip Subsystems: Timers, Counters, Analog Interfaces, I/O interfaces Memory

Microcontroller : A microprocessor, and RAM, ROM, I/O ports, and timer on a single chip. Also called MCU, , uC “Computer on a chip” Also called MCU (MicroController Unit) Usually not as powerful as general purpose microprocessor Low power consumption, small in size, low cost. A lot of MCUs are application specific (as against the general purpose microprocessor).μ C

Difference between µP and µC Sr. No µ P µ C 1 Several Instructions for moving Data from ext. memory to CPU. One or two instructions for moving the data from ext memory to CPU. 2 In µ P few pins are multi functioned. In µ C large number of pins are m ulti functioned. 3 Designer can decide on the amount of ROM, RAM and I/O ports. Fixed program and data memory. 4 Uses different ICs for memory and I/O Inbuilt Memory and I/O. 5 No Inbuilt timer. Inbuilt timer is there.

uCs Many uCs are existing right now. 8051, 68HC11, MSP430, ARM series, and etc. We may widely divide it with how it is designed (RISC/CISC architecture) Manufacturer (Atmel, Intel, Microchip, Philips,…) ROM technology (Programming Serial/Parallel) RAM/ROM capacity Other features (ADC/DAC, WatchDog, timer/counter, Number of IO pin…

Common Microcontrollers Atmel ARM Intel 8-bit 8XC42 MCS48 MCS51 8xC251 16-bit MCS96 MXS296 National Semiconductor COP8 Microchip 12-bit instruction PIC 14-bit instruction PIC PIC16F84 16-bit instruction PIC NEC Motorola 8-bit 68HC05 68HC08 68HC11 16-bit 68HC12 68HC16 32-bit 683xx Texas Instruments TMS370 MSP430 Zilog Z8 Z86E02

– Speed – Power consumption – Amount of RAM and ROM on chip – Number of I/O pins – Cost per unit – Packaging How do we decide which MCU to use?

Packages PLCC Plastic Leaded Chip Carrier Cygnal 8051 MCU in TQFP64.(Thin Quad Flat Pack) PDIP: Plastic Dual In Line Package

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 Availability of software development tools assemblers, debuggers, C compilers, emulator, simulator, technical support Wide availability and reliable sources of the microcontrollers. Three criteria in Choosing a Microcontroller

Different architectures One shared memory for instructions (program) and data with one data bus and one address bus between processor and memory. Instructions and data have to be fetched in sequential order (known as the Von Neumann Bottleneck), limiting the operation bandwidth. simpler than that of the Harvard architecture. mostly used to interface to external memory.

Basic Microprocessor Systems Harvard architecture uses physically separate memories for their instructions and data, requiring dedicated buses for each of them. Instructions and operands can therefore be fetched simultaneously . Different program and data bus widths are possible, allowing program and data memory to be better optimized to the architectural requirements. E.g.: If the instruction format requires 14 bits then program bus and memory can be made 14-bit wide, while the data bus and data memory remain 8-bit wide.

8051 Basic Component 4K bytes internal ROM 128 bytes internal RAM Four 8-bit I/O ports (P0 - P3). Two 16-bit timers /counters One serial interface RAM I/O Port Timer Serial COM Port Microcontroller CPU A single chip ROM

Block Diagram CPU Interrupt Control OSC Bus Control 4k ROM Timer 1 Timer 2 Serial 128 bytes RAM 4 I/O Ports TXD RXD External Interrupts P0 P2 P1 P3 Addr/Data

Other 8051 features only 1 On chip oscillator (external crystal) 6 interrupt sources (2 external , 3 internal, Reset) 64K external code (program) memory( only read ) PSEN 64K external data memory( can be read and write ) by RD,WR Code memory is selectable by EA (internal or external) We may have External memory as data and code

Comparison of the 8051 Family Members ROM type 8031 no ROM 80xx mask ROM 87xx EPROM 89xx Flash EEPROM 89xx 8951 8952 8953 8955 898252 891051 892051 Example (AT89C51,AT89LV51,AT89S51) AT= ATMEL(Manufacture) C = CMOS technology LV= Low Power(3.0v)

Comparison of the 8051 Family Members 89XX ROM RAM Timer Int Source IO pin Other 8951 4k 128 2 6 32 - 8952 8k 256 3 8 32 - 8953 12k 256 3 9 32 WD 8955 20k 256 3 8 32 WD 898252 8k 256 3 9 32 ISP 891051 1k 64 1 3 16 AC 892051 2k 128 2 6 16 AC WD: Watch Dog Timer AC: Analog Comparator ISP: In System Programable

8051 Internal Block Diagram

8051 Schematic Pin out

Port Term "port" refers to a group of pins on a microcontroller which can be accessed simultaneously, or on which we can set the desired combination of zeros and ones, or read from them an existing status. Physically, port is a register inside a microcontroller which is connected by wires to the pins of a microcontroller. Ports represent physical connection of Central Processing Unit with an outside world. Microcontroller uses them in order to monitor or control other components or devices. Due to functionality, some pins have twofold roles. All port pins can be designated as input or output, according to the needs of a device that's being developed.

Important Pins (IO Ports) One of the most useful features = 4 I/O ports (P0 - P3) Port 0 :- P0 = ( P0.0 - P0.7) 8-bit R/W - General Purpose I/O low byte address and data bus for external memory Port 1 :- P1= ( P1.0 - P1.7) Only 8-bit R/W - General Purpose I/O Port 2 :- P2 = ( P2.0 - P2.7 ) 8-bit R/W - General Purpose I/O high byte address for external memory Port 3:- P3 = ( P3.0 - P3.7 ) General Purpose I/O Timers(T0,T1) – ext. int (INT0, INT1) – Serial (TXD, RXD)- RD,WR Each port can be used as input or output (bi-direction)

Port 3 Alternate Functions

Hardware Structure of I/O Pin D Q Clk Q Vcc Internal Pull-Up Read latch Read pin Write to latch Internal CPU bus M1 P1.X pin P1.X B1 B2

Hardware Structure of I/O Pin Each pin of I/O ports Internally connected to CPU bus A D latch store the value of this pin Write to latch = 1 : write data into the D latch 2 Tri-state buffer : B1: controlled by “Read pin” Read pin = 1 : really read the data present at the pin B2: controlled by “Read latch” Read latch = 1 : read value from internal latch A transistor M1 gate Gate=0: open Gate=1: close

Writing “1” to Output Pin P1.X D Q Clk Q Vcc Internal Pull-Up Read latch Read pin Write to latch Internal CPU bus M1 P1.X pin P1.X 2. output pin is Vcc 1. write a 1 to the pin 1 output 1 B1 B2

Writing “0” to Output Pin P1.X D Q Clk Q Vcc Internal Pull-Up Read latch Read pin Write to latch Internal CPU bus M1 P1.X pin P1.X 2. output pin is ground 1. write a 0 to the pin 1 output 0 B1 B2

Reading “High” at Input Pin D Q Clk Q Vcc Internal Pull-Up Read latch Read pin Write to latch Internal CPU bus M1 P1.X pin P1.X 2. MOV A,P1 external pin=High write a 1 to the pin MOV P1,#0FFH 1 3. Read pin=1 Read latch=0 1 B1 B2

Reading “Low” at Input Pin D Q Clk Q Vcc Internal Pull-Up Read latch Read pin Write to latch Internal CPU bus M1 P1.X pin P1.X 8051 IC 2. MOV A,P1 external pin=Low write a 1 to the pin MOV P1,#0FFH 1 3. Read pin=1 Read latch=0 B1 B2

Important Pins PSEN’ (out): P rogram S tore En able Read for External Code Memory (active low) ALE (out): A ddress L atch E nable to latch address outputs at Port0 and Port2 EA’ (in): E xternal A ccess Enable to access external program memory 0 to 4K (active low) RXD , TXD : UART pins for serial I/O on Port 3 Vcc ( pin 40 ) : +5V (3~5V for 89LV51) GND ( pin 20 ) : ground XTAL1 , XTAL2 ( pins 19,18 ) RST ( pin 9 ): reset (active high)

Crystal Connection to 8051 Using a quartz crystal oscillator We can observe the frequency on the XTAL2 C2 30pF C1 30pF XTAL2 XTAL1 GND

Oscillator circuit is used for providing a microcontroller with a clock. Clock is needed so that microcontroller could execute a program or program instructions. capacitor above 20pF should still be used for noise and stability. No matter which oscillator is being used, in order to get a clock that microcontroller works upon, a clock of the oscillator must be divided by 12

External Clock Source Using a TTL oscillator XTAL2 is unconnected. NC EXTERNAL OSCILLATOR SIGNAL XTAL2 XTAL1 GND

A ceramic resonator is an electronic component that when combined with other appropriate components, can produce oscillations at a specific frequency . It consists of a voltage-variable capacitor that acts in some ways like a quartz crystal. Ceramic resonators are made of high-stability piezoelectric ceramics, generally lead zirconium titanate (PZT) which functions as a mechanical resonator. When voltage is applied, its piezoelectric "vibration behavior" causes an oscillating signal. The thickness of the ceramic substrate determines the resonance frequency of the device. Packages A typical ceramic resonator package has either two or three connections. They come in both surface mount and through-hole varieties with a number of different footprints. The oscillation takes place across two of the pins (connections). The third pin (if present; typically the center pin) is connected to ground. Applications Ceramic resonators can be found in many circuit boards as they can be used as the source of the clock signal for digital circuits such as microprocessors where the frequency accuracy is not critical. Quartz has a 0.001% frequency tolerance, while PZT has a 0.5% tolerance. They are also likely to be found in timing circuitry for a wide array of applications such as TVs, VCRs, automotive electronic devices, telephones, copiers, cameras, voice synthesizers, communication equipment, remote controls and toys. A ceramic resonator is often used in place of quartz crystals as a reference clock or signal generator in electronic circuitry due to its low cost and smaller size.

Machine cycle 8051 Clock and Instruction Cycle In 8051, one instruction cycle consists of twelve (12) clock cycles. Instruction cycle is sometimes called as Machine cycle by some authors.

Machine cycle Machine Cycle Freq.=1/12 XTAL Find the machine cycle for (a) XTAL = 11.0592 MHz (b) XTAL = 16 MHz. Solution: (a) 11.0592 MHz / 12 = 921.6 kHz; machine cycle = 1 / 921.6 kHz = 1.085  s (b) 16 MHz / 12 = 1.333 MHz; machine cycle = 1 / 1.333 MHz = 0.75  s

Instruction cycle of 8051 In 8051, each instruction cycle has six states (S 1 - S 6 ). Each state has two pulses (P1 and P2)
Tags