BIT manipulation...

Hello,

I am haveing an external 8 bit storage device.

I want to store three kinds of information in one byte:

Bit 1 - Bit 6 should represent a number (0-63), which shell get converted to an integer after reading form the external storage device.

Bit 7 should indicate if the number is negative or positive.

Bit 8 should simply hold a true or false information.

The question is how do I seperate Bit 1 - 6 from the rest to converte it to an integer and how to get hold on Bit7 and Bit 8...

And how do I create such a 8 bit word?

Thx!

bitRead / bitWrite are designed for this purpose. Note, however that bits number from zero, not one.

Look at the "bitwise" logic operators in the reference section. eg & ! | etc.

Mark

Perfect, that was exactly what I was looking for. :)

thx