Hi Sir,
I am trying to do AND operation with a binary number. I;m little bit confused, here in forums for representation of binary number in keil is 11001100Y but while I'm trying to do the same it ixs showing the error.
I'm using MDK5 the syntax i mentioned is
char a;
a|= 11001100Y;
The error I'm getting is Invalid Suffix on Integer constant.
Does any one please clarify me the issue.
Thanks & Regards Prasanna Kumari
Binary representation of constants is not a standard c feature.
If you really want it, write a macro to provide support for it or search for an existing one.
As most as possible you should try to avoid compiler-specific extensions unless you really need them. Compiler-specific extensions makes it very hard to move your code to a different processor where you might have to switch compiler.
Either learn how to convert between binary and hexadecimal - only 16 combinations so easy to memorize or count on your fingers. Or do as suggested and get a preprocessor package that creates preprocessor symbols that represents the different binary values.
Are you are sure about that?
The uVision Debugger does, indeed, support this:
http://www.keil.com/support/man/docs/uv4/uv4_db_exp_constants.htm
But that is not the same thing at all as saying that any (let alone all) Keil Compiler(s) support it ...
As others have said, it is not a standard 'C' thing; so you might as well learn how to use hex - for the cases where you have to use a compiler without the extension.
Or use the preprocessor to do it in a portable way ...