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

8051 Microcontrollers

8051 Microcontroller

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

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

UNIT IV MICROCONTROLLER

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

8051 microcontrollers

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

ENE 334 Microprocessors

Introduction To MCS-51

8051 Microcontroller

Three criteria in Choosing a Microcontroller

8051 MICROCONTROLLER

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

8051 Microcontroller

Chapter 09. Programming in Assembly

MODULE-1. Short Answer Questions

Chapter 9. Programming Framework

CS 320. Computer Architecture Core Architecture

Handshake Solutions. HT80C51 User Manual

TUTORIAL. Donal Heffernan University of Limerick May Tutorial D.Heffernan 2000,

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

MICROPROCESSORS AND MICROCONTROLLERS MATERIAL. Features of 8051:

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

8051 Core Specification

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

Rev. No. History Issue Date Remark

8051 Overview and Instruction Set

MCS -51 Programmer s Guide and Instruction Set

80C51 family programmer s guide and instruction set. 80C51 Family. PROGRAMMER S GUIDE AND INSTRUCTION SET Memory Organization. Philips Semiconductors

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

ENE 334 Microprocessors

Microcontroller Intel [Instruction Set]

Byte order, special function registers

CPEG300 Embedded System Design. Lecture 3 Memory

ELEG3924 Microprocessor

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

Question Bank Microprocessor and Microcontroller


EE6502- MICROPROCESSOR AND MICROCONTROLLER

8051 Microcontroller. Ali Ziya Alkar 1

C51 Family. C51 Family Programmer s Guide and Instruction Set. Summary

Module Contents of the Module Hours COs

Principle and Interface Techniques of Microcontroller

MSM80C154S MSM83C154S MSM85C154HVS USER'S MANUAL

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

UNIT MICROCONTROLLER AND ITS PROGRAMMING

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

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

8051 Microcontroller memory Organization and its Applications

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

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

8XC51RA RB RC Hardware Description

Figure Programming model

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT- IV

MASSEY UNIVERSITY PALMERSTON NORTH CAMPUS

80C51 Block Diagram. CSE Overview 1

Microcomputer Architecture and Programming

8051 Instruction Set

CHAPTER 11 INTERRUPTS PROGRAMMING

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET

Y51 Microcontroller. Technical Manual

CPEG300 Embedded System Design. Lecture 6 Interrupt System

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

CoE3DJ4 Digital Systems Design. Chapter 5: Serial Port Operation

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text

The Final Word on 8051 Microcontroller

8051 MICROCONTROLLER

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

SN8F5000 Family Instruction Set

MICROPROCESSOR & MICROCONTROLLER

MICROPROCESSOR LABORATORY MANUAL

C51 Family. Architectural Overview of the C51 Family. Summary

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

ULTRA-HIGH-SPEED FLASH MICROCONTROLLER USER S GUIDE

Architecture of 8085 microprocessor

DS89C420 Ultra High-Speed Microcontroller User s Guide

THE 8051 MICROCONTROLLER Simple comparison: Pentium vs. 8051

Embedded Controller Programming

Lecture 1. Course Overview and The 8051 Architecture

Microcontroller and Applications

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

Chapter C2051 Architecture and Serial Communication Link


UNIT MICROCONTROLLER

Programming of 8085 microprocessor and 8051 micro controller Study material

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

8-BIT MICROCONTROLLER

Fig 1. Block diagram of a microcomputer

SOLUTION MANUAL FOR THE 8051 MICROCONTROLLER 4TH EDITION BY MACKENZIE AND PHAN

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

Interrupt Programming: Interrupts vs. Polling Method:

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

WINTER 14 EXAMINATION

PGT302 Embedded Software Technology. PGT302 Embedded Software Technology

Programming Book Microcontroller Kit. Rev 3.0 January, Wichit Sirichote

Department of Electronics and Instrumentation Engineering Question Bank

Transcription:

8051 Memory Organization BY D. BALAKRISHNA, Research Assistant, IIIT-H Chapter 1: Memory Organization There are 2 types of memories available in 8051 microcontroller. Program memory/c code memory (ROM) Data memory (RAM) Program Memory is used to store the program permanently. Data Memory is used for temporarily storing data & results, and used during the execution of program. The following figure shows the memory types of 8051 microcontroller. Figure 1.0: Memory types of 8051

