Need to separate 16 bit binary to 4bit and 12 bit binary values

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2008
Posts: 4
Reputation: praksk is an unknown quantity at this point 
Solved Threads: 0
praksk praksk is offline Offline
Newbie Poster

Re: Need to separate 16 bit binary to 4bit and 12 bit binary values

 
0
  #11
Jul 26th, 2008
Hi Martin,

Your code for shifting the bits is working for me.
The crux of my problem was to extract the 4 MSB as a 4bit nibble ( values deciphered to be 0 to 15 ) and remaining LSB as a 12 bit integer, from the the 16 bit value.
Your entire code is doing the job well from joining the 2 byte values at the start to giving me the 4 and 12 bit values appropriately at the end.

BTW I had to make a change at line to get proper results ( *256 instead of *255 )

12. sumBytes = byteA * 256 + byteB

Thanks a ton.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 4
Reputation: praksk is an unknown quantity at this point 
Solved Threads: 0
praksk praksk is offline Offline
Newbie Poster

Re: Need to separate 16 bit binary to 4bit and 12 bit binary values

 
0
  #12
Jul 26th, 2008
Hi Teropod,

Your code was illustrative for the Dec2Bin and Bin2Dec conversion.
Thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 51
Reputation: dmf1978 is an unknown quantity at this point 
Solved Threads: 7
dmf1978's Avatar
dmf1978 dmf1978 is offline Offline
Junior Poster in Training

Re: Need to separate 16 bit binary to 4bit and 12 bit binary values

 
0
  #13
Jul 26th, 2008
Originally Posted by praksk View Post
BTW I had to make a change at line to get proper results ( *256 instead of *255 )
I see. I'll change it. Thanks.
If you think that your problem is solved, please, mark as solved this thread.

Regards
-- Martín
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC