parallel port : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

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 Oracle’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.


This page is posted
on the web at:

http://mindprod.com/jgloss/parallelport.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\parallelport.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[13.58.80.48]
You are visitor number