发表于:2007-09-07 19:01:00
楼主
帮我看看,我要读取M1072的状态,用功能码01,用VB做的程序,就是读不到实际状态,不知到错在哪了,帮忙看看啊
Private Sub Form_Load()
Dim s1 As String
Dim s2 As String
Dim s22 As String
Dim s3 As String
Dim s4 As String
MSComm1.PortOpen = True
s2 = "01010C300001" ’M1072地址为0c30,[b]不知道这样写对吗,拿不准[/b]
s22 = LRC(s2)
s1 = ":" + s2 + s22 + Chr$(13) + Chr$(10)
MSComm1.Output = s1
s3 = MSComm1.Input
s4 = Mid(s3, 6, 8)
If s4 = "FF00" Then
Shape1.FillColor = RGB(0, 255, 0) '绿灯亮,运行中
Else
Shape1.FillColor = RGB(255, 0, 0)’停止运行状态
End If
End Sub