khgsm2003
17-05-2004, 09:39 AM
hi all
Iam trying to make VB6 program that can communicate with 5110 through
the com port , iread tons of topics about sending frames to 5110 fbus
but actualy none of these routines work good
my final collected program is shown below
' timer for delay'
Sub pause(pas As Single)
start = Timer
Do Until Timer >= start + pas / 1000
DoEvents
Loop
End Sub
'thex converts the frame from text to hex code to be sent to comport'
Sub thex(z As String)
Dim byt() As Byte
Dim buf1 As Variant
ReDim byt(Fix(Len(z) / 3))
j = 0
For i = 1 To Len(z) Step 3
y = "&H" + Mid(z, i, 2)
byt(j) = Val(y)
j = j + 1
Next i
buf1 = byt()
Form1.MSComm1.Output = buf1
End Sub
Private Sub Command1_Click()
Command1.Enabled = False
MSComm1.Settings = "115200,n,8,1"
If Option1.Value = True Then MSComm1.CommPort = 1
If Option2.Value = True Then MSComm1.CommPort = 2
MSComm1.RTSEnable = False
MSComm1.DTREnable = True
MSComm1.PortOpen = True
thex ("55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 C1")
pause (100)
thex ("1E 00 0C D1 00 07 00 01 00 03 00 01 60 00 72 D5") ' HW/SW version
MSComm1.DTREnable = False
pause (1000)
MSComm1.PortOpen = False
Command1.Enabled = True
End Sub
the port monitoring tells that the 55's and the frmae as well BUT I HAVE NO RESPONSE
Can any one help
Iam trying to make VB6 program that can communicate with 5110 through
the com port , iread tons of topics about sending frames to 5110 fbus
but actualy none of these routines work good
my final collected program is shown below
' timer for delay'
Sub pause(pas As Single)
start = Timer
Do Until Timer >= start + pas / 1000
DoEvents
Loop
End Sub
'thex converts the frame from text to hex code to be sent to comport'
Sub thex(z As String)
Dim byt() As Byte
Dim buf1 As Variant
ReDim byt(Fix(Len(z) / 3))
j = 0
For i = 1 To Len(z) Step 3
y = "&H" + Mid(z, i, 2)
byt(j) = Val(y)
j = j + 1
Next i
buf1 = byt()
Form1.MSComm1.Output = buf1
End Sub
Private Sub Command1_Click()
Command1.Enabled = False
MSComm1.Settings = "115200,n,8,1"
If Option1.Value = True Then MSComm1.CommPort = 1
If Option2.Value = True Then MSComm1.CommPort = 2
MSComm1.RTSEnable = False
MSComm1.DTREnable = True
MSComm1.PortOpen = True
thex ("55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 C1")
pause (100)
thex ("1E 00 0C D1 00 07 00 01 00 03 00 01 60 00 72 D5") ' HW/SW version
MSComm1.DTREnable = False
pause (1000)
MSComm1.PortOpen = False
Command1.Enabled = True
End Sub
the port monitoring tells that the 55's and the frmae as well BUT I HAVE NO RESPONSE
Can any one help