View Single Post
Old 05-11-2009, 10:35 AM   #1193 (permalink)
charlie_fd
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
Originally Posted by esoneson View Post
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;
}
  Reply With Quote