'Characters are read one at a time until a <LF> character is
'read or 8 seconds elapse between consecutive character reads.
'At the end of the routine the string read is in RS232INS.
BUFFERS
=
CHR$(O) 'Initialize buffer$ to NULL character
RS232INS
=
""
TIMEOUT.ERROR%
=
0 'Initiate to no timeout error
ON TIMER(8) GOSUB 6000 'Set timer for a 1 second time out
TIMER ON 'Turn on timer
'While port doesn't
timeout and string deliminator <LF> not
'read, continue trying to read input on COM port.
WHILETIMEOUT.ERROR%
=
0 ANDBUFFERS oCHRS(10)
IF LOC(1)
=
0 THEN GOT0 5170
TIMER OFF
BUFFERS
=
INPUTS(1, #I)
RS232INS
=
RS232INS
+
BUFFERS
TIMER ON
VEND
TIMER OFF
IF TIMEOUT.ERROR%
=
0 THEN GOT0 5230
PRINT "Timed out when reading RS-232 port."
TIMEOUT.ERROR%
=
0
PRINT RS232INS;
RETURN
'timeout: Set
TIMEOUT.ERROR% flag. Called if t seconds, as
'defined by ON TIMER(t), in the Read.RS232.String1 has elapsed
'between TIMER ON AND TIMER OFF.
TIMEOUT.ERROR%
=
1
RETURN
END 'End of Program Listing
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com