How To Drive Paralel Port
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:
|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|
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”.
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.Please notice that comment or question submitted should match the topic.