Quote:
Originally Posted by esoneson
Paul and Adrian,
....
... I will email you some guidelines for dealing with bits-on bits-off so you don't have to do the 128+64+....stuff. It will all be clear.
...
Eric
|
What I did when using C for microcontroller projects was to use macros to be able to represent binary as binary. Using hex is another option that makes it more readable than the decimal sum
I've uploaded the header with those macros on svn
/trunk/macro-binaryconstant.h - Open ReVolt - Trac
using the macro will allow you to write smth like:
Code:
#include "macro-binaryconstant.h"
int main()
{
int i = B8(1010); // 8 bit binary representation of the decimal number 10
int j = B8(10000000); // 8 bit binary representation of the decimal number 128
return 0;
}