How to convert 8bit value to 8 values

Stinen

New Member
Excuse my english,

i need to convert value b10 to single 1,1,1,1,1,1,1,1 code and I cant move...
for example:

b10=255 (%11111111)

and i need make b0=1, b1=1, b2=1, b3=1, b4=1, b5=1, b6=1, b7=1

or b10=3

and i need make b0=0, b1=0, b2=0, b3=0, b4=0, b5=1, b6=0, b7=1

or ...
or ...
or ...


Is some mathematic for this?

Thanks a lot Carlos :)
 

premelec

Senior Member
you can use the AND function b0 = b10 AND %0001 etc . Or you could put b10 into B0 and look at Bit0 through Bit7
 
Top