Defining XRAM to compiler

General discussion on mikroC PRO for AVR.
Post Reply
Author
Message
rrsquez
Posts: 117
Joined: 23 Feb 2011 21:35

Defining XRAM to compiler

#1 Post by rrsquez » 02 Oct 2015 20:11

Hello. I have an external RAM that is addressed using ports A & C of the ATmega128A mcu.

Here is the problem line: float Loggedtemp[1500]; // a large array of data

The resulting error message is: 90 362 Not enough RAM 'Loggedtemp' GPR1600_variables.c

I have more than enough external memory (32 Kbytes), but I don't know how to let the compiler know this.

Would someone please be kind enough to tell me how to make this work?

In Bascom BASIC, they have commands to support the A16 external addressing:
Config Xram = Enabled (this sets a register in the ATmega128)
$xramstart = &H1100 (how do we do this in C?)
$xramsize = &H8000 (how do we do this in C?)

There are no direct counterparts for these commands in C Language. I implemented a bit-bang method to perform the reads and writes of this memory, but I don't know how to define the address space, as is done with xramstart and xramsize.

Page 116, paragraph 5 of the compiler manual says we can't use this extended memory space. How do we use it? I have

Thank you, Richard V

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Defining XRAM to compiler

#2 Post by filip » 27 Nov 2015 08:36

Hi,

Basically, if you have an external memory chip, the compiler cannot address it as it addresses the internal MCU memory,
so you must provide a communication channel (SPI, I2C, etc) to read/write data into it.

Regards,
Filip.

rrsquez
Posts: 117
Joined: 23 Feb 2011 21:35

Re: Defining XRAM to compiler

#3 Post by rrsquez » 15 Dec 2015 23:52

Hello Filip. I'm sorry to say that BASCOM BASIC has a feature that this compiler does not (among others). They call it "A16 Addressing". I think the Atmel IDE also supports this 16 bit external addressing mode.

Please read my post on Input Port Contention (just posted it). I'm trying to bit-bang the data in since this compiler doesn't support this address mode. I'm trying to read an RTC (real time clock), but I keep having trouble reading in a port that was previously set as an output.

In my opinion, the compiler should support external addressing, but it doesn't. Could we add it to a wish list?

Thank you, Richard V

Post Reply

Return to “mikroC PRO for AVR General”