parallel port access?
jkndeja at my-deja.com
jkndeja at my-deja.com
Wed Dec 6 10:29:19 EST 2000
I have only been glancing at c.l.python occasionally, and haven't
seen any of the previous discussions on this topic. I have also been
thinking about accessing the printer port (and I/O ports in general).
Alhough none of this is tested (or even tried out in reality!), the
original poster might find it useful. Or not. I solicit further
I'm assuming that you are using some flavour of Windows. In order to
access the LPT port _directly_, you want to be able to do a form of I/O
port access. This is a rough equivalent to the BASIC code
in 80X86 assembly language these take the form
in reg, (port) ; and
out (port), val
It is not advisable to be able to do this on a platform such as the PC,
since you can crash your machine etc. very easily like this. Depending
on the Operating System you are running, you might not even be allowed
to do this even in Assembly language - it involves a change in
operating system privileges which you may not be allowed to do.
The way that you _are_ allowed to write directly to ports is via some
form of 'driver'. Again, depending of the OS you are using, this might
be a VxD, or a DLL. A Search on Altavista etc. for the 'Parallel Port
FAQ' will give you lots of information on this.
FWIW, my intention is to use python to access a simple ISA I/O card
containing 2x 8255 PIOs and a 8254 counter/timer. I'm probably going to
write, or modify, a VxD written by Karen(?) Hazzah, and downloadable
from the Windows Developer's Journal, which is designed to 'grant'
access to the ports in a range (eg the printer port, exactly what the
original poster wants). I'll then use either Mark Hammond's Win32
extensions, or Sam Rushing's 'CallDLL' methods, to access the VxD from
Python via the CreateFile(...) etc. functions.
This might be rather more detail than you require, and I may be making
things too complicated, but at least I've exposed my plans to the
In article <3A272881.6F444750 at engcorp.com>,
Peter Hansen <peter at engcorp.com> wrote:
> DOC wrote:
> > I would like to be able to control the individual
> > lines of the parallel port using Python.
> > Anyone know of any Class packages to do this or
> > do I need to write one myself?
> What platform?
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list