Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!ucsd!orion.cf.uci.edu!paris.ics.uci.edu!bonnie.ics.uci.edu!finnegan
From: finnegan@bonnie.ics.uci.edu (Greg Finnegan)
Newsgroups: comp.sys.mac.programmer
Subject: Serial Ports
Message-ID: <746@paris.ics.uci.edu>
Date: 25 Sep 88 00:29:05 GMT
Sender: news@paris.ics.uci.edu
Reply-To: Greg Finnegan 
Organization: University of California, Irvine - Dept of ICS
Lines: 29


I need to send ASCII characters out a serial port to another (ancient) device
that uses hardware handshaking.  My application has to detect whether output
has been suspended within one (actually two, but why take chances :-)
character.

Here is the code fragment I'm using:

{Preface: I'm using the RAM serial drivers}
{error handling and other non-essential code eliminated for clarity}

for i := 1 to NumChars do begin
  Err := SerStatus(outRefNum, serSta);
  if serSta.ctsHold > 0 then begin
    SysBeep(1);
    exit;
  end;
  Err := FSWrite(outRefNum, oneChar, @MyChar);
end;

This works only intermittently (I imagine when force the device off-line
at just the right time).  Usually, it just hangs within FSWrite until
I put the device back on line.  I hope that it is just something I'm not
setting up properly, or another call I need to make...

Could anyone out there lend some advice?

Greg Finnegan
finnegan@bonnie.ics.uci.edu