Using lpt1 in Windows

Dar Scott dsc at swcp.com
Wed Oct 18 19:10:07 EDT 2006


On Oct 18, 2006, at 1:00 AM, Paul Williams wrote:

> I am developing some educational software that uses a sensor that  
> plugs
> into the parallel port. I need to be able to read and set the state  
> of the i/o
> pins on that port. I have tried using read/write  to file lpt1  
> without any
> success,  can anyone point in the right direction with a snippet of  
> code?

If the sensor needs arbitrary wiggling or reading of the handshake  
lines, then you will need a special driver.  There are a few out  
there, but most would need an external wrapper.  Long ago I saw a  
driver that converted LPT bit twiddling and sensing to something that  
was virtually a serial driver.  That should work great.  Look for  
parallel port drivers online.

If you just need the 8 output I/O lines and the sensor provides the  
handshake (or at least ties busy and paper error to the ground) you  
should be able to open that and at minimum write to it.  I'm pretty  
sure I have in the distant past.  I forgot the name to use.  Try  
"lpt:", "lpt1:", "\\.\lpt", and "\\.\lpt1" and the like.  You might  
have to use the BIOS to set the mode for the device.  Sometimes you  
have to set the mode to classic and that will limit you to output only.

If that does not work try something like shell("type fileWithMyByte >  
lpt") for output only.

If you bought the sensor, the manufacturer might have much better  
info or hobby groups might.

You will want to get parallel port monitor software or a parallel  
port utility to confirm what you are doing and to check out the  
sensor directly.  Look for those online, too.

You might want to get some hardware to monitor the lines.  The serial  
line gadgets will probably not work.

Dar



More information about the use-livecode mailing list