[fpc-pascal]How to access a parallel port?

Johann Glaser Johann.Glaser at gmx.at
Mon Jan 5 19:06:20 CET 2004

Hi Rainer!

> I want to acces a parallel port (in Linux) from FPC 1.0.4 to control a
> connected LCD display. I did such things in DOS with TP/BP by accessing the
> hardware of the port directly, but this seems to be a little bit too close to
> the hardware in linux. Instead, I would like to access the parallel port
> through its device (i.e. /dev/lp0) and with some ioctrl() calls to access the
> handshake lines, too.
> Should normally be no problem, but I have no idea where to start.
> Does anybody have a sample code for that? Also, a easy to understand
> documentation of all parallel-port ioctrl() functions would be helpful.

I'm sorry that I can't help you out with ioctl()s. But: Some time ago I
was searching for that (/dev/parport should be the right thing) but
didn't find anything. Instead of that I had to directly program the

Look up my K7103 Digital Storage Oscilloscope project at 
and download the sources. In the source there is a file called
osziaccess.pas which does parallel port programming. There is an
"ioperm()" call too, this is important. Attention: you need root access
to use this call. That is the drawback of that method.


Johann Glaser   <Johann.Glaser at gmx.at>
   Vienna University of Technology
       Electrical Engineering 
____ http://www.johann-glaser.at/ ____

More information about the fpc-pascal mailing list