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
tabu6@CCVAX.IASTATE.EDU (Adam Goldberg) (04/09/91)
In article <4790@gumby.Altos.COM>, jerry@gumby.Altos.COM (Jerry Gardner) writes: >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 */ Not really a good idea, they might not all get reset to the proper value the next time you go to use it. A better idea would be: outportb(0x3fc,(inportb(0x3fc) & 0xfe)); /* set bit 0 to 0 */ +----------------------------------------------------------------------------+ + Adam Goldberg Bitnet: tabu6@ISUVAX.BITNET + + Iowa State University Internet: tabu6@CCVAX.IASTATE.EDU + + "It's simple! Even a Pascal programmer could do it!" + + "Remember: The sooner you fall behind, the more time you have to catch up" + +----------------------------------------------------------------------------+
jerry@gumby.Altos.COM (Jerry Gardner) (04/10/91)
In article <1991Apr9.024404.9824@news.iastate.edu> tabu6@CCVAX.IASTATE.EDU writes: >In article <4790@gumby.Altos.COM>, jerry@gumby.Altos.COM (Jerry Gardner) writes: }>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 */ } }Not really a good idea, they might not all get reset to the proper value the }next time you go to use it. A better idea would be: } } outportb(0x3fc,(inportb(0x3fc) & 0xfe)); /* set bit 0 to 0 */ A very bad idea... No com program should ever make assumptions about the prior state of the modem control lines when it starts up. It should always explicitly assert whatever lines it needs asserted. -- 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
dougs@videovax.tv.tek.com (the man) (04/11/91)
In article <4793@gumby.Altos.COM>, jerry@gumby.Altos.COM (Jerry Gardner) writes: > ... No com program should ever make assumptions about the > prior state of the modem control lines when it starts up. It should > always explicitly assert whatever lines it needs asserted. To which I would add: when a com program finishes, it should restore the state of the port as closely as possible to what it was before the program ran.