Solved

Sending Hex values with MSComm?

Posted on 2006-06-16
3
668 Views
Last Modified: 2012-06-27
I have an application that needs to send a piece of equipment command lines in the following form:

SOH TYPE [##] STX [DATA_TEXT] ETX [BCC] CR

Bracketed items are optional data. TYPE, ##, and DATA_TEXT are all text. SOH, STX, ETX, and CR are all Hex values but I get an error when trying to send a hex value with MSComm. My question is...how would I send the following parameters using MSComm?

&H1 P AA &H2 Hello World &H3 &HD

Thanks In Advance,
Randy
0
Comment
Question by:RandyB30
  • 2
3 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 16921402


dim s as string

s = chr(1) & chr(2) & "hello world" & chr(3) & chr(13)

use s to send
0
 
LVL 1

Author Comment

by:RandyB30
ID: 16923733
Thanks for the response.

How would I send the hex value &h1EE? I get an error when I use the chr() function.

Thanks Again,
Randy
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 250 total points
ID: 16926579
chr is only handle a byte

use chrW
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now