Hello everyone,
I'm working in vb6 with an external device connected through rs232. the data was loaded in external device in hex format and now using rs232 i want to download that data to my computer using vb6 programming but i'm unable to download
the hex code i should receive is
:108000000000000300000000000603000304030456
:108010000605030303030404000000000000000041
:10802000000000000000000001000000000000014E
:10803000FFFFFFFFFFFFFFFFFFFFFFFF0202020244
please help me
Thank You
What I have tried:
Option Explicit
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim buf As String
Dim ff As Integer
Private Sub configure_Click()
Form2.Show
End Sub
'Private Sub Form_KeyPress(KeyAscii As Integer)
'MSComm1.Output = KeyAscii
'MSComm1.PortOpen = False
'End Sub
Private Sub MSComm1_OnComm()
MSComm1.Settings = "115200,N,8,1"
MSComm1.DTREnable = True
MSComm1.RThreshold = 1
MSComm1.RTSEnable = True
MSComm1.SThreshold = 1
MSComm1.InputLen = 1
Select Case MSComm1.CommEvent
Case comBreak
MsgBox ("Break Received")
Case comCDTO
Case comCTSTO
Case comDSRTO
Case comFrame
Case comOverrun
Case comRxOver
Case comRxParity
Case comTxFull
Case comEvCD
Case comEvCTS
Case comEvDSR
Case comEvRing
Case comEvReceive
MSComm1.Output = buf
Case comEvSend
End Select
End Sub
Private Sub download_Click()
If MSComm1.PortOpen = True Then
With CommonDialog1
.InitDir = App.Path
.FileName = ""
.Filter = "Hex File (*.hex)|*.hex"
.ShowSave
ff = FreeFile
Open .FileName For Output As #ff
Write #ff, buf
Close #ff
End With
End If
End Sub