|
-
Apr 10th, 2007, 09:35 PM
#1
Thread Starter
New Member
send HEX to serial port
I am using 2005 and try to send commands (in HEX) to the serial port which is connected to my equipment.
I have tried several methods using e.g. ChrW(&HD1) and it won't work. It only works when it the command is placed inside an byte array. Any help will be much appreciated, thanks!
Private Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim chBuf(0), trans_curr As Byte
chBuf(0) = &HD1
trans_curr = &HD1
Try
serialPort.Write(chBuf, 0, 1) ' this works'
serialPort.Write(trans_curr) 'this does not works'
With txtDataReceived
.SelectionColor = Color.Black
.ScrollToCaret()
End With
txtDataToSend.Text = String.Empty
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|