Dim string_Length As Integer
Dim pointer As Integer
Dim Ack_Byte As Integer
Private Sub Command1_Click()
pointer = 1
string_Length = Len(Text1.Text)
Loop_Here: Call Send_Block ' send 16 characters
If string_Length > 0 Then ' if string length 0 exit
While Ack_Byte = A ' wait until acknowledge 'A'
GoTo Loop_Here ' if not A wait here
End If
End Sub
Private Sub Send_Block()
Ack_Byte = 0
If string_Length > 16 Then
Text2.Text = Mid(Text1.Text, pointer, 16)
pointer = pointer + 16
string_Length = string_Length - 16
Else
If string_Length = 0 Then
Text2.Text = ""
Else
Text2.Text = Mid(Text1.Text, pointer, string_Length)
string_Length = 0
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
Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvRecieve Then
Ack_Byte = MSComm1.Input
End If
End Sub