Java Parallel Port Programming with the Java Communications API

P

Paul Perrone

I've read some messages on here regarding the Java Communications API
and the problems some have had with writing to parallel ports. I also
was puzzled by why I couldn't get this to work and then finally
figured out something that worked for me so am sharing this.

First of all, I am using Linux, downloaded the RXTX software,
downloaded the Sun x86/Solaris drivers for the Comm API (yes you need
this even for Windows/Linux), and installed per the instructions.
There were a few snags but the instructions contain much of what you
need to get past these.

The main problem I had was with properly wiring the cable from the
parallel port to drive my external circuits. You definately need some
sort of buffer chips to provide the interface from/to the parallel
port and your external devices (i.e. motors, LEDs, etc) and of course
power that circuit with an external 5V supply. That wasn't the problem
for me though. I had my data lines from the parallel port connected to
drive the external device...but it wasn't working with the Java
Communications API.

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
low/ground.

With that, the Java Communications API worked like a charm. The OS and
driver software must cleary require that the status input lines be
broadcasting signals that indicate the external device is OK...and by
tying the status lines mentioned to the proper signal levels...it
looks as if the external device is OK (i.e. no errors, not busy, has
paper, etc).

Previously, I had the status lines all tied to ground or had them
floating. After looking at a parallel port spec, I figured out what
the status lines are signalling to the system.

I hope this helps some of you trying to do something similar.

Regards,

Paul

/******************************************************************/
Paul J. Perrone
Assured Technologies, Inc.
Web: www.assuredtech.com
Author of various books on J2EE, Java, XML, and Web
Services: http://www.assuredtech.com/books_page.htm
Recently completed project includes the
"J2EE Developer's Handbook" geared for J2EE v1.4.
/******************************************************************/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top