XDATA problem (v2.20)

General discussion on mikroPascal PRO for 8051.
Post Reply
Author
Message
zka67
Posts: 7
Joined: 30 Jun 2012 01:24

XDATA problem (v2.20)

#1 Post by zka67 » 30 Jun 2012 01:41

Hi!

I tried the compiler, but I can not create XDATA variables.
I selected the large model.

program test1;
var i: integer; xdata;
begin
i: = 2;
end.

and I get a "not enough RAM 'i'" error.
How can I use external memory with this compiler?

TurboProgger
Posts: 66
Joined: 04 Oct 2008 18:39
Location: Germany

Re: XDATA problem (v2.20)

#2 Post by TurboProgger » 30 Jun 2012 11:32

Hi zka67,

which µC did u choose?

another error:

Code: Select all

program test1;
var i: integer; xdata;
begin
  i  :=  2;     // colon and equality sign must be written together (in one word).
end.

zka67
Posts: 7
Joined: 30 Jun 2012 01:24

Re: XDATA problem (v2.20)

#3 Post by zka67 » 30 Jun 2012 12:46

Hi! AT89S8253

TurboProgger
Posts: 66
Joined: 04 Oct 2008 18:39
Location: Germany

Re: XDATA problem (v2.20)

#4 Post by TurboProgger » 30 Jun 2012 19:39

Assuming you took a look at the datasheet of the AT89S8253, you could recognize,
that this µC lacks the internal (S)RAM. Those chips (like the famous 8052) were made
to work almost with external RAM (like a 62256).

Download the datasheet of this µC and carefully read the descriptions of following pins:
ALE
EA
PSEN

change "xdata" to "idata" in your program, but dont expect to have more than 256 bytes of RAM :)

Regards

zka67
Posts: 7
Joined: 30 Jun 2012 01:24

Re: XDATA problem (v2.20)

#5 Post by zka67 » 30 Jun 2012 20:11

Yes, I am aware of this, but I can not write a program with external memory?
These microcontrollers are able to 64 kbytes code and 64 kbytes of data memory combined treatment.

In the compiler is not possible to override the memory settings?
Example: {$M CODE Start, CODE Size, XDATA Start, XDATA Size, Heap Size}

I am currently use the Turbo 51, but seeking a better compiler.

TurboProgger
Posts: 66
Joined: 04 Oct 2008 18:39
Location: Germany

Re: XDATA problem (v2.20)

#6 Post by TurboProgger » 01 Jul 2012 03:19

The µC you mentioned has at least 256 bytes of internal RAM.
If you need more RAM you have to switch to another mikro or search Google for
a suitable layout for your µController.

These microcontrollers are able to 64 kbytes code and 64 kbytes of data memory combined treatment.
But only, if you combine them with external RAM (and ROM). There are many schematics on the internet
using external RAM chips.

zka67
Posts: 7
Joined: 30 Jun 2012 01:24

Re: XDATA problem (v2.20)

#7 Post by zka67 » 01 Jul 2012 11:14

You're talking about something else, like my problem.
I am aware of the construction of the microcontroller, I have designed more dozens of circuit already.
The problem remains as to why not to use external memory to the compiler?
This problem is independent of the type of microcontroller and the structure of hardware.
I have designed and built some circuit that includes two pieces AT28C256 flash memory and two pieces 65256 ram around the AT89S8253.
I looking a Pascal compiler that can handle the external memory and can generate code up to 64 kbytes.
Your compiler can be solved? If not, I would be totally unnecessary buy your program.

Edit: Meanwhile I found the solution. I opened the AT89S8253.mlk file, and I changed some things in it:

Code: Select all

        <DEVICE_NAME>AT89S8253</DEVICE_NAME>
        <ROM>
                <MIN_ADDR>0x0000</MIN_ADDR>
                <MAX_ADDR>0xFFFF</MAX_ADDR>
        </ROM>
and remove the comment, and
  • <XDATA>
    <MIN_ADDR>0x0000</MIN_ADDR>
    <MAX_ADDR>0xFFFF</MAX_ADDR>
    </XDATA>
and so now it works perfectly.

This is the answer I was looking for, but I had to figure out.

TurboProgger
Posts: 66
Joined: 04 Oct 2008 18:39
Location: Germany

Re: XDATA problem (v2.20)

#8 Post by TurboProgger » 05 Jul 2012 19:21

Sorry, but I misunderstood you.

If you take a further look at AT89S8253.MLK you will find this:

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>       -->
        <!-- User can setup external ROM interface by uncommenting PDATA node
  <PDATA>
    <MIN_ADDR>0x00</MIN_ADDR>
    <MAX_ADDR>0x4A</MAX_ADDR>
  </PDATA>       -->
Maybe that's what you are looking for.

zka67
Posts: 7
Joined: 30 Jun 2012 01:24

Re: XDATA problem (v2.20)

#9 Post by zka67 » 05 Jul 2012 20:35

For me this is a new compiler, and many things are not described in the documentation, including also the .mlc files.

Code: Select all

<XDATA>
    <MIN_ADDR>0x00</MIN_ADDR>
    <MAX_ADDR>0xFF</MAX_ADDR>
  </XDATA>
Here is the address values in bytes or pages mean?
If the XDATA memory is 64 kilobytes, the MAX_ADDR value 0xFFFF or 0xFF?

Post Reply

Return to “mikroPascal PRO for 8051 General”