Parallel port or LPT often referred to has three ports, i.e. data port, control port, and status port. These ports has a consecutive address with the address for the data port as the primary address. The address used for the LPT is $378, $280 and $38B. And $378 address is the most commonplace used if there is only one LPT port installed. With the basic address $378, then this means that the data port located $378, status port at $379 and control port on $37A.
The pin arrangement for the LPT connector DB25 is as follows:
Pin No. | Function | Direction | Description |
---|---|---|---|
1 | Control bit 0 (strobe) | Out | Reversed |
2-9 | Data (bit 0 to bit 7) | In/out | |
10 | Status bit 6 (acknowledge) | In | |
11 | 7 bit Status (busy) | In | Reversed |
12 | Status bit 5 (paper end) | In | |
13 | Status bit 4 (select) | In | |
14 | Control bit 1 (auto feed) | Out | Reversed |
15 | Status bit 3 (error) | In | |
16 | Control bit 2 (init) | Out | |
17 | Control bit 3 (select in) | Out | Reversed |
18-25 | Ground |
We can use 8 bit data port to control a range of equipment. For example to control LEDS, relays, SCR, etc.
For ease of programming, I created a component that can be installed on Delphi (LPTXP.dpk) or Lazarus (LPTXP.lpk). This component uses the hwinterface.sys.
After you install the component, you can try the demo program (LPTTest.dpr). With this demo program, you can set the output of the data port by giving check on the CheckBox. If the CheckBox is checked, then the output of the data port will be H. whereas if the check mark is removed, then the output port data will be L.

For ease in viewing the State of data port, you can connect the data port to the LEDS as shown below:

By creating a LED circuit as shown above, you can try to control the LED light using the Checkboxes on the LPTTest program. And you will get a very interesting LED Runnung if you click on the Run button. LED lighting patterns using binary files compiled using the pattern as in “CHAPTER, Running LED 5” on the books “Easy and Fun Learning Learning Microcontroller”.

Mantab, ada komponen Lazarusnya.
Btw, aku sudah download dan coba install package di Lazarus 0.9.30.2 / FPC 2.4.4, tapi gagal karena file LPT.pas tidak ditemukan. Mohon bantuannya. Terima kasih.
mungkin bisa diatasi dengan menambahkan -Fu dengan path dari LPT.pas
Baik, komponen sudah bisa diinstal di Lazarus. Hanya saja sepertinya file form pada project lazarusnya tidak disertakan, sehingga project demo tidak bisa dijalankan. Thanks.
Oia, ada yg tertinggal. thanks infonya đ
Eh, tapi tidak kok, itu menggunakan file form yang sama dengan Delphi, jadi menggunakan dfm, bukan lfm. Coba lakukan konversi Delphi unit to Lazarus unit untuk unit UnitTest.pas.
Sip, project bisa dicompile sampai jadi .exe, tapi form tetap tidak muncul.
Mas bs minta program LPTTest nya mas? makasih
Download saja LPTXP.7z yang di bawah, di dalamnya ada demo yang berisi LPTTest.exe maupun source code-nya
Mas Sulhan,
Saya coba install componentnya di lazarus 1.6 windows7 32bit, nggak bisa ya mas, apa memang tidak didesain utk windows7 ?, ada 3 error saat diinstall….
Pertama, parport_rut_noDll.pas(77,7)Error: Can’t determine which overloaded function to call (di scrip menunjuk -> AssignFile(fb,path);)
Kedua, parport_rut_noDll.pas(129,36)Error: Incompatible type for arg. 3: Got “PChar”, expected “LPPCSTR”
Ketiga, parport_rut_noDll.pas(142,30)Error: Incompatible type for arg. 3: Got “PChar”, expected “LPPCSTR”
Sedangkan LPTTest.exe bisa dijalankan dengan sempurna….
Thanks sebelumnya
Memang Lazarus ini kadang agak sulit karena dari versi ke versi kadang tidak kompatibel. Dicoba pada versi X berhasil, setelah sampai versi Y ternyata error. Saya barusan mencoba compile pada lazarus 1.6.2 dan penyelesaiannya:
1) Untuk kesalahan pertama cukup dengan mengganti menjadi AssignFile(fb,pchar(path));
2) Untuk error Got âPCharâ, expected âLPPCSTRâ, itu adalah ketidak cocokan tipe data untuk X. Jadi tinggal disesuaikan saja tipe X menjadi X:LPPCSTR; (pada baris 117)