Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mscomm read and checksum problem

Status
Not open for further replies.

mrrrl

MIS
Dec 26, 2001
179
US
I am tring to commuicate with a cm11a (x10) unit. I am to send it two bytes (test) and then it sends me back the checksum of those. But I can't figure out how to compare the data sent back from the cm11a to get it to then close the port.

TIA

Private Sub Command1_Click()
Dim test
Dim Buffer$
test = Chr(&H4) + Chr(&H66)

Dim Instring As String
MSComm1.CommPort = 1
MSComm1.Settings = "4800,N,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
MSComm1.Output = test
Do
DoEvents
Buffer$ = Buffer$ & MSComm1.Input
****Here is my problem area********************
Loop Until InStr(Buffer$, "OK" & vbCrLf)

'Read the "6A" response data in the serial port.
' Close the serial port.
************************************************
MSComm1.PortOpen = False

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top