Using: uVision 5 *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil\uVision5\ARM\ARMCC\Bin'
I'm trying to make a variable equal to a binary number, something like:
unsigned char Number = 0b00001111;
The IDE doesn't show any issues on the screen, but the compiler comes back with this error:
..\ZCU\source\code\Debug_rW.c(67): error: #19: extra text after expected end of number
How do I get round this?
Secondly, I which to view that "Number" in a watch window as a binary number, is this possible? I can only see Hex and Decimal as an option.
Many thanks for any input.
Regards, R
C Does not typically provide a way to enter Binary representation of a number, but you could write a macro to do this:
http://www.keil.com/support/docs/1156.htm
Or use the octal notation trick
http://www.keil.com/forum/21497/how-to-input-a-binary-number/
If you are using ARM Compiler 6, you can use ARM Assembly to write a Binary Literal:
developer.arm.com/.../numeric-literals
Show exactly what you actually did, and the results you got.
Yes, I have followed various links... the Suffix "y" or "Y" does not work.
Is there a way of showing a variable as binary in the watch window?
Thanks
Did you not follow the link provided by Brandon Price ?
Yes, doesn't work.
Thanks.
However, as noted, you can set the debugger to display in binary.
How do you do the above?
Many thanks.
Well, it has, apparently, been added to the C++14 standard:
stackoverflow.com/.../difference-between-gcc-binary-literals-and-c14-ones
www.open-std.org/.../n3472.pdf
stackoverflow.com/.../why-doesnt-c-have-binary-literals
You would have to choose a different programming language - 'C' does not support binary literals in source code.
Nothing to do with Keil or ARM.
Did you try using the 'y' or 'Y' suffix?
See this link: http://www.keil.com/support/man/docs/uv4/uv4_db_exp_constants.htm
View all questions in Keil forum