'******************************************
'计算机根据用户输入数据发送数据给单片机
'******************************************
Private Sub Button_SEND_Click()
Dim X As String
Dim Num As Variant
Dim outbyte(0) As Byte
If Text_SEND.Text = "" Then
X = MsgBox("发送数据不能为空", 16)
Exit Sub
End If
If Not MSComm1.PortOpen Then
MSComm1.PortOpen = True
End If
Num = str(Text_SEND.Text)
outbte(0) = CByte(Num)
MSComm1.OutBufferCount = 0 '...清空输出寄存器
MSComm1.Output = outbyte '...发送数据
End Sub