51 MCU external expansion RAM

Publisher:MysticDreamerLatest update time:2013-03-04 Source: 21IC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Overview

Ordinary 51 single-chip microcomputers can expand ROM and RAM with 64K bytes of space each. In actual applications, external ROM is rarely expanded, and RAM is generally expanded because the internal RAM of ordinary 51 single-chip microcomputers is too small, only 128-256 bytes, which is often not enough when processing large amounts of data. The external expansion of RAM requires the use of P0, P2, P3.6, and P3.7, consuming 18 IO ports, resulting in insufficient IO ports. In order to solve the above contradictions, large-capacity 51 single-chip microcomputers (enhanced 51 single-chip microcomputers) came into being. This type of single-chip microcomputer generally has 1K-16K RAM and 16K-64K ROM built-in, and the price is relatively expensive. In some cases, using ordinary 51 single-chip microcomputers to expand RAM externally can save costs more than directly using enhanced 51 single-chip microcomputers. Therefore, it is necessary to learn how to expand RAM externally on 51 single-chip microcomputers.

2. Circuit Design

On the WSF-51DB development board, 32K RAM (HM62256B) is expanded, and the address latch chip uses 74HC573. If the RAM is expanded off-chip, the P0 port is used as the multiplexed port for the low byte of the data and address, and there is no need to add a pull-up resistor. Of course, adding a pull-up resistor has no effect. It should be noted that when using the off-chip expansion RAM, it is best not to connect other resources to the P0 port and the P2 port. Only 15 address lines are used to access the externally expanded 32K RAM, so P2.7 is used as the enable pin of the address latch 74HC573 and the chip select of the HM62256B. As shown in the figure below, in order to reduce cross-wiring, the 74HC573 is flipped down, which looks a bit awkward.

3. Software Design

/****************************************************** **

*Program name: 51 MCU external expansion RAM test

*Program function: write data to the external RAM, read data from the external RAM, and light up the 8 LEDs of port P1

* Development tools: WSF-51DB development board

* MCU model: AT89S52-24PU

*Clock frequency: 12MHZ

*Program author: Master Wu

*Copyright statement: All rights reserved by Master Wu. Please indicate the source address and author when reprinting.

*************************************************** /

#include

#include//Contains the absolute address access function of the off-chip storage space: XBYTE[]

sbit oe=P2^7; //External RAM chip select and address latch 74HC573 enable

unsigned char code ramdata[100]= //define 100 data [page]

{

0,1,2,3,4,5,6,7,8,9,

10,11,12,13,14,15,16,17,18,19,

20,21,22,23,24,25,26,27,28,29,

30,31,32,33,34,35,36,37,38,39,

40,41,42,43,44,45,46,47,48,49,

50,51,52,53,54,55,56,57,58,59,

60,61,62,63,64,65,66,67,68,69,

70,71,72,73,74,75,76,77,78,79,

80,81,82,83,84,85,86,87,88,89,

90,91,92,93,94,95,96,97,98,99

};

//Delay ms function:

void Delayms(unsigned int t)

{

unsigned int i,j;

for(i=t;i>0;i--)

for(j=120;j>0;j--);

}

//Main function:

int main(void)

{

unsigned char i;

oe=0; //Enable RAM chip select and address latch

for(i=0;i<100;i++)

XBYTE[300+i]=ramdata[i];

//Write 100 data into the off-chip RAM, starting at address: 300

while(1)

{

for(i=0;i<100;i++)

{

P1=XBYTE[300+i]; //Read data from the off-chip RAM and light up the 8 LEDs of port P1

Delayms(500);

}

}

return 0;

}

Reference address:51 MCU external expansion RAM

Previous article:51 MCU Keil C Delay Program
Next article:51 MCU bus timing

Recommended ReadingLatest update time:2024-11-16 14:51

C51 single chip buzzer wish you peace music
#include "reg52.h" unsigned char Count; sbit _Speak =P1^5 ;  unsigned char code SONG ={ //Wish you peace 0x26,0x20,0x20,0x20,0x20,0x20,0x26,0x10,0x20,0x10,0x20,0x80,0x26,0x20,0x30,0x20, 0x30,0x20,0x39,0x10,0x30,0x10,0x30,0x80,0x26,0x20,0x20,0x20,0x20,0x20,0x1c,0x20, 0x20,0x80,0x2b,0x20,0x26,0x20,0x20,0x20,0x2b,0x10,0x
[Microcontroller]
The difference between the PIC series microcontroller and the MCS-51 series microcontroller in design
It should be said that there are three main characteristics: (1) Bus structure: The bus structure of the MCS-51 microcontroller is the von Neumann type. The computer fetches instructions and data in the same storage space, and the two cannot be performed at the same time; while the bus structure of the PIC microcontro
[Microcontroller]
Detailed Analysis of the Internal Data Memory RAM of MCS-51 MCU
The internal RAM of the 8051 microcontroller has a total of 256 units, which are usually divided into two parts according to their functions: the lower 128 units (unit address 00H ~ 7FH) and the upper 128 units (unit address 80H ~ FFH). The figure shows the configuration diagram of the lower 128 units. Register area
[Microcontroller]
Detailed Analysis of the Internal Data Memory RAM of MCS-51 MCU
The design of 51 microcontroller to display 0-7 in sequence on 8-bit digital tube
Common anode array 0~9: display ={0xC0, 0xF9, 0xA4, 0xB0, 0x91, 0xA2, 0x82, 0xF8, 0x80, 0x90} Common anode array A~F: display ={0x88, 0x83, 0xA6, 0xC1, 0x86, 0x8E} Common cathode array 0~9: display ={0x3F, 0x06, 0x5B, 0x4F, 0x6E, 0x6D, 0x7D, 0x07, 0x7F, 0x6F} Common cathode array A~F: display ={0x77, 0x7C, 0x59, 0x3E,
[Microcontroller]
The design of 51 microcontroller to display 0-7 in sequence on 8-bit digital tube
Learn S3C2440 bare metal development under Keil from 0 - 3 Using external NORFLASH + internal RAM
About S3C2440 startup method: After the program is downloaded to NORFLASH, choose to start from NORFLASH and execute automatically. The code is executed in NORFLASH and variables are allocated in the internal RAM. The address of NORFLASH itself is mapped to 0X0000000, and the internal RAM is used as the memory. After
[Microcontroller]
Learn S3C2440 bare metal development under Keil from 0 - 3 Using external NORFLASH + internal RAM
AT89C2051 single chip ultrasonic distance measurement system hardware principle
AT89C2051 single-chip microcomputer ultrasonic ranging system single-chip microcomputer main control chip uses 51 series AT89C2051 single-chip microcomputer, which has stable working performance and is also a control chip frequently used in single-chip microcomputer course design. The transmitting circuit is directly
[Microcontroller]
AT89C2051 single chip ultrasonic distance measurement system hardware principle
51 single chip microcomputer gy906 temperature measurement, voice broadcast, eepromc storage
This is a small design I made last year, mainly used to measure body temperature. Due to the special situation this year due to the epidemic, I wanted to share this design, but I found a problem when I was looking for materials on Taobao. The prices have all gone up, which is a bit uncomfortable. I also downloaded the
[Microcontroller]
51 single chip microcomputer gy906 temperature measurement, voice broadcast, eepromc storage
51 MCU Tutorial from Scratch - Part 5 MCU Mini Program
Try to use assembly language to write a small program Our last program was really useless. We had to rewrite the chip to make the light turn on. Now we want to make the light flash continuously, which has certain practical value, for example, it can be used as a signal light on a car. How can we make th
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号