I try to access a large data buffer using a far pointer that can exceed the 64k boundary, using the method introduced in http://www.keil.com/support/docs/2663.htm.
But when I made the declaration as follows and compiled the codes, an compiling error came up: SF1PROG.C(82): error C129: missing ';' before '*'
#include <absacc.h> unsigned char far *farBuff = FARRAY(unsigned char, 0x110000);
Can anyone help me out? Thank you so much.
Without the hardware, I tried to read/write the content of the far memory area HDATA (X:0x020000-X:0x02FFFF) in KEIL uVision3. I have specified this user class in the LX51 Locate. The compiling was successful.
But when I entered the 'debug' process, executed the source code and observe the memory window, the memory area X:0x020000-X:0x02BFFF didn't change at all, but instead the area X:0x000000-X:0x00BFFF was changed according to my requirements. The source code is as follows:
#include <REG52.H> // SFR definition header file #include <stdio.h> // prototype declarations for I/O functions #include <absacc.h> unsigned char far large_array[0xC000]; void main (void) { unsigned int i; for (i = 0; i < sizeof (large_array); i++) { large_array[i] = (unsigned char) i; } }
I am using Intel 80C32 as the device. Can anyone here help me out of the strange trouble? Thanks a lot!
A normal 8032 does not have any hardware for far addressing. How is the simulator supposed to know that you intend to have such? You'd need to either pick a device that has built-in extended addressing, or configure the simulator to know that you have such hardware, even though the device you picked does not.
Unfortunately, I'm not very familiar with running code under the simulator. (My 8051 projects involve a core embedded in a fairly complex ASIC, and it would take a very long time to write a simulator for the ASIC just so the 8051 code could be executed. Easier to run on a real target.)
See the far memory examples such as the one in
C:\Keil\C51\EXAMPLES\FarMemory\4MB Variables on Classic 8051
Thank you for your kind help. You noted that:
or configure the simulator to know that you have such hardware, even though the device you picked does not.
Would you please explain in detail how I can configure the simulator? Do I need to configure XBANKING.A51?
Thank you!