1.1 Program Memory 8051 has 4k bytes of ROM to store program permanently. This ROM is having the address locations 0000 to 0FFF. As we know 8051 has 16-bits of Address bus can accesss the external memory up to 2 16 locations i..e. 16k bytes. The following figure shows the Internal & External Program memory of 8051 Figure1.1: Program memory of 8051 We already discussedd in Pin configuration of 8051, by using EA pin we can access external memory. If EA = 1: :8051 will use both memories, first internal thenexternal (if exists). If EA = 0:8051 will use External memory regardless of internal memory. 1.2 Data Memory 8051 has 128 bytes of on-chip Data memory for temporary storage purpose. This memory is volatile in nature. Resetting the 8051 empties the complete memory.

1.2.1 Bank Registers: The first 32 bytes are reserved for bank registers Bank 0, Bank 1, Bank 2, and Bank 3. Each bank contains 8 registers (R0 R7) & holds 1 byte of memory for each register. In multitasking, many machine cycles are required for switching from one task to another for saving & retrieving. By using these bank registerss we can use same register but switches the bank, so the time taken is very less. 1.2.2 Bit memory 16 bytes of memory from addresses 20H through 2FH is allocated to Bit memory. It is a subset of Internal RAM, but the 8051 provides special instructions to access these 16 bytes of memory on a bit by bit basis. This memory can be able to access a number of bit variables. Ex: SETB and CLR. The following figure illustrates the data memory of 8051 microcontroller. Figure 1.2: Data memory of 8051 1.2.3 Scratch pad areaa 80 bytes of memory from addressess 30H to 7FH is allocated for general purpose operationscalled as Scratch pad area whichh is used for storing temporary operations.

Chapter 2 Special Function Registers There are only 21 SFRs in 8051 microcontroller.sfr registers lies in the address range of 80h to FFh of internal RAM. Out of 21 registers 10 registers are Byte addressable, and 11 registers are Bit & Byte addressable. The address of SFRs whose are Bit & Byte addressable ends with 0 or 8. The following table shows the list of SFRs and corresponding addresses. Name Function Internal RAM Address (Hex) P0 I/O Port latch 80 SP Stack Pointer 81 DPL Addressing Ext. memory 82 DPH Addressing Ext. memory 83 PCON Power Control 87 TCON Timer/Counter Control 88 TMOD Timer/Counter Mode Control 89 TL0 Timer 0 Low Byte 8A TL1 Timer 1 Low Byte 8B TH0 Timer 0 High Byte 8C TH1 Timer 1 High Byte 8D P1 I/O Port latch 90 SCON Serial Port Control 98 SBUF Serial Port Data Buffer 99 P2 I/O Port latch A0 IE Interrupt Enable Control A8 P3 I/O Port latch B0 IP Interrupt Priority B8 PSW Program Status Word D0 ACC Accumulator E0 B Arithmetic F0 Table 2.0: Special Function registers of 8051.

The following figure shows the Special function registers of 8051. SFRs of 8051 are divided into 3 types: I/O Port SFRs Control SFRs Other SFRs 2.1 Accumulator Figure2.0: Special Function registers of 8051. An accumulator is a register which stores the intermediate arithmetic and logic results. It is an 8-bit register and is the most versatile registerr of the 8051, because the most number of instructionss that will use the accumulator.

Figure 2.1: Accumulator ACC is usually accessed by direct addressing and its physical address is 0E0H. Accumulator is both byte and bit addressable. Example: If we want to add the number 1 and 2, the resulting 3 willl be stored in the Accumulator. 2.2 "R" REGISTERS: The "R" registers are a set of eight registerss (R0 R7).Thesee registerss are used as auxiliary registerss in many operations. Example: If we want to add the number 1 and 2, the original number 1 is stored in the Accumulator, the value 2 is stored in Rx register (where x lies between 0 to 7). The "R" registerss are also used to store valuestemporarily. 2.3 "B" REGISTER: The "B" register is 8- bit register; it is similar to the Accumulator. B-register is only used for two instructions: MUL and DIV. If we want to multiply/divide A by another number easily, wecan store the other number in B-register and use these two instructions.

