By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,095 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,095 IT Pros & Developers. It's quick & easy.

Capturing Data Using MSComm via serial port

P: 4
I want to capture the data through serial port using the below program...
The data is 1A2B3C1A2B3C....
From that i want to display A in first text box, B in second text box and C in third text box.
The code which i wrote is giving as B in first text box, 3 in second text box and C in third text box.
COULD U PLS HELP ME OUT.

Private Sub MSComm1_OnComm()

Dim data As String
Dim data1 As String
Dim data2 As String

Dim i As Byte
Dim i1 As Byte
Dim i2 As Byte

If MSComm1.CommEvent = comEvReceive Then

data = MSComm1.Input
data1 = MSComm1.Input
data2 = MSComm1.Input

If Asc(Text) = 32 Then
i = Asc(data)
j = Hex(i)
Text1(0) = j


i1 = Asc(data1)
j1 = Hex(i1)
Text1(1) = j1

i2 = Asc(data2)
j2 = Hex(i2)
Text1(2) = j2

End If
End Sub
Mar 19 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.