[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::atarist

Title:Atari ST, TT, & Falcon
Notice:Please read note 1.0 and its replies before posting!
Moderator:FUNYET::ANDERSON
Created:Mon Apr 04 1988
Last Modified:Tue May 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1433
Total number of notes:10312

1081.0. "RS232 handshake problem" by HAMSUP::MARXSEN (Univ.Milky.Sol.Earth.FRG.Hamburg) Mon Feb 25 1991 11:11

    I have a problem with an application using RS232 and handshaking :
    
    I wrote an application that sends data using the RS232-port.
    A received XOFF (^S) should stop the transmission immediately.
    I thought about two solutions but both bring up special problems :
    
    1. Setting up the port hardware with XON/XOFF.
       Problem : The application will continue to write into the trans-
                 mission buffer until its full. Then the application
                 is blocked until it can deliver more characters.
                 How can I sense the XOFF-state to prevent filling up
                 the buffer to enable other tasks during waittime ?
    
    2. Let the application do the handshake.
       Problem : The application serves the XOFF-command and stops
                 sending into the buffer. But... there may be some
                 characters pending in the buffer which will continue to
                 be sent until the buffer is empty. How can I set the
    		 transmission buffer size to zero ?
    
    Thanks for any hints,
    			Detlef.
    
T.RTitleUserPersonal
Name
DateLines
1081.1Bconxxx FunctionsMPGS::RADOFFMon Feb 25 1991 12:216
    If you use the Bconxxx functions set for AUX, you can intercept and
    interpret incoming stream characters and control transmittion and
    reception in that manner.  This is a means I have used for years that
    works perfectly.
    
    	Steve
1081.2Some ways around thisPRNSYS::LOMICKAJJeffrey A. LomickaMon Feb 25 1991 14:4820
Some ideas:

- If you transmit with a loop that calls Bcostat() before each character,
it should tell you if the port is ready for more data or not.

- If you use Iorec, you can watch the input and output pointers as they
go by, and even change them.  Careful about synchronization with Atari's
interrupt routines.  I'd change them at IPL 7 if possible.

- One good way would be to set the output buffer size small in Iorec,
so that the O/S cannot queue up more than, say 8 characters.  Then
monitor incoming data for XON/XOFF, and you will never overrun the XOFF
by more than 9 characters, which should be okay.

- Another good way may be to only transmit if the difference between
head and tail in Iorec is small, and you are not in an XOFF condition.

I once write a driver (for a raw VAX, no operating system) that
transmitted as long as the input buffer in the uart didn't contain a ^S.
You'd be amazed how well that worked.