[alt.msdos.programmer] Serial port control?

dawill@hubcap.clemson.edu (david williams) (04/08/91)

   I've just recently aquired my *own* PC, rather than fooling around
with the computers the school so nicely lets me use.  Here's the 
question:  How do I set the DTR line inactive after some terminal
program has finished with the serial port?  
   Here's the reason:  I have a 'black box' I built about two years
ago (when I was still living in a dorm) that switches an RS-232 line
according to the state of the incoming DTR line on two ports.  This 
lets my roomate and I share one modem, and have automatic null-modem
if we both bring up comm programs.  Now that I have two computers of
my own, I want to be able to do this again.  However, PC's don't appear
to kill the DTR line when the port goes inactive,  (Maybe it's the 
program I'm using.  Any ideas?) which means the PC grabs the port
forever after I use the modem once.
   Please *mail* me any answers you may have, and I'll sumarize.

        Dave Williams
          dawill@hubcap.clemson.edu
             "Huh?  What?  Could you repeat the question?"

jerry@gumby.Altos.COM (Jerry Gardner) (04/09/91)

In article <1991Apr8.044312.29004@hubcap.clemson.edu> dawill@hubcap.clemson.edu (david williams) writes:
>
>   I've just recently aquired my *own* PC, rather than fooling around
>with the computers the school so nicely lets me use.  Here's the 
>question:  How do I set the DTR line inactive after some terminal
>program has finished with the serial port?  


To deassert DTR, write a 0 to bit zero of the serial port's Modem Control
register.  This register is at I/O port address 0x3fc for COM1 and at
0x2fc for COM2.  Writing a zero to the register will deassert all of the
modem control lines.  An example in C follows:


	outp(0x3fc, 0);		/* turn off all modem control lines */


-- 
Jerry Gardner, NJ6A					Altos Computer Systems
UUCP: {sun|pyramid|sco|amdahl|uunet}!altos!jerry	2641 Orchard Parkway
Internet: jerry@altos.com				San Jose, CA  95134
Help stamp out vi in our lifetime.                      (408) 432-6200