Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Device::ParallelPort input and output

0 views
Skip to first unread message

Stu

unread,
May 12, 2008, 9:10:35 AM5/12/08
to
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.

Regards,
Stuart.

zentara

unread,
May 12, 2008, 2:17:01 PM5/12/08
to
On Mon, 12 May 2008 06:10:35 -0700 (PDT), Stu <stuart....@gmail.com>
wrote:


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


#untested

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
static.

zentara


--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

David Harmon

unread,
May 12, 2008, 2:36:12 PM5/12/08
to
On Mon, 12 May 2008 06:10:35 -0700 (PDT) in comp.lang.perl.misc, Stu
<stuart....@gmail.com> wrote,

>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.

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

0 new messages