cancel
Showing results for 
Search instead for 
Did you mean: 

Binary representation in IAR

relaxe
Associate II
Posted on January 07, 2009 at 10:20

Binary representation in IAR

5 REPLIES 5
relaxe
Associate II
Posted on May 17, 2011 at 12:58

Using IAR 5.20:

Normal representation of:

Decimal:

i = 30;

Hex:

i = 0x1E;

How do you write binary variables????

Binary:

i = ?????????????????????

Please!

-Relaxe

paulsmitton9
Associate III
Posted on May 17, 2011 at 12:58

You can use a macro. See:

http://cprog.tomsweb.net/binconst.txt

picguy
Associate II
Posted on May 17, 2011 at 12:58

In the assembler use 01010b and the like

In C/C++ I found nothing in the docs. Given that plus what I tried you may need to use standard C/C++ hex 0xABC or octal 0123.

st3
Associate II
Posted on May 17, 2011 at 12:58

The standard 'C' programming language provides no way to write binary constants.

If IAR have provided some extension to allow this, then it will be in their Documentaion - but this is quite uncommon. :(

Given that anything you might find is totally non-standard and, therefore, totally non-portable, I suggest that you just stick to Hex.

stevemelnikoff9
Associate II
Posted on May 17, 2011 at 12:58

Some compilers allow binary data to be represented by starting the value with ''0b'', e.g.: 0b00000000.

Steve.