943,926 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jul 26th, 2008
0

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

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
praksk is offline Offline
4 posts
since Jul 2008
Jul 26th, 2008
0

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

Hi Teropod,

Your code was illustrative for the Dec2Bin and Bin2Dec conversion.
Thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
praksk is offline Offline
4 posts
since Jul 2008
Jul 26th, 2008
0

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

Click to Expand / Collapse  Quote originally posted by praksk ...
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
Reputation Points: 18
Solved Threads: 7
Junior Poster in Training
dmf1978 is offline Offline
51 posts
since Aug 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Upload picture from file
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Need your opinion:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC