Despatch Protocol Plus Modbus Communications Manuale Utente Pagina 52

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 53
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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.
Vedere la pagina 51
1 2 ... 47 48 49 50 51 52 53

Commenti su questo manuale

Nessun commento