[TI-H] Re: port programming


[Prev][Next][Index][Thread]

[TI-H] Re: port programming




From: "Nick Foster" <zaphod@coe.neu.edu>
> i had kind of a simple question for you all, or anyone that still reads
> here. i'm looking to interface an external device to a port on my pc,
serial
> or parallel, doesn't matter. all i need to do is set one pin high or low
as
> an on/off signal.

Either will do, but if you want NT/XP compatibility you will need to use
a driver to access the parallel port.  If you just want to output, and can
use the regular data pins, just use CreateFile to open the parallel port
and write a byte with the bit pattern you want.  If you use direct IO
access, which works on 9x,. you'll likly have problems on NT/XP.
If you need to read data or access the control pins, you'll have to use
a driver or direct IO access.

The serial port control lines can be handled in a similar way, using
the comm functions (i forget the full name of the functions, setcommxxx
I think, where xxx refers to the operation).  I've used this to run relays
before, but you have to design with the +/- 12v switching in mind, instead
of the 5/0v of the parallel port.

DK





References: