微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 51和VB数字量简易测试

51和VB数字量简易测试

时间:11-30 来源:互联网 点击:

End Sub

Private Sub Timer1_Timer()
On Error GoTo errline
If Text1.Text < 0 Then
Text1.Text = 0
End If

If Text1.Text = 0 Then
MSComm1.Output = "5"
MSComm1.Output = "6"
MSComm1.Output = "7"
MSComm1.Output = "8"
Shape1.FillColor = vbRed
Shape2.FillColor = vbRed
Shape3.FillColor = vbRed
Shape4.FillColor = vbRed
Timer1.Enabled = False
Exit Sub

End If
Text1.Text = Text1.Text - 1
errline:
If Err.Number = 8018 Then
Text3.Text = "串口已关"
End If
Err.Clear

End Sub

Private Sub Timer2_Timer()
On Error GoTo errline

If MSComm1.Input = "9" Then
Text2.Text = "有反馈"
End If
If MSComm1.Input = "a" Then
Text2.Text = "无反馈"
End If
errline:
If Err.Number = 8018 Then
Text3.Text = "串口已关"
End If
Err.Clear

End Sub

Private Sub Timer3_Timer()
If Shape4.FillColor = vbGreen And Text2.Text = "有反馈" Then
Text4.Text = "运行"
End If
If Shape4.FillColor = vbGreen And Text2.Text = "无反馈" Then
Text4.Text = "故障"
End If
If Shape4.FillColor = vbRed And Text2.Text = "无反馈" Then
Text4.Text = "停止"
End If


End Sub

Private Sub Timer4_Timer()
Timer4.Enabled = False

End Sub

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top