[futurebasic] Serial Port Read Consistency Errors

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2000 : Group Archive : Group : All Groups

From: Rodney Kobayakawa <vanda@...>
Date: Thu, 20 Jul 2000 18:42:59 -1000
I am trying to read a serial port after sending a command to a device. The
data coming back has been read by various methods (most garnered off
examples on this list). The problem is that it works most of the times, but
every 5th, or 10th, or 20th read (it varies), I get extraneous characters,
first couple of characters missed, or just plain jibberish. I know the
device is sending out correctly because I have a second computer paralleled
(read only) on the serial line running a terminal program and it returns the
expected data every time (hundreds of returns). What am I doing wrong? Here
is what I am using:

characAvail=LOF(thePort,1)
LONG IF characAvail
    characToRead=characAvail
    IF characToRead>255 then characToRead=255
    READ FILE thePort,@x$+1, characToRead
    POKE@x$,characToRead
END IF

I am polling during null events, 38,400 baud, expecting a 9-byte return.

Thanks!

rod k.