Despatch Protocol Plus Modbus Communications Instrukcja Użytkownika Strona 52

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 53
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 51
Chromalox Instruments and Controls
A-51643 Rev. 6 10/06/03 46
'can be calculated before the TxMessage is sent, when RxMessage contains
'the expected message length, then reception is complete.
'
'Check for valid message CRC:
RxCount = Len(RxMessage)
CRCValue = GetCRC(Mid(RxMessage, 1, RxCount - 2))
'compare result with received CRC:
If (CLng(Asc(Mid(RxMessage, RxCount - 1, 1))) + _
(CLng(Asc(Mid(RxMessage, RxCount, 1))) * 256)) = CRCValue Then
'CRC result matches OK (process data in RxMessage as needed)
Text1 = "OK "
'display values of message's data bytes:
For i = 1 To RxCount
Text1 = Text1 & "<" & Asc(Mid(RxMessage, i, 1)) & ">"
Next i
Else
'bad CRC result!
End If
End Select
End Sub
With the PC connected to a Protocol
TM
Plus controller on COM1, and the controller is set for Address 1,
Baud Rate 38400, No Parity, clicking the command button produces the following display:
The data shows a good reply, with data values of 93, 113, and 0 for Holding Registers 16, 17, and 18,
respectively.
Przeglądanie stron 51
1 2 ... 47 48 49 50 51 52 53

Komentarze do niniejszej Instrukcji

Brak uwag