Literally Bits

The new version of the MPLAB C32 (v1.05) compiler is out and is filled with new features and a new (as in additional) DSP library designed for compatibility with the dsPIC standard DSP lib. But for me the most exciting piece of news is that “binary” is back.

One of the simplest extensions to the ANSI C standard  offered on all previous Microchip compilers was the ability to define and use binary literals using the “0b” prefix. Example:

int x = 0b000100011;     // instead of 0x23

Now you can use the binary notation with the MPLAB C32 compiler too.

I have to admit, when you are working with 32-bit  long literals, binary could get a bit … tyring, but if you are like me, with a ton of PIC18 and PIC24 code to use and re-use, it sure comes handy…

This entry was posted in PIC32, Tips and Tricks. Bookmark the permalink.