parallel port : Java Glossary

parallel port
hardware to which you may attach a parallel printer or Centronics interface device. Sun have created a Java Communication’s API (Application Programming Interface) which defines a platform-independent way to do parallel port communication. You can get javax.comm from JavaSoft.

Unfortunately Sun’s API is of little use. The problem is that the interface is designed with the assumption that you have a printer out there and want to talk to it - a most unlikely assumption. If you just wanted to print, there would be no need to use javax.com; you would use the standard printing api.

The exception is when you have dot matrix printer and you need speed, e.g. as a cash register printer. Java uses Windows which sends all printing as graphics. To be quick, you must send text intermixed with printer-specific formatting commands. You can do that with RTextPrinter.

Far more likely, you have a robot, a geiger counter, a numerically controlled sewing machine, a kinetic sculpture, or other bizarre device that you want to control via bit fiddling. Unfortunately, the javax.comm interface doesn’t let you do this. The typical way of controlling a non standard device through the parallel port is to merrily ignore the control lines for the most part, or use them in some bizarre way, and pump data through the output lines. Input is done by absconding with the control in lines, and use them in ways Centronics never imagined, e.g. to read nifty stuff like whether the dragon is fully submerged.

Presumably the sun engineer implemented javax.comm by reading the Centronics printer spec. Too bad, he/she missed the point of why you need a javax.comm interface. You will have to roll your own with JNI (Java Native Interface).

If you are tinkering with a home brew interface, tie the parallel port status lines 10 and 11 (Ack and Busy) to low/ground and lines 12, 13 and 15 (paper out, select, and error) to high/5V. The javax.com software will not work without properly simulated status signals.


CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/parallelport.html J:\mindprod\jgloss\parallelport.html
logo
Please email your , letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email. If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, please quote it and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. Threatening to kill me or spouting obscenities has yet to persuade me to change my mind.
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.179.212]
You are visitor number 27,433.