BBC BASIC for Windows
Programming >> Communication and Input/Output >> SERIAL PORT
http://bb4w.conforums.com/index.cgi?board=communication&action=display&num=1365251359

SERIAL PORT
Post by wyzeowl on Apr 6th, 2013, 12:29pm

I have the need to clear the serial port buffer after every read. I believe that there used to be an OSbyte command to do this. Is ther anything I can do.
Thankyou
Re: SERIAL PORT
Post by admin on Apr 6th, 2013, 3:37pm

on Apr 6th, 2013, 12:29pm, wyzeowl wrote:
I have the need to clear the serial port buffer after every read.

The most straightforward way is probably to read (and discard) bytes until the buffer is empty:

Code:
     WHILE EXT#com% junk% = BGET#com% : ENDWHILE 

Richard.
Re: SERIAL PORT
Post by wyzeowl on Apr 7th, 2013, 4:34pm

Richard
Thankyou very much for your solution, I have inserted it in my programme and it works ... many thanks.