请哪位高手帮我注释一下下面的程序吧!
Dim Instring As String, jc As IntegerPrivate Sub command1_Click(Index As Integer)
Dim outstring As String, i As Integer
MSComm1.OutBufferCount = 0 '清空发送缓存区
If MSComm1.PortOpen = False Then
MsgBox "串口未打开", 52, "提示"
Else
outstring = Trim(Text2.Text)
outstring = Change_S(outstring, 1)
For i = 1 To Len(outstring)
MSComm1.Output = Mid(outstring, i, 1)
Next i
If outstring = "" Then
MsgBox "无发送数据!", 52, "提示"
Else
End If
End If
End Sub
Private Sub Command2_Click()
If MSComm1.PortOpen = False Then
MsgBox "串口未打开", 52, "提示"
Else
On Error Resume Next
Text1.Text = MSComm1.Input
End If
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub Command6_Click()
Dim t As Integer
t = StrComp(Command6.Caption, "串口已打开")
If Not t Then
Command6.Caption = "串口已关闭"
MSComm1.PortOpen = False
t = 0
Else
Command6.Caption = "串口已打开"
MSComm1.PortOpen = True
If comEvReceive Then
MSComm1.InBufferCount = 0
Instring = Instring & MSComm1.Input
End If
End If
Me.Show
End Sub
Private Function Change_S(strs As String, x As Integer) As String
Show
Dim i As Integer, t As Integer
Dim s As String, m As String, temp As String, lishi As String
If x = 0 Then
For i = 1 To Len(strs) Step 3
s = Mid(strs, i, 2)
m = m & s
Next i
ElseIf x = 1 Then
For i = 1 To Len(strs) Step 9
s = Mid(strs, i, 8)
m = m & s
Next i
End If
For i = 1 To Len(m)
lishi = Mid(m, i, 1)
t = Asc(Mid(m, i, 1))
If t >= 48 And t <= 57 Then
s = Chr(t)
ElseIf t >= 65 And t <= 90 Then
s = Chr(t)
ElseIf t >= 97 And t <= 122 Then
s = Chr(t)
End If
temp = temp & s
Next i
Change_S = temp
End Function
Private Function Change_R(strs As String, x As Integer) As String
Show
Dim t As Integer
Dim s As String, m As String, temp As String
t = Asc(strs)
If t >= 48 And t <= 57 Then
Change_R = Chr(t)
ElseIf t >= 65 And t <= 90 Then
Change_R = Chr(t)
ElseIf t >= 97 And t <= 122 Then
Change_R = Chr(t)
End If
End Function