Closing an RS-232 channel
Posted: Mon Jun 30, 2014 12:59 pm
I've recently been rediscovering the various subtle ways of RS-232 connections (like using >=128 for the LFN to get CRLF at the end of a line). One thing I'm still struggling with is checking the transmit queue is empty before closing the channel. The Programmer's Reference Guide says
Is there a recommended way to check for an empty transmit queue?
I tried this but 37151 never seemed to have the 64 bit set, so the close happened prematurely.Care should be taken to ensure all data is transmitted before closing the channel. A way to check this from BASIC is:
100 IF ST=0 AND (PEEK(37151) AND 64)=1 GOTO 100
110 CLOSE lf
Is there a recommended way to check for an empty transmit queue?