+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Newbie level 4
    Points: 616, Level: 5

    Join Date
    Sep 2009
    Location
    Mumbai
    Posts
    6
    Helped
    0 / 0
    Points
    616
    Level
    5

    External Ram Accessing

    Hi All,

    Can any one help me How to read and write external ram with keil c, using Winbond W77e58.
    Please dont go in hardware detail.
    I am using C languag.
    Thankyou

    •   AltAdvertisement

        
       

  2. #2
    Member level 1
    Points: 866, Level: 6

    Join Date
    Jul 2009
    Posts
    35
    Helped
    6 / 6
    Points
    866
    Level
    6

    Re: External Ram Accessing

    You need to declare the data as xdata.

    example:
    unsigned char xdata variable;

    Also remember there is 1K of internal SRAM controlled by the DME0 bit in the PMR register. If this SRAM is enable, it is mapped to addresses 0x0000 to 0x03FF. Accesses outside this range will access external memory.



  3. #3
    Newbie level 4
    Points: 616, Level: 5

    Join Date
    Sep 2009
    Location
    Mumbai
    Posts
    6
    Helped
    0 / 0
    Points
    616
    Level
    5

    External Ram Accessing

    hi itaig,

    i suppose you are reply only write to RAM , can you reply how to read from ram.



    •   AltAdvertisement

        
       

  4. #4
    Member level 1
    Points: 866, Level: 6

    Join Date
    Jul 2009
    Posts
    35
    Helped
    6 / 6
    Points
    866
    Level
    6

    Re: External Ram Accessing

    Applies to both reading and writing.

    Code:
    char xdata x; // Variable in external memory
    char a; // Normal variable
    char b; // Normal variable
    
    void test(void)
    {
      x = a; // Writes a to external RAM
      b = x; // Reads from external RAM into b
      x ++; // Read from external RAM, add 1 then write back to external RAM
    }



  5. #5
    Newbie level 4
    Points: 616, Level: 5

    Join Date
    Sep 2009
    Location
    Mumbai
    Posts
    6
    Helped
    0 / 0
    Points
    616
    Level
    5

    External Ram Accessing

    Hi itaig ,
    Thanks for reply......

    I have two querstion...

    1. Can I access external RAM without doing anything with internal RAM.
    2. Does external memory varialbe(xdata) required memory location to access it .. or it can can be identify with its name...



  6. #6
    Member level 1
    Points: 866, Level: 6

    Join Date
    Jul 2009
    Posts
    35
    Helped
    6 / 6
    Points
    866
    Level
    6

    Re: External Ram Accessing

    Yes you can access just the external RAM and not use the internal xdata RAM.

    The linker will automatically assign addresses to any variable that has the xdata attribute. You can assign an absolute address if you wish but generally you only need to do this if you have memory mapped I/O.

    Aside from the declaration of the variable, you just treat it as you would any other variable, the compiler will work the rest out for you.



    •   AltAdvertisement

        
       

  7. #7
    Newbie level 4
    Points: 591, Level: 5

    Join Date
    Oct 2009
    Location
    Taiwan
    Posts
    5
    Helped
    0 / 0
    Points
    591
    Level
    5

    Re: External Ram Accessing with keil c, using Winbond W77e58

    Hi guys,


    Continue to the question. If I am using eeprom, can the same method applied? and can i output read value from P0?



    Thank you!



--[[ ]]--