Ham Radio Home
Radios Antennas Electronics Computer Miscellaneous

Ham Radio Project Status


Parallel Port Communications

The parallel port is a simple and inexpensive tool for building computer controlled devices and projects. The simplicity and ease of programming makes the parallel port popular in the electronics hobbyist world. The parallel port is often used in Computer controlled robots, PIC/Amtel programmers, home automation, etc. Here a simple tutorial on parallel port interfacing and programming with a few examples. Everybody should know what a parallel port is, where it can be found, and what it is used for. The primary use of parallel port is to connect printers with computers and is specifically designed for this purpose. Thus it is often called a printer port or centronics port (This name came from a popular printer manufacturing company 'Centronics' who devised a few standards for theparallel port.). You can see the parallel port connector in the rear panel of your PC, it is a 25 pin female (DB25) connector (to which a printer is usually connected to). On almost all the PCs only one parallel port is present, but you can add more by buying and inserting ISA/PCI parallel port cards.

The lines in DB25 connector are divided in to three groups:

1) Data lines (data bus)
2) Control lines
3) Status lines


As the name refers, data is transferred over data lines. Control lines are used to control the peripheral and of course, the peripheral returns status signals back to the computer through the Status lines. These lines are connected to Data, Control And Status registers internally. The details of the parallel port signal lines are given below:

Parallel Port Registers/Pinouts

Parallel Port Registers

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

-

-

-


Back to Top

Parallel port registers

The Data, Control and status lines are connected to their corresponding registers inside the computer. So by manipulating these registers from a program, one can easily read or write to a parallel port with programming languages like 'C' and BASIC.

The registers found in standard parallel port are:

1) data register
2) Status register
3) Control register

As their names specify, the Data register is connected to the Data lines, the Control register is connected to the control lines and the Status register is connected to Status lines. (Here the word connection does not mean that there is some physical connection between data/control/status lines. The registers are virtually connected to the corresponding lines.) So whatever you write to these registers, will appear in the corresponding lines as voltages (which you could measure with a multimeter). Whatever you give to the parallel port as voltages can be read from these registers (with some restrictions). For example; If we write '1' to the Data register, the line Data0 will be driven to +5v. Just like this, we can programmatically turn on or off any of the data lines and Control lines.

Where are these registers?
In an IBM PC, these registers are IO mapped and will have unique addresses. We have to find these addresses to work with the parallel port. For a typical PC, the base address of LPT1 is 0x378 and of LPT2 is 0x278. The data register resides at this base address, the status register at the base address + 1 and the control register is at the base address + 2. So once we have the base address, we can calculate the address of each of the registers in this manner. The table below shows the register addresses of LPT1 and LPT2:

Register

LPT1

LPT2

Data Register (base address + 0)

0x378

0x278

Status Register (base address + 1)

0x379

0x279

Control Register (base address + 2)

0x37a

0x27a


Back to Top



IC-703 Ham Radio

Ham Radio Quick Links

.:: Home :: QSL Cards :: Site Map :: CW :: Classifieds :: Contact Us ::.