I/O mapped as XRAM

General discussion on mikroC PRO for 8051.
Post Reply
Author
Message
gabrielrpaz
Posts: 1
Joined: 05 Feb 2010 00:18

I/O mapped as XRAM

#1 Post by gabrielrpaz » 05 Feb 2010 00:31

Hello;

I wonder how to allocate a variable in XRAM in an absolute address
of 16Bits, I need this kind of access, because in my application there is an display LCD mapped as external memory:

Address 0x8000 -> Writing instruction
Address 0x8001 -> Writing data

I tried to perform as follows:

static short xdata inst_lcd absolute 0x8000;
static short xdata dado_lcd absolute 0x8001;

But does not compile, only compile if the address is placed in 8Bits.

Is there any solution for this case?

Thank you.

Gabriel.

eletroncard
Posts: 6
Joined: 07 Jun 2010 02:31

Re: I/O mapped as XRAM

#2 Post by eletroncard » 07 Jun 2010 02:37

Hello Gabriel,


static short xdata inst_lcd absolute 0x8000;
static short xdata dado_lcd absolute 0x8001;

Is,

#define inst_lcd (*(xdata unsigned char *) 0x8000)
#define dado_lcd (*(xdata unsigned char *) 0x8001)

Good projects!

Carlos Machado.

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: I/O mapped as XRAM

#3 Post by slavisa.zlatanovic » 09 Jun 2010 14:33

Hi Gabriel!

See the *.mlk file for your MCU(look into Defs folder).
You can setup external Ram interface by uncommenting XDATA node.
Also, you can change MIN and MAX addresses of external ram.

Code: Select all

        <!-- User can setup external Ram interface by uncommenting XDATA node
  <XDATA>
    <MIN_ADDR>0x00</MIN_ADDR>
    <MAX_ADDR>0xFF</MAX_ADDR>
  </XDATA>       -->
Best regards
Slavisa
Best regards
Slavisa

Post Reply

Return to “mikroC PRO for 8051 General”