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.
As a Newbie to 8051_C I have a steep learning curve to climb. I wrote the following simple program: #include <REG320.H> #include <stdio.h> int xdata LED _at_ 0x0fd40; /*LED Mapped to External Memory Location FD40 via PAL */ sbit SW = P1^0; /*Switch connected to P1.0*/ void main (void) { SW = 1; /* Configure P1.0 as an input */ while (1) /* Forever Make LED lite if SWitch is on */ { LED = SW; /* Copy P1.0 to Memory Location FD40 */ } } In the debugger I watch SW, LED and memory location FD40. If I toggle P1.0 (SW) varible LED toggles but Memory FD40 never changes. What am I doing wrong? Thanks Brian
It could be due to the fact that an int is 16 bits, so when writing LED, the MSByte (always zero in this case) gets written to 0xFD40, then the LSByte (zero or one, according to SW state) getw written to 0xFD41. Try changing LED to be an unsigned char (i.e., a single byte).
Read the uVisiom Getting Started Guide, and work through the example projects in there
"As a Newbie to 8051_C" See this thread: http://www.keil.com/forum/docs/thread3387.asp
I may have found my Error. I think my memory window is pointing to code space. How do I redirect it to external Data space? Thanks Brian
If your memory window is pointing to code space, the addresses will be prefixed with "C:". To display external (XDATA) memory, prefix your address entry with "X:" in the address entry box.
That was it! Thanks much Brian