Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
move the variable definition of 'LED_On' at the first position in main() function (above interrupt enable) and try again.
If I remember correctly the Keil compiler doesn't allow definitions/declarations 'in the middle of the code'.
You are amazing! That was it. I moved it to above the interrupt enable and it compiled fine. I have never seen anything about that. I am still looking for something from Cypress that presents just such issues and haven't been successful yet.
1 of 1 people found this helpful
This is nothing special about Cypress, or even Keil. It depends on the C-language level that supported by the Keil compiler - older version just don't allow variable declaration anywhere but on the top of the function. Probably the Keil documentation states this somewhere.
OK. I haven't run across that issue before this, I am training in C and C++ using CodeBlocks and have experimented with adding declarations everywhere with no problems. Prior to this I have written everything in assembler for embedded systems, due to comfort. I tried to find some information about the rules in the Keil help system but haven't found it yet.
I'm glad to have the community to help with stuff like this, so thanks for your reply, it's appreciated. Now I know something that I didn't. There's a lot to learn.
A search for "Keil C51" (which is the compiler used) leads to http://www.keil.com/c51/ , which leads then to http://www.keil.com/support/man/docs/c51/c51_intro.htm which proudly states:
The Cx51 Optimizing C Compiler is a complete implementation of the American National Standards Institute (ANSI) standard for the C language.
If you look a little bit further you find http://www.keil.com/support/man/docs/c51/c51_xa.htm which states:
The Cx51 Compiler is based on ISO/IEC 9899:1990 standard (which is also known as ANSI C Standard C90).
When you look at Wikipedia pages for ANSI C, you find that intermingled declarations and code got introduced only with C99. Its quite a new feature...
glad that I can help =)