1、1,Chapter 5 : Memory extension,Microcontroller Principle and Application,主讲教师:黄英,2,Contents:,5.1 Memory extension introduction,5.2 Program memory extension,Chapter 5 Memory extension,5.3 Data memory extension,Home work,3,5.1 Memory extension introduction,5.1.1 System extension & its structure,5.1.2
2、Memory extension & addresses arrangement,Contents:,Return,4,5.1.1 System extension and its structure,1. Structure of system extension,2. System Bus & its construction method,Contents:,Return,5, Extension objects: ROM, RAM, I/O interface circuit, etc.,Fig. 1 The structure of system extension,1. Struc
3、ture of system extension,6, In order to realize system extension, the first thing is:,to construct system bus,Return,7,2. System Bus & its construction method,(1)System Bus, System Bus is divided into three groups:,AB、DB、CB,8, Address Bus(AB), Carry address information. Single direction: MCU Memory,
4、 I/O interface Its number determines the number of memory cells: Maximal extension space:,n 2n,216 cells = 64KB,9, Data Bus(DB), Carry data information Bi-direction: MCU Memory, I/O interface Bit number:,Word number(8 bits),10, Control Bus(CB), Carry control information Bi-direction : MCU Memory, I/
5、O interface,11,(2)System Bus Construction, Address Bus: P0(low 8-bit address lines): needs 8-bit address latch(74LS273, 74LS373)P2(high address lines): dont need when 256 bytes(extended memory) Data Bus: P0 Control Bus: ALE, PSEN, EA, RD, WR,12,Fig. 2 Construction Diagram of System Bus Extension,Ret
6、urn,13,5.1.2 Memory extension & addresses arrangement,Contents:,1. Memory System of Microcontroller,2. Address Searching Technology of Memory Extension,Return,14,1. Memory System of Microcontroller,Fig. 3 Memory Space Arrangement of 8051 Memory System,Return,15,2. Address Searching Technology of Mem
7、ory Extension,To solve the followings: (1)Address arrangement of each expanded memory chip. (2)Selection of each expanded memory chip. (The main problem)2 ways: Line-Selection Method Encoding Method,16,(1) Line-Selection Method Uses address line directly. Suitable for expanding memory in small scale
8、.,17,(2) Encoding Method Uses encoder to produce chip-selection signal. Dual 2-4 encoder: 74LS139 3-8 encoder: 74LS138 Suitable for expanding memory in large scale.,Return,18,5.2 Program memory extension,5.2.1 Read Only Memory(ROM),Contents:,5.2.2 Typical extension Chip of Program Memory,5.2.3 Exten
9、sion examples of Program Memory,Return,19,5.2.1 Read Only Memory(ROM),1. Mask ROM 2. PROM/otpROM PROM: Programmable ROM OtpROM: One Time Programmable ROM 3. EPROM EPROM: Erasable Programmable ROM Types: 2716(2KB8),2732(4KB8),2764(8KB8),27128(16KB8),27256(32KB8), etc. 4. EEPROM(E2PROM)E2PROM: Electri
10、cally Erasable ProgrammableTypes: 28C16,28C17,2817A, etc. 5. Flash ROMTypes: 28F256, 28F516, etc.,Return,20,5.2.2 Typical Extension Chip of Program Memory,1. Pins of EPROM 2716(2KB8),2. Working Modes of EPROM 2716,Contents:,Return,21,Fig.4 Pins Arrangement of 2716,1. Pins of EPROM 2716(2KB8), 211 A0
11、A10,22,2. Working Modes of EPROM 2716,five types: Read Unselect Programming Program Verification Programming forbidden,Return,23,5.2.3 Extension examples of Program Memory,1. Single Chip Extension,Contents:,2. Multi-Chip Extension,Return,24,1. Single Chip Extension, EPROM: 2716(2KB8)211 A0A10 2328 P
12、2.2P2.0P0.7P0.0P2.7(Chip Selection Line),25,Fig. 5 Single Chip Extension of Program Memory,26,There are 16 overlap areas(mapping areas): P2.6P2.3 = 0000FFFF, 24 =16,Return,Address Arrangement: 8000H 87FFH,27,2. Multi-Chip Extension, Two EPROMs: 2764(8KB8), total space: 16KB8 213 A0A12 2528 P2.4P2.0、
13、P0.7P0.0、P2.7(Chip Selection Line),28,Fig. 6 Multi-Chip Extension of Program Memory,29,Address Arrangement: Chip #1: 0000H 1FFFH, Chip #2: 8000H 9FFFH,Return,30,5.3 Data memory extension,5.3.1 Random-Access Memory(RAM),Contents:,5.3.2 Typical extension Chip of Data Memory,5.3.3 Examples of extension
14、 Data Memory,Return,5.3.4 Features and usage of memory system,31,5.3.1 Random-Access Memory(RAM),1. SRAM(Static RAM) 2. DRAM(Dynamic RAM),Return,32,5.3.2 Typical Extension Chip of Data Memory,6116(2KB8): 211 A10A0 6264(8KB8): 213 A12A0,33,Pins Arrangement of SRAM 6116(2KB8),34,2. Working Modes of SR
15、AM 6116,4 types: Read Write Unselect Forbidden,Return,35,5.3.3 Examples of Extension Data Memory,1. Single Chip Expanding,Contents:,2. Multi-Chip Expanding,Return,36, 6116(2KB8)211 A10A0 2328 P2.2P2.0 P0.7P0.0,1. Single Chip Expanding,37,Fig. 8 Single Chip Extension of Data Memory,38,Address Arrange
16、ment: 0000H 07FFH,Return,39,2. Multi-Chip Expanding, Four SRAMs: 6116(2KB8) total space: 8KB8 211 A10A0,(1)Adopts: Line-Selection Method,(2)Adopts: Encoding Method,Return,40,(1)Adopts: Line-Selection Method,211 = 2328 P2.2P2.0P0.7P0.0P2.6P2.3(4 Lines Selection), Four SRAMs: 6116(2KB8) total space: 8
17、KB8 211 A10A0,41,Fig. 9 Multi-Chip Extension of Data Memory,42,Address Arrangement: Chip #1: 7000H 77FFH Chip #2: 6800H 6FFFH Chip #3: 5800H 5FFFH Chip #4: 3800H 3FFFH,43,(2)Adopts: Encoding Method,211 = 2328 P2.2P2.0P0.7P0.0P2.5P2.3(For encoder pins:A,B,/G), Four SRAMs: 6116(2KB8) total space: 8KB8
18、 211 A10A0,44,Fig. 11 Multi-Chip Extension of Data Memory(Encoding Method),45,Address Arrangement: Chip #1: 0000H 07FFH Chip #2: 0800H 0FFFH Chip #3: 1000H 17FFH Chip #4: 1800H 1FFFH,Return,46,5.3.4 Features and usage of memory system,1. Features of memory system,Contents:,2. Usage of memory system,
19、Return,47,1. Features of memory system,(1)Program memory & data memory exist at the same time.,(2)Internal & external memory exist at the same time.,4 physical memory spaces: Internal program memory space External program memory space Internal data memory space External data memory space,3 logic mem
20、ory spaces: 64KB internal & external program memory space 256 bytes internal data memory space 64KB external data memory space,(3) The addresses of program memory are continuous.,Return,48,2. Usage of memory system,(1)Distinguish memory space Distinguish internal program and data memory to read inte
21、rnal ROM: MOVC to read internal RAM: MOV Distinguish external program and data memory to read external ROM: MOVC, PSEN to access external RAM: MOVX, RD, WR Distinguish internal and external data memory to read internal RAM: MOV to read external RAM: MOVX,49,(2) link up internal and external program
22、memory space. For MCU with 4KB ROM: if EA=1, then, Program fetched from address 0000H to 0FFFH are directed to the internal ROM. Program fetched from address 1000H to FFFFH are directed to the external ROM.,if EA=0, then all program are directed to external ROM., For ROMless MCU, it must have this pin strapped to ground to enable them to execute properly.,50,Home Work of Chapter 5,P131 (一)1-9 (二)1-8,