Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-01

How to access a parallel port?

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Rainer Hantsch

Hi!

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.

mfg

Ing. Rainer Hantsch

.---------------------------------------------------------------------. | \\|// Ing. Rainer HANTSCH - Hardware + Software | | (o o) Service - Support - WEB-Design und Programmierung | |--oOOo-(_)-oOOo------------------------------------------------------| | Ing. Rainer HANTSCH | mail: | | Khunngasse 21/20 | www: http://www.hantsch.co.at | | A-1030 Vienna | tel: +43-1-79885380 fax: +43-1-798853818 | | ** A u s t r i a ** | handy: +43-664-9194382 UID-Nr: ATU 11134002 | '---------------------------------------------------------------------'
Sebastian Günther
to Rainer Hantsch
Does anybody have a sample code for that? Also, a easy to understand documentation of all parallel-port ioctrl() functions would be helpful.

I don't think the parport has any usable ioctrl(). In most cases using an user space program to control non-printer devices from userspace isn't possible at all due to timing problems.
The only solution that I am aware of is direct port access. But this is no easy task; for example have a look at the graphlcd patch for VDR. There is a small test program (written in C) for some parport dot-matrix displays.

- Sebastian

Johann Glaser
to Rainer Hantsch: Hi! I want to acces a parallel port (in Linux) from FPC 1.0.4 to control a connected LCD…

Hi Rainer!

Show quoted text 11 lines
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 ports.

Look up my K7103 Digital Storage Oscilloscope project at http://k7103.sourceforge.net/
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.

Bye
Hansi

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