UNIT IV MICROCONTROLLER

Similar documents
Question Bank Microprocessor and Microcontroller

ISSI. IS89C51 CMOS SINGLE CHIP 8-BIT MICROCONTROLLER with 4-Kbytes of FLASH ISSI IS89C51 NOVEMBER 1998 FEATURES GENERAL DESCRIPTION

Three criteria in Choosing a Microcontroller

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

8051 MICROCONTROLLER

Rev. No. History Issue Date Remark

Unit I. Introduction Microcontrollers and Embedded processors Overview of the 8051 Inside the 8051 Addressing Modes

8051 Microcontroller

ENE 334 Microprocessors

8051 Microcontroller

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

8051 microcontrollers

MICROPROCESSORS AND MICROCONTROLLERS MATERIAL. Features of 8051:


8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT89S52

Fig 1. Block diagram of a microcomputer

Module I. Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC.

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

VRS540-4kB Flash, 128B RAM, 25~40MHz, 8-Bit MCU

VRS550-8kB Flash, 256B RAM, 25~40MHz, 8-Bit MCU VRS560-16kB Flash, 256B RAM, 40MHz, 8-Bit MCU

Introduction To MCS-51

The Microcontroller. Lecture Set 3. Major Microcontroller Families. Example Microcontroller Families Cont. Example Microcontroller Families

8051 Serial Communication

EE6502- MICROPROCESSOR AND MICROCONTROLLER

UNIT MICROCONTROLLER AND ITS PROGRAMMING

Microcontrollers. Fig. 1 gives a comparison of a microprocessor system and a microcontroller system.

Lecture 1. Course Overview and The 8051 Architecture

CoE3DJ4 Digital Systems Design. Chapter 5: Serial Port Operation

CS 320. Computer Architecture Core Architecture

Vidyalankar T.E. Sem. V [ETRX] Microprocessors and Microcontrollers I Prelim Question Paper Solution

The Timers/Counters The Serial Interface The Interrupt System Reset P0.0-P0.7 P2.0-P2.7. Port 2 Drivers. Port 2 Latch

INTEGRATED CIRCUITS DATA SHEET. P89C738; P89C739 8-bit microcontrollers Dec 15. Product specification File under Integrated Circuits, IC20

WINTER 14 EXAMINATION

8051 Microcontrollers

Fig 1. Block diagram of a microcomputer

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET

8051 Microcontroller. Ali Ziya Alkar 1

MCS-51 Serial Port A T 8 9 C 5 2 1

7.2.1 Timer 2 Capture LSB... 24

8051 MICROCONTROLLER

Timer-1 can be run using the internal clock, fosc/12 (timer mode) or from any external source via pin T1 (P3.5) (Counter mode).

Chapter C2051 Architecture and Serial Communication Link

Microcontrollers can be considered as self-contained systems with a processor, memory and I/O ports.

EC Microprocessor and Microcontroller


Preliminary W77E58 8 BIT MICROCONTROLLER. Table of Contents-- Publication Release Date: March Revision A1

VRS570 32K Flash, 1kB RAM, 25~40MHz, 8-Bit MCU VRS580 64K Flash, 1kB RAM, 25~40MHz, 8-Bit MCU

8051 Microcontroller memory Organization and its Applications

UNIT MICROCONTROLLER

W77IE58 8-BIT MICROCONTROLLER. Table of Contents-- Publication Release Date: December Revision A2

8XC51RA RB RC Hardware Description

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT- IV

Handshake Solutions. HT80C51 User Manual

SUMMER 13 EXAMINATION

The Final Word on 8051 Microcontroller

DATA SHEET. P80CL31; P80CL51 Low voltage 8-bit microcontrollers with UART INTEGRATED CIRCUITS Apr 15

Serial I-O for Dinesh K. Sharma Electrical Engineering Department I.I.T. Bombay Mumbai (version 14/10/07)

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING EC6504 MICROPROCESSOR AND MICRO CONTROLLER

W77LE58/W77L058A Data Sheet 8-BIT MICROCONTROLLER. Table of Contents- Publication Release Date: April 17, Revision A7

Preliminary W77C32 8 BIT MICROCONTROLLER GENERAL DESCRIPTION FEATURES

Module Contents of the Module Hours COs

W77E058A Data Sheet 8-BIT MICROCONTROLLER. Table of Contents-

Embedded Controller Programming

MEGAWIN MPC89L516X2. 8-bit micro-controller. Features

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Programming in Assembly Module No: CS/ES/12 Quadrant 1 e-text

MICROCONTROLLER UNIT 1

MODULE-1. Short Answer Questions

SRL0 Serial Port Unit

MSM80C154S MSM83C154S MSM85C154HVS USER'S MANUAL

8051 Timers and Serial Port

Microcontroller and Embedded Systems:

MICROCONTROLLERS 8051

CPEG300 Embedded System Design. Lecture 3 Memory

TS80C52X2. 8-bit CMOS Microcontroller 0-60 MHz. Preliminary. 1. Description. 2. Features

UNIT 5. Microcontrollers. Syllabus

