How to open Parallel Port in TCL??

Skip to first unread message


Apr 14, 1999, 3:00:00 AM4/14/99
How do I open the parallel port in tcl for reading/writing?? I tried

set p [open LPT1: {RDOPEN}] which opens the port, but I get I/O error
when I try to read from it. How do I specify to open I/O address 0x278
instead of LPT1. LPT1 is the driver and I don't think that will give me
what I want.



Neil Johnson

Apr 16, 1999, 3:00:00 AM4/16/99

If you want access to the parallel port to do bit twiddling (one of my
favourite past times :-) when hooking on custom hardware you could try
using my little loadable library InOut for directly accessing the
hardware (well, OK on Windows you actually talk to the printer VxD which
traps the IO accesses to the printer ports, but the end result is the
same). I have used InOut to talk to the printer port on Windows 95 and
Windows 98 without problems (not so sure about NT though - untried &

Go to the download section of the website (URL below) for grab a copy.

There are plenty of websites out there with information about
programming the printer port at the hardware register level, for

(This is not my site, but it does have some very good information on

However, if your need is somewhat higher level - maybe you're trying to
use the printer port in one of its higher-powered EPP or ECP modes - at
the moment you could be out of luck.

Could you perhaps provide more details of why you want to 'open' the
printer port? Especially for reading??

(Hmmm ... thinks ... could it be so that you can monitor the status of
the printer - out of paper, offline and such - from with Tcl? If so,
load my InOut library and use inport to read the status register and
examine the bits)

| Neil Johnson BEng(Hons) MSc CEng MIEE MIEEE |
| |
|"I can hardly speak for myself, let alone my employer"|

Reply all
Reply to author
0 new messages