Is there any other way to clear the com port buffer?
I have tried:
Code: Select all | Expand
if FlushComm( nComm, 0 ) != 0
nError = GetCommError( nComm )
MsgInfo( "FlushComm Error: " + Str( nError ) )
endif
if FlushComm( nComm, 1 ) != 0
nError = GetCommError( nComm )
MsgInfo( "FlushComm Error: " + Str( nError ) )
endif
I do not get any errors but it appears that the buffer is not getting cleared.
What I am doing:
I read (every second) data form a com port and display the info on the screen.
What's happening:
At the start, the data being sent to the com port from my device will match what I see on the pc screen. After a few minutes, the data seen on the device and the pc screen are out of sync. If I change the info being sent on the device it can take up to 30 seconds before the pc screen catches up.