ermtariq2
Newbie level 4
Hi all,
can any body help me how to write and read the particular location on external RAM (accessing the memory address ).
I am trying the Code:
#define POSITION 0X12000
void main()
{
unsigned char xdata chr;
unsigned char str;
chr='A'
ram_writep0(POSITION,chr);
str=ram_readp0(POSITION);
}
void ram_writep0(unsigned char posi,unsigned char writechar)
{
SRAMA16=0;
SRAMA17=0;
SRAMA18=0;
DATAPORT=posi;
SEL573L=1;
// _nop_();
SEL573L=0;
DATAPORT=0;
SEL573H=1;
//_nop_();
SEL573H=0;
DATAPORT=writechar;
SELK6=0;
WR=0;
//_nop_();
WR=1;
SELK6=1;
}
unsigned char ram_readp0(unsigned char posi)
{
unsigned char tempdata;
SRAMA16=0;
SRAMA17=0;
SRAMA18=0;
DATAPORT=posi;
SEL573L=1;
//_nop_();
SEL573L=0;
DATAPORT=0;
SEL573H=1;
//_nop_();
SEL573H=0;
DATAPORT=0XFF;
SELK6=0;
RD=0;
// _nop_();
tempdata=DATAPORT;
RD=1;
SELK6=1;
return tempdata;
}
I want to write 'A' on specific location and read it from there....
does i m doing write
Any new method is also welcomed.
Thanks
can any body help me how to write and read the particular location on external RAM (accessing the memory address ).
I am trying the Code:
#define POSITION 0X12000
void main()
{
unsigned char xdata chr;
unsigned char str;
chr='A'
ram_writep0(POSITION,chr);
str=ram_readp0(POSITION);
}
void ram_writep0(unsigned char posi,unsigned char writechar)
{
SRAMA16=0;
SRAMA17=0;
SRAMA18=0;
DATAPORT=posi;
SEL573L=1;
// _nop_();
SEL573L=0;
DATAPORT=0;
SEL573H=1;
//_nop_();
SEL573H=0;
DATAPORT=writechar;
SELK6=0;
WR=0;
//_nop_();
WR=1;
SELK6=1;
}
unsigned char ram_readp0(unsigned char posi)
{
unsigned char tempdata;
SRAMA16=0;
SRAMA17=0;
SRAMA18=0;
DATAPORT=posi;
SEL573L=1;
//_nop_();
SEL573L=0;
DATAPORT=0;
SEL573H=1;
//_nop_();
SEL573H=0;
DATAPORT=0XFF;
SELK6=0;
RD=0;
// _nop_();
tempdata=DATAPORT;
RD=1;
SELK6=1;
return tempdata;
}
I want to write 'A' on specific location and read it from there....
does i m doing write
Any new method is also welcomed.
Thanks