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'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..." OK, for some, experience is the best teacher.
Forgive me my stubborness. I'll try to get things to work with your suggestions, by declaring a SFR. Thank you all for your support!