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.

basic question regarding 8051 assembly language

Status
Not open for further replies.

malli_1729

Full Member level 5
Joined
Feb 13, 2007
Messages
252
Helped
48
Reputation
96
Reaction score
46
Trophy points
1,308
Location
INDIA
Activity points
3,292
Hi!

Iam new to microcontrollers..............................
this is small problem only... but ,iam elaborating the problem....
so, please patiently read..............


In assembly language, iam using the commands MOVX A,@DPTR;

Actually what i know is:
when we want to read operation we should send CE#, ALE,..Etc......
but simply with this command we are reading the data,

when we issue this command actually ,they are sending all these signals internally or not................

i want the explanation,,,,,

Please help me.......................
Please help me.......................
 

The control signals such as /RD and /WR are generated automatically by the 8051's hardware, while executing MOVX A, @DPTR and MOVX @DPTR, A respectively ..
The ALE signal is always generated, wheter you like it or not .. And the /CE (chip enable) pin of the external RAM is usually connected to 0V (GND) unless you have more RAMs in the system and you have to select the one that you want to activate .. see picture below ..

Regards,
IanP
 

Thank u IanP...........

again iam having small problem.....................

whenever we are reading the data from ram or rom ..
1st we will enable the chip by giving the chip enable signal ,,here we are putting it directly to ground...ok

then we send the output enable signal(Active low) to enable the output buffers, after reading the data we will make output enable high so,that datalines will float..

for every read operation using MOVX A,@DPTR...
we are doing this operation.. i mean output enable is becoming low for sometime and then becoming high...............

Becuase, i need to all these things for interfacing AT29c256 with AT89s51....
in AT29c256 they have given that at a time we have to give the 64bytes for programming and for every byte in 64 bytes we have to make chip enable high to low........................., so that' why iam asking these questions, by programming i have to do, or it will be done internally i don't know.....................


please help me..........................
 

Perhaps you can try this:
Connect /RD of the 89S52 to /OE of the 29C256 (for standard READ operation) ..
After writing a page of 64 bytes perform a dummy reading cycle with DPTR loaded with FFFFh .. This should give you a High-to-Low (and back to High) transition on the /OE pin ..

Regards,
IanP
 

Thank u IanP...........

Thank u for answering...........

it has some problem...........


After writing 64 bytes u told to do the dummy write operation at the location FFFFh..

Actually in the 64 byte program operation for every byte writing i need to have high to low transition on the chip enable pin....................................

i want to try like this:

i will connect any bit of port1(here iam using p1.1) to the chip enable pin, in that pin i will send the corresponding signals (high to low(1 to 0)) on that pin in the writing process.


iam giving my idea like this in the code......
flash progarm function:




void flash_prog(unsigned char xdata *addr, unsigned char *value)
{
addr=addr;

flash_cmd(0xA0);
flash_wr(addr, value);
while (flash_rd(addr) != value[0]);
}


void flash_cmd(unsigned char cmd)
{
unsigned char xdata *ad1;
unsigned char xdata *ad2;
ad1=0x5555;
ad2=0x2AAA;

*ad1=0xAA;
*ad2=0x55;
*ad1=cmd;

}




void flash_wr(unsigned char xdata *addr, unsigned char *val)
{
int i;
P1.1=1;
for(i=0;i<64;i++)
{
P1.1=0;
*(addr++) = val;
P1.1=1
}
}



unsigned char flash_rd(unsigned char xdata *addr)
{
return *addr;
}

whenever i want to program i want to send the control command as in the datasheet , so,first control command no problem,,,, in the flash_wr(addr,data)

whenever i want to write first iam making p1.1=1 and then before writing iam making p1.1=0; so, that high -to-low transition occurs for writing and then making p1.1 =1 high for next write. in between i have add delay ,..........
i will add afterwards , this is the way iam trying....................................

whether it is feasible or not i don't know..........
 

If you want to be able to READ and WRITE you should consider combining both signals (P1.1 and /RD) into one by feeding them to an AND gate and connect the output to the 29C256's /OE pin ..

The easiest way to find out whether this idea works, or not, is to write a short code and just test it ..

Rgards,
IanP
 

for avoide of any buttleneck and limiting 8051 enables to connect to external memory(up to 64kb) with use of ea(external access) and psen(program storage enable). movx instructin use for addressing external memory.with @dptr the data go in address of dptr(example:if dptr=0100h so data save in 0100h or data in 0100h save in a ).
 

I have two doubts,

1. first command MOVX A,@DPTR is used only to access external memory, i want to access DPTR resides in internal memory of 8051 as my task is to putting 00h at the location where DPTR is denoting. for external memory it can be be done as follow

MOV A,00H
MOVX @DPTR,A

but how this can be done in internal memory of 8051?

2. If somehow i got the result i.e. 16-BIT Address and it got save in register say R3 and R4 then how can i use these separated 2 8-BIT [2X8=16BIT Address] to be access and use for my problem statement as mentioned above i.e. putting 00h at the location where DPTR

Please Reply Soon

Regards
Hitesh Rohilla
 
Last edited:

1.use:
movc a,@a+dptr

2.mov dph,r2
mov dpl,r3
movc a,@a+dptr

all the above can read only. you cannot write into the program memory location.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top