[futurebasic] Re: [FB] Reading from Serial port

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2004 : Group Archive : Group : All Groups

From: Ted Spencer <tedspencer@...>
Date: Mon, 12 Jan 2004 21:17:21 -0500
On Monday, January 12, 2004, at 06:06  PM, Edwards, Waverly wrote:

> Is there a way to tell how much data is in the serial port buffer
> Also is there a way to set the read position back or forward so that I 
> can
> read the nth Character in the buffer.

DIM indata$, onechr as byte

open "C",#sport,115200,_noparity,_onestopbit,_eightbits,2000
handshake #sport,_none

rcvcnt=LOF((sport),1)// shows the number of bytes in the port

read #sport, indata; rcvcnt //This empties the port into indata:

onechr = indata[11] //  reads the 11th character:

But if you want to read a particular character from the buffer without 
clearing the buffer, I can't help...
--
Ted Spencer
--
Mosquitoes in Canada: Part 1
Canada's the only place in the world where, when someone slaps you in 
the face during a conversation, you say "Thanks".
(Lorne Elliot)