It is not possible to use binary notation (for example 0b01010101) in C-source when compiling with an IAR Systems compiler.
The notation 0b01010101 is not supported by the C-language (neither in C99 nor in C89). IAR Systems has not added any extension to support such notation. (Such an extension would make the C-source less portable.)
The solution is straight forward, as (for example) the binary value of 5 can be implemented as...
#define b0000000000000101 0x0005
...and such a #define can be added for any binary value in use in the application.
In order to simplify, download this zip file. The zip file contains two files:
Please note that the text files are not header files from a C perspective. (The larger file holds over 64.000 #defines, which makes it very cumbersome.)
Instead copy the needed #define's from the text file and add them to a header file in your project. In this way you get no build time penalty because of unused #define's.
All product names are trademarks or registered trademarks of their respective owners.
© IAR Systems 1995-2021 - All rights reserved.
We use cookies on this website to provide you with a better experience. You need to accept cookies to continue using this site. Cookies