P89V52X2. 1. General description. 2. Features. 8-bit 80C51 low power 8 kb flash microcontroller with 256 B RAM, 192 B data EEPROM

SH57K12. High Performance 8031 Microcontroller. Preliminary. Features. General Description

C8051 Legacy-Speed 8-Bit Processor Core

8-bit Microcontroller 8 Kbytes ROM/OTP, ROMless TS80C32X2 TS87C52X2 TS80C52X2 AT80C32X2 AT80C52X2 AT87C52X2. Features. Description

THE 8051 MICROCONTROLLER Simple comparison: Pentium vs. 8051

Introducing The MCS 251 Microcontroller -- 8XC251SB

PGT302 Embedded Software Technology. PGT302 Embedded Software Technology

SECTION 1: INTRODUCTION 5 SECTION 2: ORDERING INFORMATION 5 SECTION 3: ARCHITECTURE 5

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

User s Manual, V 0.1, Jan 2005 XC800. Microcontroller Family Architecture and Instruction Set. Microcontrollers. Never stop thinking.

8.1.1 External Data Memory Access Timing...32

DS89C420 Ultra High-Speed Microcontroller User s Guide

AT Bit Spread- Spectrum Microcontroller. Preliminary. Features. Description. Pin Configuration

Vidyalankar T.E. Sem. V [EXTC] Microprocessors and Microcontrollers I Prelim Question Paper Solution V SS (GND)

IA8044/IA8344. SDLC Communications Controller. Data Sheet. SDLC Communications Controller January 9, 2015

Microcontroller and Applications

MODEL ANSWER SUBJECT- MICROCONTROLLER(12187) CLASS-EJ5E CLASS TEST-02 Q1.)Attempt any THREE of the following.

Mod-3: Interrupts,Timer operation,serial communication 1

8-bit Microcontroller with 12K Bytes Flash and 2K Bytes EEPROM AT89S8253

8051 MICROCONTROLLER WITH 64K FLASH AND ISP. Latch PSW ALU. Latch. Instruction Decoder & Sequencer. Bus&Clock Controller. Port 4. Latch.

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

Chapter 9. Programming Framework

CHAPTER TIMER PROGRAMMING

Interrupt Programming: Interrupts vs. Polling Method:

C511/C511A C513/C513A C513A-H 8-Bit CMOS Microcontroller. User s Manual Semiconductor/

Transcription:

UNIT IV 8051- MICROCONTROLLER Prepared by R. Kavitha Page 1

Application Prepared by R. Kavitha Page 2

Pin Description of the 8051 UNIT IV- 8051 MICROCONTROLLER P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RST (RXD)P3.0 (TXD)P3.1 (INT0)P3.2 (INT1)P3.3 (T0)P3.4 (T1)P3.5 (WR)P3.6 (RD)P3.7 XTAL2 XTAL1 GND 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8051 (8031) 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 Vcc P0.0(AD0) P0.1(AD1) P0.2(AD2) P0.3(AD3) P0.4(AD4) P0.5(AD5) P0.6(AD6) P0.7(AD7) EA/VPP ALE/PROG PSEN P2.7(A15) P2.6(A14) P2.5(A13) P2.4(A12) P2.3(A11) P2.2(A10) P2.1(A9) P2.0(A8) Prepared by R. Kavitha Page 3

Prepared by R. Kavitha Page 4

Complex Instruction Set Computer (CISC) Memory in those days was expensive. Bigger programs required more storage which included more money. There was a need to reduce the number of instructions per program. This was achieved by having multiple operations within single instruction. Multiple operations lead to many different kinds of instructions. Access to memory in turn makes the instruction length variable and fetch-decode execute time unpredictable making it more complex. Thus hardware was made to understand the complexity of instruction set. The computer having such instruction set was named as Complex Instruction Set Computer (CISC). Intel 8051 is an example for CISC architecture. Difference between Harvard and Princeton or Von Neumann Architecture In Harvard Architecture, the CPU can have separate data and instruction memory and busses, allowing transfers to be performed simultaneously on both busses. Prepared by R. Kavitha Page 5

In Von Neumann architecture, the CPU can be either reading an instruction or reading/writing data from/to the memory. Both cannot occur at the same time since the instructions and data use the same bus system. Prepared by R. Kavitha Page 6

Basic 8051 Architecture Prepared by R. Kavitha Page 7

Features Various features of 8051 microcontroller are given as follows. 8-bit CPU 16-bit Program Counter 8-bit Processor Status Word (PSW) 8-bit Stack Pointer Internal RAM of 128bytes Special Function Registers (SFRs) of 128 bytes 32 I/O pins arranged as four 8-bit ports (P0 - P3) Two 16-bit timer/counters : T0 and T1 Two external and three internal vectored interrupts One full duplex serial I/O 8051 Clock and Instruction Cycle The heart of 8051 is the circuitry that generates the clock pulses by which all internal operations are synchronised. Pins XTAL1 and XTAL2 are provided for connecting resonator to form an oscillator. The time taken to complete any instruction is called as machine cycle or instruction cycle. In 8051 one instruction cycle consists of 6 states or 12 clock cycles, instruction cycle is also referred as Machine cycle. Instruction cycle of 8051 (Instruction cycle has six states (S 1 - S 6 ). Each state has two pulses (P1 and P2)) Prepared by R. Kavitha Page 8

