Wednesday, October 8, 2008

Paralell port programming under Java (Windows XP)

There's been a lot of neat articles. So I won't repeat this topic again. There's very handy Communications API by sun. But while serial ports worked as a charm I had troubles with paralell port. I couldn't write any byte into LPT port. I've searched the net and I've found an important notice from Paul J. Perrone, a java programmer, which I will cite here because it can disappear in the future from cited forum.

"The OS and
driver software must cleary require that the status input lines be
broadcasting signals that indicate the external device is OK (...)

After some more tinkering, the trick was to tie the parallel port
status lines 10 & 11 (Ack and Busy) to low/ground and lines 12, 13, &
15 (paper out, select, & error) to high/5V. This should be done
through the output of a buffer chip though. I also tied lines 18-25 to

The point is that driver must be shure that there's a plenty of paper, "printer" is ready to go, there's no error... All these informations are provided by special status lines, mentioned above. So I did all the soldering. And provided external +5V for proper high states. And well... it didn't work... :) Maybe it will for you.

So I dug and finally I've found a solution for Windows XP. Sorry, this time not for Linux. The problem is that port connection is hardware and OS dependent, so every library must have some kind of JNI library with proper DLL or other native lib.

Library that worked for me can be obtained at I must confess that all the soldering from citation above left in my LPT connector. I'm sure that's not necessary to put some "config" bits on all these state inputs.

Best regards, and enjoy parallel port programming!

No comments:

Post a Comment