I've written my first program in Keil uVision2 just to toggle a led with my 8052 microcontroller. Code looks like this: #define P3 *(volatile unsigned int *)0x00B0; //I/O pin to be toggled void main (void) { //declarations unsigned int toggle = 0x01; unsigned long i; //dummy variable to slow down led toggling //main program while (1) { for (i=0; i<=1000000; i++); toggle ^= 0x01; if (toggle == 0x00) * P3 = 0x01; * else * P3 = 0x00; } } The compiler complains about the lines in the if-else construction marked with an "*". It says: syntax error near '=' syntax error near 'elsi' syntax error near '=' I have no clue what I'm doing wrong, maybe there's someone out here who has suggestions?
However, I do believe that I can set/reset the i/o pin using the pointer, I intend to find out ASAP, I'll let you know what I find out. If it's the standard 8051 P3 that is at SFR address 0xB0, you can't use a pointer to access it. This is clearly presented in the Intel 8051 data book. Jon