Read/write parallel port pins


A-) Can some QNX experts advise me how to read/write parallel port pins and create interrupt signal handler code for the parallel port interrupts?

B-) How much accuracy (± XX micro seconds) can be achieved if we create different pulses on different pins?

C-) Would it be better or worse (in terms of accuracy) if we use Linux or QNX?


Miem Chan

There are probably a lot of good resources on the net for the parallel port interface. Here’s a very brief run down.
Unless you start looking at enhanced ports, EPP and ECP, there are three I/O ports to deal with. CTRL, STATUS, and DATA.
Along with the 8 data lines, there are about 4 pins in each direction that you can read in STATUS, or set in CTRL. The default is for all DATA to be read only. For most ports, there is a ctrl bit that reverses this, so you can write to the DATA port.

The speed of pulses is heavily dependent on the construction of the port, and whether you have the impedances balanced properly. I’ve heard of passing 3-5 Megabyte over the data ports, and this includes the protocol lines, so I think the answer to your question B) is very fast.

If you are hanging on a port, the question of QNX vs. Linux really has to do with what your competition is for cycles. For interrupt latency, QNX is of course much better.

this website has many small programs written in QNX for Input/Output/Interrupts with respect to the parallel port. The author has also written a test program to measure the speed of interrupts, where he has been able to measure a train of pulses input to the computer at a speed of 10kHz. … arintr.htm … es_10k.htm … parout.htm

I have written some programs based on this website, with no problems. You will probably have to “slay devc-par” to gain full control over the port, and in the BIOS, change the parallel port settings to “Standard” or “Bi-Directional”

Dear m2asseli,

THANK YOU! for the URLs.
They are very informative. Do you also share your codes?

Once again THANK YOU!..

Miem Chan

Unfortunately I don’t have any code left. I converted to QNX 6.3SP2 and in the process lost some of my code. I will be getting that back and running in the near future, so post again in a couple weeks/month and I’ll forward you some stuff.