Click here to get back home

Device::ParallelPort input and output

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Device::ParallelPort input and output Stu 05-12-2008
Posted by Stu on May 12, 2008, 9:10 am
Please log in for more thread options
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.

Posted by zentara on May 12, 2008, 2:17 pm
Please log in for more thread options
wrote:

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


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

Posted by David Harmon on May 12, 2008, 2:36 pm
Please log in for more thread options
On Mon, 12 May 2008 06:10:35 -0700 (PDT) in comp.lang.perl.misc, Stu
>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.

Similar ThreadsPosted
input - output March 26, 2005, 9:58 am
Is it possible to open a file for both input & output April 27, 2006, 8:14 am
Is it possible to open aa file for both input & output April 27, 2006, 8:41 am
localtime - user input - output in same format October 7, 2004, 1:27 am
UTF16 input file to ISO-8859-1 output April 16, 2007, 9:56 am
Capturing output with simultaneous File handle input July 1, 2005, 7:07 pm
Perl output Javascript to validate user input April 4, 2006, 2:50 pm
Perl device IO on Win February 3, 2006, 9:21 pm
Write files to a USB device August 31, 2004, 9:48 pm
how to get perl catching a device (mic) ? January 2, 2005, 3:54 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap