I just started using kile c51 compiler with µVision. My problem is only a stylistic issue. While initializing my controler: <dir>
unsigned char dummy1 = 0xFF; /* call openADC0 */ openADC0( dummy1 ); unsigned char dummy2 = 0xFF; /* call openADC0 */ openUART0( dummy2 );
From the snippet given, I don't see any point to having the variable at all, instead of passing the constant 0xFF directly to the function. But perhaps there's more to the actual code. ANSI C does permit declaration of local blocks, inside of which you can declare variables. This is an often overlooked feature of C. It's sometimes handy to constrain the scope of temporary variables. The following is legal ANSI C.
{ unsigned int data dummy1 = 0xFF; func1 (dummy1); } { unsigned int data dummy2 = 0xFF; func2 (dummy2); }
Thank you all very much for your know how and for Your effort. I learned a lot and I hope I will be learning a lot more here as well as in other threads. Regards J.
Note that what you have learned here is standard ANSI 'C' - nothing specifcally to do with Keil nor the 8051!