基本要求:熟悉半导体存储器分类,能根据实际需要扩充外部RAM和ROM。第八章MCS-51单片机存储器扩展应用技术第一节存储器扩展概述存储器MRAM(RandomAccessMemory)ROM(ReadOnlyMemory)SRAM(StaticRAM)DRAM(DynamicRAM)NVRAM(NonVolativeRAM)掩模ROMPROM(ProgramableROM)EPROM(ErasablePROM)E2PROM(ElectricallyEPROM)一、存储器分类P2ALEP080518751/PSEN/WR/RD地址锁存器CBDBABA8-A15A0-A7D0-D7二、MCS-51的最小系统图8-28031ROM时钟电路复位电路一、ROM存储器扩充步骤1、首先根据已知ROM芯片参数和所求参数求得所需芯片数=所需容量/每片容量(假设字长相同)2、求得芯片的地址线、数据线根数3、连接AB、DB和CB中的/PSEN、/RDDBAB/PSEN、/RD单片机:存储器:P0P2+P0读ROMRAM读Di(I/Oi)Ai(=16根)+/CE(/CS)/OE(/RD)/OE(/RD)第二节程序存储器ROM的扩展技术例用2764(8K*8bit即8KB)扩展16K字节的EPROMP2.7P2.6P2.5P2.4P2.3P2.2P2.1P2.08051P0.0P0.1P0.7ALE/PSEN74LS373G………A12A11A8/CEA72764A0O0/OEO7………………A12A11A8/CEA72764A0O0/OEO7……………………?…对于片选信号有以下三种连接方法(一)线选法/CE#1/CE#2/CE#3/CE#4A15A14A13A12A11A10A8A9A8A7A6A5A4A3A2A1A0#1:#2:#3:#4:00000000000111111111111110*7000H77FFH*11016800H6FFFH5800H—5FFFH3800H—3FFFHA11A12A13A14A0—A10DB0-7(二)全译码法A15A14A13A12A11A10A9A8A7A6A5A4A3A2A1A01#:000000000000111111111111000000000H07FFH2#:000010800H----0FFFH3#:1000H----17FFH4#:1800H----1FFFHQ05-32…译Q3码器…Q31/CE#4/CE#3/CE#2/CE#1A11-A15A0-A10A0-A15DB0-7(三)部分译码法Q02-4…译Q3码器/CE#4/CE#3/CE#2/CE#1A11-A12A0-A10A0-A12DB0-71#:A15A14A13A12A11A10A9A8A7A6A5A4A3A2A1A0000000000001111111111100***000001……1110000H2000HE000H地址重叠……图8-8单片程序存储器扩展连接图二、扩充ROM芯片举例例1用一片2716(2K*8b)扩充8031外部EPROM2KB,试画出连接图。检验一下三总线的连接是否正确图8-9两片程序存储器扩展连接图例2试用2764(8K*8b)扩充16K*8b的EPROM。图8-9所示。图8-17译码法扩展三片8KBEPROM例3译码法扩展三片8KBEPROM补例扩展16K字节EPROMP2.7P2.6P2.5P2.4P2.3P2.2P2.1P2.08051P0.0P0.1P0.2P0.3/PSENP0.4P0.5P0.6ALEP0.7/CEA13A12A11A10A9A8O7O6O527128O4O3O2O1O0A0A1A2A3A4A5A6A7/OE74LS373G第三节数据存储器RAM的扩展技术一、RAM存储器扩充步骤与ROM扩充类似,只是多画一根线:将MCS-51的/WR与RAM的/WE(/WR)相连。图8-13单片RAM扩展连接图例4单片RAM的扩展图8-14多片RAM扩展连接图例5多片RAM的扩展补例线选法扩展4KBRAM(6116:2K*8bit)P2.4P2.3P2.2P2.1P2.08051P0.0-P0.7ALE/RD/WR8282A10/CSA9A86116A0-A7D0-D7/OE/WEA10/CSA9A86116A0-A7D0-D7/OE/WE2:4/Y0/G译/Y1A码…B器/Y3补例部分译码法扩展4KBRAMP2.7P2.6P2.5P2.2…P2.0ALEP0.0-P0.78031/WR/RDG74LS373A0-A10/CE2#6116/WE/OED7-D0…A0-A10/CE1#6116/WE/OED7-D0#1:0000H—07FFH#2:2000H—27FFH图8-19扩展4KRAM和2KROM的8031系统第四节存储器综合扩展技术例6扩展80314KRAM和2KROM补例扩展2K字节E2PROMP1.0/WR/RD/PSEN8051P2.7P2.2P2.1P2.0ALEP0.7-P0.0RDY/BUSY/WE/OE2817/CEA10A9A8A7-A0I/O0-I/O7G74LS373地址重叠区16个。2:4/Y0/G译/Y1A码/Y2B器/Y3补例同时扩展ROM和RAMP2.7P2.6P2.5P2.2…P2.0ALEP0.0-P0.78031/WR/PSEN/RDG74LS373A0-A12/CE3#6264/WE/OED7-D0A0-A12/CE2#6264/WE/OED7-D0A0-A12/CE1#2764/OED7-D01#:0000H—1FFFH,2#:2000H—3FFFH,3#:4000H—5FFFH