51和VB数字量简易测试
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
51VB数字 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)