Parallel port basics
What is a port?
On computer and telecommunication devices, a port is generally a specific place for being physically connected to some other device, usually with a socket and plug of some kind. Typically, and as an example, a personal computer is provided with serial ports, parallel ports, USB ports, fire wire ports, etc. The serial port for example supports sequential, one bit-at-a-time transmission to peripheral devices such as old scanners and the parallel port supports multiple-bit-at-a-time transmission to devices such as old printers. I'm keep saying old because USB replaced all this ports in the new devices such as scanners and printers, PDAs, game pads , joysticks, digital cameras and flash drives. USB port is relatively new and intended to replace many varieties of serial and parallel ports.
Why Ports are important?
I think you know the answer. We use ports to communicate to peripheral devices like modem, printer, keyboard, mouse, PDAs, digital cameras, personal media players, flash drives, and many others.
A PC parallel port is a simple and inexpensive tool for building computer controlled devices and projects. The simplicity and ease of programming makes parallel port popular in electronics hobbyist world. The parallel port is often used in Computer controlled robots, Atmel/PIC programmers, home automation, etc...
Old Parallel Ports are used for output only where newer ones support bi-directional data transfer. Actually we prefer using the parallel port for output.
What defines the port to be input or output is the port mode of operation. There are 5 modes to choose from.I'am not going to explain more details about that as I recommend it for output only and in this case there is no need for any additional configurations , any configuration will work.
More about parallel port modes here:
http://www.bb-elec.com/tech_articles/parallel_port_explained.asp
Hardware
The Parallel Port Connector is a 25 pin female (DB25) and its pin outs is shown in the picture below
The pins in the parallel port connector are divided in to three groups, they are
1) Data lines (data bus)
2) Status lines
3) Control lines
As the names refer, data is transferred over data lines, Control lines are used to control the peripheral and the peripheral returns status signals back through the status lines.
These lines are actually connected to Data, Control and Status registers internally.
Parallel port registers
as we said; The Data, Control and status lines are connected to their corresponding registers inside the computer. Each register has its own address by which you can send data to or receive from. The Bios assign a base address (usually 0x378H or 888d) for this port and through it you can access the other registers as follows:
Data register is (base address + 0) = > e.g. 888
Status register is (base address + 1) => e.g. 889
Control register is (base address + 2) => e.g. 890
So by manipulating these registers in a program written by any language, one can easily send data to parallel.
How to know the address of the parallel port in your PC?
If you are running windows machine do the following
Go to Control panel > System > Hardware tab>device manger > Then select there the parallel port you are interested from Ports (COM & LPT) section.
Double click on it and choose resources tab you will find the addresses assigned to the parallel port. You will need these addresses when programming to send data for the parallel port. Typical command may be Output (888, intVal); or __outb(890, shortValue)
Note: This last screen shot may differ from PC to another according to the mode and type of the parallel port in your PC. The first address should be the base address (here 0x378) and you can increment it to access other registers.
The details of parallel port signal lines are given below
Pin No (DB25) | Signal name | Direction | Register - bit | Inverted |
1 | nStrobe | Out | Control-0 | Yes |
2 | Data0 | In/Out | Data-0 | No |
3 | Data1 | In/Out | Data-1 | No |
4 | Data2 | In/Out | Data-2 | No |
5 | Data3 | In/Out | Data-3 | No |
6 | Data4 | In/Out | Data-4 | No |
7 | Data5 | In/Out | Data-5 | No |
8 | Data6 | In/Out | Data-6 | No |
9 | Data7 | In/Out | Data-7 | No |
10 | nAck | In | Status-6 | No |
11 | Busy | In | Status-7 | Yes |
12 | Paper-Out | In | Status-5 | No |
13 | Select | In | Status-4 | No |
14 | Linefeed | Out | Control-1 | Yes |
15 | nError | In | Status-3 | No |
16 | nInitialize | Out | Control-2 | No |
17 | nSelect-Printer | Out | Control-3 | Yes |
18-25 | Ground | - | - | - |
http://logix4u.net/Legacy_Ports/Parallel_Port/A_tutorial_on_Parallel_port_Interfacing.html
http://www.epanorama.net/circuits/parallel_output.html
No comments:
Post a Comment