Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[HELP] Write data to RAM

Status
Not open for further replies.

hongphuc118

Member level 2
Joined
Jun 25, 2011
Messages
52
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Location
Ha Noi,Viet Nam
Activity points
1,514
I use RAM 49F010 for 89C51.
Can you show me how to read and write data in this RAM in Keil C?
 

There are not enought pins to couple 89C51 to the 49F010.

Are you concerning to use that memory only to store data, wrigth ?
( 89 cores already performs access to internal flash program memory )

+++
 

Try something like this:

Code:
;data write
asm
	MOV	DPTR, Address; 16bit address
	MOV	A, Data
	MOVX	@DPTR, A
/asm



;data read
asm
	MOV	DPTR, Address; 16bit address
	MOVX	A, @DPTR
/asm

:wink:
IanP
 

First of all, read the datasheet for 49F010, it is not RAM, it is FLASH memory (aka FLASH EPROM). Before writing data to the chip it must be 'erased' i.e. all locations must have value of FFh.

Anyhow, if you need 1 Mbit capacity and speed is not much of concern, you can use 25AA1025 I2C serial EEPROM, it takes only 2 pins from your uC (SCL and SDA).
 

Attachments

  • 49F010.pdf
    247.2 KB · Views: 92

Here are my code! I don't understand why it isn't working.Can you repair it for me?


#include <regx51.h>
#include<absacc.h>
#define First 0x5555 //
#define Second 0x2AAA //
#define A16 P3_4


void wr49(unsigned int adr, unsigned char dt)
{
XBYTE[First] = 0xAA;
XBYTE[Second]= 0x55;
XBYTE[First] = 0xA0;
XBYTE[adr] = dt;

}

////////////////////////////////////////////
void erase49(void)
{
XBYTE[First] = 0xAA;
XBYTE[Second]= 0x55;
XBYTE[First] = 0x80;
XBYTE[First] = 0xAA;
XBYTE[Second]= 0x55;
XBYTE[First] = 0x10;

}
unsigned char read(unsigned int adr)
{
return(XBYTE[adr]);
}
void main()
{
A16 = 0;
erase49();
wr49(1,16);
P1 = read(1);
while(1);
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top