Device::ParallelPort input and output

S

Stu

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

zentara

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
 

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

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top