Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MScomm object and Hex values

Status
Not open for further replies.

capone67

Programmer
Nov 6, 2000
115
0
0
CA
Hi Gang

How do I send a Hex number to the serial port on my system using the mscomm object? Also how do I string together a bunch of hex numbers to be sent to the comm port as one command? for example &H2 + &H3 + &H4 all get added together but I need to send them as 3 seperate numbers. Would sending them to the mscomm.output one at a time be the equivalent of sending them all at once not added together?

Ken
 
Have a look at the code I posted in thread222-38441 Conversion of 4 bytes to a single. The code can easily be downsized to 3 bytes (and Hex values) _________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Send it in a Byte array, you should be in binary mode.

MSComm.InputMode = comInputModeBinary

Dim ByteArray(2) as Byte

ByteArray(0) = &H2
ByteArray(1) = &H3
ByteArray(2) = &H4

Mscomm.Output = ByteArray()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top