This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

xdata memory with ADuC842

I'm trying to store data in the xdata memory location beginning at 0x000. What is wrong with my code?

typedef struct
{
	unsigned int X1;
	unsigned int X2;
	unsigned int X3;
}fordon;


fordon xdata reg[10] _at_ 0x000;

reg[0].X1 = 150;
reg[0].X2 = 160;
reg[0].X3 = 170;

printf("X1 = %d, X2 = %d, X3 = %d",reg[0].X1,reg[0].X2,reg[0].X3);

And this doesn't work! The print out is as follows:

X1 = 15324, X2 = 14378, X3 = 170

Regard

Jonas Finell

Parents
  • As Keil support said you have to set up XRAM in the startup.A51(otherwise referred to as Start_AD.a51)

    ; On-chip XDATA RAM
    ; XRAMEN     Val  Description
    ; ------     ---  -----------
    XRAMEN EQU 1; 0 = disable on-chip XDATA RAM and access off-chip XDATA space
    ;           ; 1 = enable on-chip XDATA RAM
    

    By the way, how is that '842 working for you? I was looking at the '841 mainly for the speed increase but it had silicon issues so I stuck with the '831.

Reply
  • As Keil support said you have to set up XRAM in the startup.A51(otherwise referred to as Start_AD.a51)

    ; On-chip XDATA RAM
    ; XRAMEN     Val  Description
    ; ------     ---  -----------
    XRAMEN EQU 1; 0 = disable on-chip XDATA RAM and access off-chip XDATA space
    ;           ; 1 = enable on-chip XDATA RAM
    

    By the way, how is that '842 working for you? I was looking at the '841 mainly for the speed increase but it had silicon issues so I stuck with the '831.

Children
No data