troubleshooting Question

byte conversion question

Avatar of craigdev
craigdev asked on
Visual Basic.NET
11 Comments3 Solutions235 ViewsLast Modified:
I need to write a function to convert a one or two digit number into a single byte starting with 1. Can someone please explain what I need to do?

Im doing serial port communication with an external device. Basically I want to send the address command "12" to the device, or in byte form starting with a 1 it would be 10001100. In the notes for the protocol it says the address should be "1 byte, 0-127 must add 128 to indicate as address".

Just wondering how I should calculate the bytes to send?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros