Writing to the parallel port (Mem 0x378) when runnning WinXP or Mandrake 9.2

T

Todd Gardner

---------------------------------------------------------------
I would appreciate any ideas how to write to the parallel port (Mem
0x378) when runnning WinXP or Mandrake 9.2.

In C and LabVIEW I use the OutP command to write to directly to a
memory address.

Thank you
 
M

Michael Geary

Todd said:
I would appreciate any ideas how to write to the parallel port
(Mem 0x378) when runnning WinXP or Mandrake 9.2.

In C and LabVIEW I use the OutP command to write to
directly to a memory address.

I don't know about Linux, but in Windows NT/2000/XP you need a kernel mode device driver.

This Google search may help:

windows xp parallel port i/o driver

-Mike
 
C

Chris Liechti


thanks for recomending it :) as a little clarification:
the link to pyparallel is here:
http://pyserial.sourceforge.net/pyparallel.html

(its only a small note on the mainpage)

currently i have only py2.2 versions available for download, but i can
easily build the 2.3 version upon request, or you can build it on your own
with mingw32 or cygwin installed: python setup.py build --compiler=mingw32
install

you will need giveio.sys, also available in the downloads section, that
allows programs to access the io ports on Win NT/2k/XP

chris
 
D

Derrick 'dman' Hudson

On the linux side, the following code works :
f = file('/dev/lp0', 'w')
f.write( "Some Data" )
f.close()

This assumes that the parallel port you wanted to write to is the
first one. (I have no idea what the memory addresses are, and I don't
care either :))

If you are trying to print something, though, I'd recommend not
accessing the device directly. On linux use the popen() call to
invoke /usr/bin/lp and let the print server handle the actual hardware.

If you are trying to interact with some other parallel port device,
then some abstraction layer like the recommended PyParallel would be
better for production.

-D

--
Better a little with righteousness
than much gain with injustice.
Proverbs 16:8

www: http://dman13.dyndns.org/~dman/ jabber: (e-mail address removed)
 
D

Dennis Lee Bieber

Derrick 'dman' Hudson fed this fish to the penguins on Friday 05
December 2003 13:34 pm:
If you are trying to interact with some other parallel port device,
then some abstraction layer like the recommended PyParallel would be
better for production.
Not that I'm involved in this query, but just for an example: My last
assignment (and if the company doesn't find anything else to do, "last"
as in pre layoff) had me producing three "lines" of RS-422 compatible
signals, synchronized to transitions of an external clock sensed via
the printer busy line.

W98 system. It works, but I've not been able to track down and prevent
some OS preemption problem that occurs between 200 and 250 milliseconds
into a stream of output data. This is with the process upped to
REALTIME class, and the port "driver" thread upped to TIME_CRITICAL (a
combination that should have the thread running at priority 31!)

--
 
P

Peter Hansen

Dennis said:
W98 system. It works, but I've not been able to track down and prevent
some OS preemption problem that occurs between 200 and 250 milliseconds
into a stream of output data. This is with the process upped to
REALTIME class, and the port "driver" thread upped to TIME_CRITICAL (a
combination that should have the thread running at priority 31!)

Win98 is not a realtime OS, and it's unlikely you'll ever be able
to fix this sort of thing completely. There are no guarantees whatsoever
that your code, even at so-called "REALTIME" level, will have any particular
latency.

If you really need that kind of critical timing, you should use
another OS.

-Peter
 
D

Dennis Lee Bieber

Peter Hansen fed this fish to the penguins on Saturday 06 December 2003
05:49 am:

If you really need that kind of critical timing, you should use
another OS.
Unfortunately the use of that antique (P-II, ~250MHz) laptop is
mandated -- government furnished equipment.

My current work-around is to use the high-performance counters at the
start to determine the clock rate I'm seeing, then compute how many
"segments" of data I can send in <200msec (since I've never seen the
problem appear earlier than that). I then pop up an annoying message
box that the user must "continue/cancel" between every /n/ segments
(one of the three lines is an IDLE indicator, and the port will hold
that through the interim). My current hopes are that the user
interaction will "reset" whatever in the OS sucked up the time.

--
 
T

Todd Gardner

Chris Liechti said:
thanks for recomending it :) as a little clarification:
the link to pyparallel is here:
http://pyserial.sourceforge.net/pyparallel.html

(its only a small note on the mainpage)

currently i have only py2.2 versions available for download, but i can
easily build the 2.3 version upon request, or you can build it on your own
with mingw32 or cygwin installed: python setup.py build --compiler=mingw32
install

you will need giveio.sys, also available in the downloads section, that
allows programs to access the io ports on Win NT/2k/XP

chris
I think all I have to do is figure out how to use the outp(...)
command. Pardon my ignorance here but how do I figure out the syntax
of this command?

This is my first project in python and it seems a bit daunting. I am
trying to communicate to a custom device via the parallel port. At
this point I only want to write data to the data port. In my case the
memory address is x378.

I installed: Python 2.2, giveio_setup.exe and
pyparallel-0.1.win32-py2.2.exe. I was running Python2.3 but I don't
think that it will matter for this newbie project.

Many thanks for all of your pointers!

Todd
 
T

Todd Gardner

Chris Liechti said:
thanks for recomending it :) as a little clarification:
the link to pyparallel is here:
http://pyserial.sourceforge.net/pyparallel.html

(its only a small note on the mainpage)

currently i have only py2.2 versions available for download, but i can
easily build the 2.3 version upon request,

I would like to request that you build a 2.3 version.
or you can build it on your own with mingw32 or cygwin installed: python
setup.py build --compiler=mingw32
install

I am quite the newbie so I would not even attempt to build it on my
own yet, soon maybe but...
you will need giveio.sys, also available in the downloads section, that
allows programs to access the io ports on Win NT/2k/XP

chris

Thanks,

Todd
 
T

Todd Gardner

IT WORKS with version 2.2. ! Thank you Chris! I am not sure how I
can use version 2.3.

The code that I need to try it out was this... And I found it of all
places, in the docs... go figure :)
**************************************
import parallel
p = parallel.Parallel() #open LPT1
p.setData(0x55)
**************************************

Thank you,

Todd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,474
Latest member
AntoniaDea

Latest Threads

Top