----- Original Message -----
From: "robert" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 20, 2005 1:27 PM
Subject: send output to a parallel port?
> Hey all
>
> we have some devices at work that are controlled by sending signals via
the
> computer's parallel port. (because all the serial ports are being used
> elsewhere)
>
> the parallel port (LPT) has the address 0x378. to do this in C, its quite
> simple:
>
> void parallel_device (int state)
> {
> outp (0x378,state);
> return;
>}
I think this question came up once already. Go to
http://www.logix4u.net/inpout32.htm and download inpout32.dll (link is clear
down at the bottom of the page). Here's the perl code I use to play around. I
never got around to doing anything useful with it. Hope this helps.
---code---
use strict;
use warnings;
use Win32::API; #load API module to interface DLL's
my $GetPortVal = Win32::API->new('inpout32', 'Inp32', ['I'], 'I') or die
"Couldn't create Win32::API object: $! $^E";
my $SetPortVal= Win32::API->new('inpout32', 'Out32', ['I','I'], 'I') or die
"Couldn't create Win32::API object: $! $^E";
my $input= $GetPortVal->Call(0x378) & 255; #get and display current value of
address 378 hex print "$input\n";
print "Original Port Value=$input\n\n";
my $return=$SetPortVal->Call(0x378,0x23); #set pins 2,3,7 (pins, not bits)
print "Call return value=$return\n\n";
$input= $GetPortVal->Call(0x378) & 255; #get and display updated value of
address 378 hex
print "New Port Value=$input\n";
---code---
Thad Schultz
EDA Librarian / Sys Admin
Woodward Industrial Controls
[EMAIL PROTECTED]
ph (970)498-3570
fax (970)498-3077
www.woodward.com
***
The information in this e-mail is confidential and intended solely for the
individual or entity to whom it is addressed. If you have received this e-mail
in error, please notify the sender by return e-mail, delete this e-mail, and
refrain from any disclosure or action based on the information.
***
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs