I have hardware that needs to be accessed from 0xc00000 to 0xefffff. I have tried declaring it in an external ASM file and then to use it as a extern var in C. But this does not seem to work.
Please help!
asm file:
PUBLIC PPI_REG PPI_REG XDATA 0x00c00000 END
c file:
extern unsigned char PPI_REG[4]; ... PPI[0] = 0x00; ...
You'll have problems accessing memory above 0x7FFFFF from C because of the way Keil have implemented a pointer that allows you to access more than 64K. It is actually a modification of the generic pointer where the high byte (of three) is used to specify the address space.
Normally this would be a value that indicates (for example) DATA, XDATA, CODE.
The extension uses the high byte to specify a particular bank of 64K. In C, you would have to use the 'far' qualifier on the pointer to specify this.
Although I cannot find the text in the manuals at the moment, I seem to remember reading that the extension precludes access to anything beyond 0x7FFFFF.
What I opted to do in our project was to access the 'extra space' with functions in assembler. I was then in precise control of what was occuring; so less likely to have made errors.
Hi David
Thanks for the comments.
The assembler type of access was given my Keil themselves. (I think) This is a workaround exactly for this kind of problem and specifically the DALLAS 80C400.
In the end I will most likely have to settle for the assembler solution, it's just that the C code is alread complicated as is, but I should be able to separate certain parts and only leave the actual hardware access to assembler.
Thanks again.