Bit Manipulation


Author Message
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 11:28pm 03 Mar 2012      

Hi

I have a 16 bit register that requires the data to be sent as
2 8 bit bytes. The value that needs to be sent is 8 bits and needs to be
shifted to the right by 6
For example &B11000011 needs to be represented as
HighByte = &B00110000
LowByte = &B11000000

To get the correct 16 bit number I can times the number by 64
so &B11000011 x &B1000000 = &B0011000011000000
So now we it shifted to the left by 6 places
I Can get the HighByte by &B11000011 / &B100 = &B00110000

Now to get the LowByte = STUCK


Any Help would be greatly appreciated

Regards

John