We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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);
"I marked the "Use onchip Xdata" in the target dialog. Is this enought or do I have to implement the startupfile in some way?" No, it is not enough. This option is very poorly named and, consequently, very frequently misunderstood. I couldn't find the Thread where someone else actually made that very same point, but here are some examples of the confusion it causes: http://www.keil.com/forum/docs/thread3898.asp http://www.keil.com/forum/docs/thread4241.asp http://www.keil.com/forum/docs/thread4119.asp http://www.keil.com/forum/docs/thread4789.asp Checking this option does not generate any code to do the necessaries to physically enable the on-chip RAM in the target processor; Checking this option is simply a shortcut for you to inform the tools that you will be using the on-chip RAM - it is still up to you to provide the code to set up the necessary configurations.