Manual

Chromalox Instruments and Controls
A-51643 Rev. 6 10/06/03 45
CRCWord = GetCRC(TxMessage)
'add the CRC bytes to the message:
TxMessage = TxMessage & Chr(CRCWord - Int(CRCWord / 256) * 256)
TxMessage = TxMessage & Chr(Int(CRCWord / 256))
'clear status text display:
Text1 = ""
'clear the receive data buffer:
RxMessage = ""
'send the message out the COM port:
frmComm.comMain.Output = TxMessage
End Sub
The reply message is received using the following code placed to respond to the MSComm device‘s
‗OnComm‘ event:
Private Sub comMain_OnComm()
Dim CRCValue As Long
Dim NewBuffer As String
Dim RxCount As Integer
Dim i As Integer
Select Case comMain.CommEvent
Case comEvReceive
'Read serial data bytes:
NewBuffer = comMain.Input
'Build up RxMessage
RxMessage = RxMessage & NewBuffer
'
'Check RxMessage to see if it's complete - the length of each expected reply