storing bits
As an example:
·
tmpW2_MSB = 1110_0100
·
tmpW2_MSB.0· =· 0
tmpW2_MSB.1 =· 0
·
if I wanted to store two bits of the byte - tmpW2_MSB
·
say tmpW2_MSB.0 and tmpW2_MSB_.1
·
so that
·
some_Variable· =· 00
·
How do I do this?
·
I tried·· some_variable· =· tmpW2_MSB.0,· tmpW2_MSB.1 ·and that didn’t work
·
So I tried some_variable =· tmpW2_MSB.0· + tmpW2_MSB.1· that worked but for the wrong reason.
·
·I don’t want to add them, I just want to store them side by side as one
Mike W
·
tmpW2_MSB = 1110_0100
·
tmpW2_MSB.0· =· 0
tmpW2_MSB.1 =· 0
·
if I wanted to store two bits of the byte - tmpW2_MSB
·
say tmpW2_MSB.0 and tmpW2_MSB_.1
·
so that
·
some_Variable· =· 00
·
How do I do this?
·
I tried·· some_variable· =· tmpW2_MSB.0,· tmpW2_MSB.1 ·and that didn’t work
·
So I tried some_variable =· tmpW2_MSB.0· + tmpW2_MSB.1· that worked but for the wrong reason.
·
·I don’t want to add them, I just want to store them side by side as one
Mike W
Comments
value2 var byte
value1 = 13 '0000_1101
value2 = value1 AND 3 '0000_0001
the AND 3 extracts only bits b0 and b1
regards peter