Xref: utzoo alt.msdos.programmer:2709 comp.os.msdos.programmer:5213 Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!ukma!jayh From: jayh@ms.uky.edu (Jay Hofacker) Subject: Re: Programming the printer port to read in data. Message-ID: <1991May22.022045.14865@ms.uky.edu> Organization: University Of Kentucky, Dept. of Math Sciences References: <1991May21.202043.24725@magnus.acs.ohio-state.edu> Distribution: usa Date: Wed, 22 May 1991 02:20:45 GMT Lines: 24 slahiri@magnus.acs.ohio-state.edu (Santanu Lahiri) writes: >I am trying to write a program that can read a switch status - >switch is open or closed. The switch is an ordinary switch that I hope >to hook up to the printer port and use data line D0 and the Gnd line to >detect closure. ... >I'd appreciate any pointers you can give, or even alternate methods, >perhaps using the RS-232 ports. Any suggestion is welcome, as long as >hardware requirements are minimal. I friend of mine did a similar thing for a science project last year, he used 2 pairs of signals on the RS232 serial port to detect two switchs closing. By hooking the switchs between RTS/CTS and DTR/CD, you can set the Uart to set CTS and DTR high, and then watch for RTS and CD to go high, either by poling the port or setting up an interrupt. I don't have the details for programming the serial port handy at the moment, but it is only a matter of a few statements in Pascal or C to set DTR and CTS high and check them. If you can't find the details you need on the serial port, e-mail me and I'll dig them up. -- Jay Hofacker, sysop of the Audio/Visual Exchange, (606)254-1751 3/12/24 MNP 5 Mail: jayh@ms.uky.edu / uk02779@ukpr.uky.edu -- Yes, my signature is only 2 lin