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

Discussion in 'Embedded Systems and Microcontrollers' started by prevravanth, Dec 29, 2006.

  1. prevravanth

    Thread Starter New Member

    Dec 29, 2006
    8
    0
    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
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,170
    1,797
    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
    Code ( (Unknown Language)):
    1.  
    2.    TMOD = 0x11 ;         /* Seleect mode for Timer 1/Timer 0  */
    3.    TR0  = 1 ;            /* Start Timer 1 */
    4.    serial_char = SBUF ;  /* Read UART data buffer */
    5.  
    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.

    Code ( (Unknown Language)):
    1.  
    2. data  unsigned char chd ;
    3. idata unsigned char chi ;
    4. xdata unsigned char chx ;
    5.  
    6.   chd = 'a' ;
    7.   chi = chd ;
    8.   chx = chi ;
    9.  
    10.   chx = 'b';
    11.   chi = chx ;
    12.   chd = chi ;
    13.  
    Savey?
     
Loading...