MVCOM, help!
Posted: Fri Jun 03, 2005 11:08 am
Code updated For 5.20+ (same As SerialPort Libary)
I have used MVCOM very successfully on several projects, but today it appears to have stopped working. I cut my code down and still could not find the bug. I then tried one of the examples and still cannot get my remote hardware to respond. Pasting in lots of debug stuff shows that CommInput() is returning zero, even when ComInputBufferCount() shows there are 235 characters in the buffer.
Hyper terminal set up the same way makes the hardware respond OK and I get the expected response strings.
Has anyone had any problems, or have I done something really stupid?
HELP... much appreciated.
I have used MVCOM very successfully on several projects, but today it appears to have stopped working. I cut my code down and still could not find the bug. I then tried one of the examples and still cannot get my remote hardware to respond. Pasting in lots of debug stuff shows that CommInput() is returning zero, even when ComInputBufferCount() shows there are 235 characters in the buffer.
Hyper terminal set up the same way makes the hardware respond OK and I get the expected response strings.
Code: Select all
port$ = "COM1:38400,n,8,1"
Handshake.l = 0
Buffer.l = 4096
hComm.l = ComOpen(port$,Handshake,Buffer,Buffer)
If hComm.l = 0
MessageRequester("Decimation Utility","Cannot open serial port") : End
EndIf
ComOutput(hComm,"H"+Chr(13)) ; Send request for HELP
Delay(1000) ; Wait for reply
Chaine$ = ""
n.w = ComInputBufferCount(hComm) ; Number of chars in buffer
While n > 0 ; While <> 0
Debug n ;
n = ComInput(hComm,k$) ; Receive string
Debug n ; Show status
If n ; If > 0
Chaine$ = Chaine$ + k$ ; Build result
EndIf
n = ComInputBufferCount(hComm) ; Any more characters?
Wend
Debug "Done <"+Chaine$+">" ;
ComClose(hComm) ; Close port
HELP... much appreciated.