Figure 2.3: B-Register Aside from the MUL and DIV instructions, the B register used as temporary storage register like "R" registers. 2.4 Program Counter (Pc) The Program Counter (PC) is a 16 bit (2-byte) register which holds the addresss of next instructio on is goingg to be executed. At the point of Reset or at startt up of 8051, PC always starts at 0000H and incremented each time when an instruction is executed. Figure 2.4: Program Counter of 8051 PC isn t always incremented by one. Since some instructions require 2 or 3 bytes the PC willl be incremented by 2 or 3 in these cases. 2.5 The Stack Pointer (Sp) The Stack Pointer is 8-bit (1-byte) in size, and holds the address of next value to be removed from stack. Whenever wepush a value ontoo the stack, the 8051 first increments the value of SP and then stores the value at the resulting memory location. Whenever wepop a value off the stack, the 8051 returns the value from the memory location (indicated by SP) and then decrements the value of SP.

Figure 2.5: Stack Pointer of 8051 On reset or at start up the SP will be initialized to 07h. SP can be modified by six instructions: PUSH, POP, ACALL, LCALL, RET, and RETI. 2.6 Data Pointer (Dptr) The Data Pointer (DPTR) is a 16-bit (2-byte) register. This DPTR is divided into 2 8-bit registers: DPL & DPH. We can access these DPL & DPH individually or Combine called DPTR. The following figure shows the DPTR register. Figure 2.6: DPTR register of 8051 DPTR is used to point the data to access external memory (RAM). The 8051 will access external memory at the address indicatedd by DPTR. It is also used to store 2-byte values which have nothing to do with memory locations.

2.7 Port Registers As we know 8051 has 4 I/O ports, each port Register. And all 4 port registers are bit as well as following figure shows the Port registers of 8051. contains its own Port byte addressable. The Figure 2.7: Port Registers 2.8 Program Status Word (Psw) PSW register is 8-bits in size. It contains several status bits that reflect the current state of the CPU. The following figure shows PSW register. PSW register is both bit and byte addressable. The address of PSW starts from D0H. The various individual bits are explained below.

P (Parity Flag) This bit indicates the Parity used. It is mainly used during data transfer via serial communication. If the number of 1s in accumulator is even this bit automatically goes to 0, otherwise goes to 1. Bit-1: This bit is user definedd bit. OV (Overflow) If the result is beyond the range this OV flag will set to 1. If the result of an arithmetical operation is larger than 255 this OV flag will be set (1), otherwise cleared (0). RS0 & RS1: Figure 2.8: Program Status Word of 8051 These two bits are used to select one of four Bank registers of RAM. The following table explains the selection of register bank. RS1 0 0 1 1 RS1 0 1 0 1 Bank Bank 0 (00 07h) Bank 1 (08 0Fh) Bank 2 (10 17h) Bank 3 (18 1Fh) Table 2.8: Register Bank selection

F0 - Flag 0: This is a general-purpose bit available for use. AC (Auxiliary Carry): This pin is used in BCD operations only. C (Carry): This pin is used for arithmetic operations. If carry occur in arithmetic operations, the accumulat tor is unable to store entire result. In this situation this carry flag will set. 2.9 PCON The Power Control SFR is used to control the 8051's power control modes. 8051 has two power saving modes. They are: 1. Idle Mode 2. Power Down mode. Figure 2.9: PCON register of 8051 IDL By setting IDL bit to 1 (i.e., =0)the 8051 entered to Idle mode..in this mode of operationthe clock is turned off to CPU, but the interrupt, timer and serial port functioning normal. PD: By setting the PD bit to 1 the 8051 entered to Power down Mode. When 8051 entered into this mode of operation the internal clock to the entire microcontroller is stopped (frozen).the 8051 will wake up by Hardware Reset only. GF1: General-purpose bit (available for use) ).

GF0: General-purpose bit (available for use). SMOD: By setting this bit Baud rate will twice as much higher. 2.10 TCON The Timer Control is Special function register which is used to activate or deactivate Timer/Counter. We will discuss about this TCON register clearly in TIMERS/ COUNTERS concepts. 2.11 TMOD The Timer Mode Control is Special function register which is used to control Timer/Counter. We will discuss about this TMOD register clearly in TIMERS/ COUNTERS concepts. We will also discuss about in TIMERS/ COUNTERSare abouttl0, TH0, TL1, and TH1 registers. 2.12 IE (Interrupt Enable) The IE register enables or disables the interrupt. We will discuss about this IE register clearly in INTERRUPTS concepts. 2.13 IP (Interrupt Priority) The IP register specifies the priority level of each interrupt (high or low priority). We will discuss about this IP register clearly in INTERRUPTS concepts. 2.14 SMOD & SBUF: These two registers control the serial communication. We will discuss about these two SMOD & SBUF registers clearly in Serial Communication concepts.