128 bytes of Internal RAM Structure UNIT IV- 8051 MICROCONTROLLER 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. (RS1,RS0 bits of PSW) 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. A bit variable can be set with a command such as SETB and cleared with a command such as CLR. Example instructions are: SETB 25h ; sets the bit 25h (becomes 1) CLR 25h ; clears bit 25h (becomes 0) 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. The general purpose RAM can be accessed using direct or indirect addressing modes. Prepared by R. Kavitha Page 9

Internal Data Memory and Special Function Register (SFR) Map The special function registers (SFRs) are mapped in the upper 128 bytes of internal data memory address. Hence there is an address overlap between the upper 128 bytes of data RAM and SFRs. Note that the upper 128 bytes of data RAM are present only in the 8052 family. The lower128 bytes of RAM (00H - 7FH) can be accessed both by direct or indirect addressing while the upper 128 bytes of RAM (80H - FFH) are accessed by indirect addressing. The SFRs (80H - FFH) are accessed by direct addressing only. This feature distinguishes the upper 128 bytes of memory from the SFRs, as shown in figure. The set of Special Function Registers (SFRs) contains important registers such as Accumulator, Register B, I/O Port latch registers, Stack pointer, Data Pointer, Processor Status Word (PSW) and various control registers. Processor Status Word (PSW) Prepared by R. Kavitha Page 10

Accumulator is an 8 bit register widely used for all arithmetic and logical operations. Accumulator is also used to transfer data between external memory. B register is used along with Accumulator for multiplication and division. A and B registers together is also called MATH registers. Stack Pointer (SP) it contains the address of the data item on the top of the stack. Stack may reside anywhere on the internal RAM. On reset, SP is initialized to 07 so that the default stack will start from address 08 onwards. Data Pointer (DPTR) DPH (Data pointer higher byte), DPL (Data pointer lower byte). This is a 16 bit register which is used to furnish address information for internal and external program memory and for external data memory. Program Counter (PC) 16 bit PC contains the address of next instruction to be executed. On reset PC will set to 0000. After fetching every instruction PC will increment by one. Prepared by R. Kavitha Page 11

Special Function Register 1. Timer Timers/Counters are used generally for Time reference Creating delay Wave form properties measurement Periodic interrupt generation Waveform generation The two timers in 8051 share two SFRs (TMOD and TCON) which control the timers, and each timer also has two SFRs dedicated solely to itself (TH0/TL0 and TH1/TL1). 8051 has two 16-bit programmable UP timers/counters. They can be configured to operate either as timers or as event counters In the "timer" function mode, the counter is incremented in every machine cycle. In the "counter" function mode, the register is incremented in response to a 1 to 0 transition at its corresponding external input pin (T0 or T1). It requires 2 machine cycles to detect a high to low transition. 1.1. Timer Mode control (TMOD) Special Function Register TMOD register is not bit addressable. Gate: Based on the status of the signal. Timer starts counting using either internal clock (timer mode) or external pulses (counter mode). C/T*: It is used for the selection of Counter/Timer mode. Mode Select Bits. M1 and M0 are mode select bits. 1.2. Timer control (TCON) Special function register: TCON is bit addressable. The address of TCON is 88H. It is partly related to Timer and partly to interrupt. Prepared by R. Kavitha Page 12

2. Interrupt 8051 has five interrupts. They are maskable and vectored interrupts. Out of these five, two are external interrupt and three are internal interrupts. Prepared by R. Kavitha Page 13

8051 makes use of two registers to deal with interrupts. 2.1. IE Register - Interrupt Enable register This is an 8 bit register used for enabling or disabling the interrupts. The structure of IE is 2.2. IP Register. This is an 8 bit register used for setting the priority of the interrupts. 3. Serial Interface 3.1. SBUF The serial port of 8051 is full duplex, i.e., it can transmit and receive simultaneously. Prepared by R. Kavitha Page 14

The register SBUF is used to hold the data. The special function register SBUF is physically two registers. One is, write-only and is used to hold data to be transmitted out of the 8051 via TXD. The other is, read-only and holds the received data from external sources via RXD. 3.2.Serial Port Control Register (SCON) Register SCON controls serial data communication. Address: 098H (Bit addressable) Mode select bits SM2:multi processor communication bit REN: Receive enable bit TB8: Transmitted bit 8 (Normally we have 0-7 bits transmitted/received) RB8: Received bit 8 TI: Transmit interrupt flag RI: Receive interrupt flag 3. Power Mode control Register Register PCON controls processor power down, sleep modes and serial data band rate. Only one bit of PCON is used with respect to serial communication. The seventh bit (b7)(smod) is used to generate the baud rate of serial communication. SMOD: Serial baud rate modify bit GF1: General purpose user flag bit 1 GF0: General purpose user flag bit 0 PD: Power down bit IDL: Idle mode bit Prepared by R. Kavitha Page 15