Private Sub Timer1_Timer()
Label1.Caption = Word_Read(MSComm1, FindAddrWord("D130"))
Label2.Caption = Word_Read(MSComm1, FindAddrWord("D131"))
Label3.Caption= Word_Read(MSComm1, FindAddrWord("D132"))
Label4.Caption = Word_Read(MSComm1, FindAddrWord("D133"))
Label5.Caption = Word_Read(MSComm1, FindAddrWord("D134"))
End Sub
Public Function FindAddrWord(sName As String) As String
Dim strTagType As String
Dim strTmp As String
strTagType = Left$(sName, 1)
strTmp = Right$(sName, Len(sName) - 1)
Select Case UCase(strTagType)
Case "C"
FindAddrWord = "0" + Hex(Val(strTmp) * 2 + 2560)
Case "T"
FindAddrWord = "0" + Hex(Val(strTmp) * 2 + 2048)
Case "D"
FindAddrWord = Hex(Val(strTmp) * 2 + 4096)
End Select
Exit Function
End Function
最后修改:2008-1-14 18:13:42