Device::ParallelPort input and output

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi, I've currently got a laptop running Ubuntu Server and Perl 5.8.8.
I've installed the Device::ParallelPort module and I have it working
fairly reliably with ouput. I can make it turn on an LED on some
breadboard, etc.

I am having problems with receiving input through the parallel port
though. I really need to react to something happening. I currently
have pin 12 (Paper-Out/Paper-End) connected to +5V through a switch.
When I press the switch the bit should be set.

Unfortunately I don't actually seem to get what I'm looking for at
all. I'm having no end of trouble finding any example code using this
module for anything but regular 8-pin output.

Has anyone got any tips, bookmarks, or information at all about using
this module for receiving input on the status pins?

Any help would be greatly appreciated.


Re: Device::ParallelPort input and output


Quoted text here. Click to load it

Googling for "parallel port reading" will give some circuits and code
too. Remember to use optoisolators  ...... one mistake with your
external circuits can blow out your port and/or motherboard.

Of course, you know that you must have your bios settings for the
parallel port serup for bi-directional transfer? There is ECP and EPP
settings, etc.

The perldoc states that you get status pins with get_status
and the pin looks like number 2 in the second row

 1 - 2 Paper-Out - In - Status-5 - No


use Device::ParallelPort;
my $port = Device::ParallelPort->new();

while (1){
         my $val = $port->get_status(5);
          if ($val == 1){ print "PaperOut is on\n"; }
          select( undef, undef, undef, 0.05); #delay

You might want to try different bios settings, to get input. You may
also try different numbers for the status.

If you havn't been usuing an optoisolater, you may have blown out
the circuits for that pin. Ouch!!  All it takes is a tiny spark of


I'm not really a human, but I play one on earth.

Re: Device::ParallelPort input and output

On Mon, 12 May 2008 06:10:35 -0700 (PDT) in comp.lang.perl.misc, Stu
Quoted text here. Click to load it

These things sometimes work better with a pull-up resistor
(say, 1k ohms) to +5V and the switch to ground.

Site Timeline