How to write/access data thou' other device for AT89S51

Thread Starter


Joined Dec 29, 2006
How to write/access data thou' other device for AT89S51.

What command should i write in C program to read or write data.

what signal it come in WR, RD, and PSEN pin during writing and reading data.

what should I make to write a data into the microprocessor.

Kindly help me


Joined Feb 24, 2006
Since the 8051 architecture has a number of features not anticipated by KnR you have to understand the hardware architecture of the 8051 variant AND the compiler you have chosen.

To read or write the values of an SFR you use assignment statements
Rich (BB code):
   TMOD = 0x11 ;         /* Seleect mode for Timer 1/Timer 0  */
   TR0  = 1 ;            /* Start Timer 1 */
   serial_char = SBUF ;  /* Read UART data buffer */
Memory variables can be located in the directly accessible space called "data" by some compilers, or in the indirectly accessible space called "idata" by some compilers, or the externally accessible space called "xdata" by some compilers. How variables get assigned to those spaces and to the bit addressable address space is compiler dependent.

The hardware signal PSEN* is used only for instruction fetches from an external EPROM or FLASH. It would normally connect to the OE* pin of the read only memory. It is also used by the "MOVC" instruction. RD* and WR* are used only by the indirect data access instruction "MOVX"

The following code fragment, using assignment statements exclusively, will allow you to see the code generated by your compiler for various situations.

Rich (BB code):
data  unsigned char chd ;
idata unsigned char chi ;
xdata unsigned char chx ;
  chd = 'a' ;
  chi = chd ;
  chx = chi ;
  chx = 'b';
  chi = chx ;
  chd = chi ;