Dim string_Length As Integer
Dim pointer As Integer
Dim Pattern_Byte As Integer
Dim Ack_Byte As Integer
Dim Message As String
Private Sub Command1_Click()
pointer = 0
string_Length = Len(Text1.Text) + 2
Pattern_Byte = Text2.Text
Message = string_Length & Pattern_Byte & Text1.Text
Call Send_Data
End Sub
Private Sub Send_Data()
If string_Length > 32 Then
MSComm1.Output = Mid(Message, pointer + 1, 32)
pointer = pointer + 32
string_Length = string_Length - 32
Else
If string_Length <= 32 Then
MSComm1.Output = Message
string_Length = 0
End If
End If
End Sub
Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvRecieve Then
Ack_Byte = MSComm1.Input
End If
If Ack_Byte = "A" Then
If string_Length > 0 Then
Call Send_Data
End If
End If
End Sub
Private Sub Form_Load()
With MSComm1
.CommPort = 1
.PortOpen = True
.Settings = "9600,n,8,1"
End With
End Sub