Hello,
I am trying to write to the parallel port using perl but I am not sure what the syntax should be. please help...
advice, links, or any code would help
thanks
MAC
Perl is very forgiving when it comes to using quotation marks around things. I try to err on the side of explicitness, so I would write
open(PARALLEL, ">LPT1" or die "$!";
print PARALLEL "1";
close(PARALLEL);
but if omitting the quotation marks does the job, go right ahead. If the question was how to direct output to a specific file, you are correct in the second line where you put the file handle after "print" without any commas or anything.
Something this method doesn't allow is reading back from the parallel port. If your parallel device returns any information, you'll want to open the port a different way.
Hi,
I have used the above code and it works. The only problem is once it sends the data the program frezes. basicaly its a button and when you click on it it sends a one to the parallel port but after that the program just frezes?? any ideas...
thanks
M.
By the way how would you read from the port???
Thnx
I'm not quite sure about that. It might be possible to open the parallel port twice - once for reading, and once for writing. I'll see if I can try that out today. If you have any success before I post, please post a reply.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.