What are I/O Addresses (Port Addresses)

Before you start

Objectives: Learn what is I/O address, what is hexadecimal notation, and default I/O port assignment.

Prerequisites: no prerequisites.

Key terms: address, port, system, devices, hexadecimal, bus, configured, ports, base, notation


I/O Address

I/O address can also be referred to as the I/O port or simply Port Address. The I/O address allows communication between devices in the PC. It also allows this for the system software running on the PC. On our PC there are 65535 different port addresses available. I/O addresses are written using hexadecimal notation.

Hexadecimal Notation

Hexadecimal notation is the base 16 numbering system. In contrast, for everyday use we have a base 10 numbering system. In base 10 numbering system we have 10 characters which we use to form all numbers. Those characters are, 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

In the base 16 numbering system we have 16 characters which we use to form all numbers. Those characters are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. There are several ways to indicate a hexadecimal number. One way is to put letter “h” after the number, for example: “0553h”. There is also another way in which we put “0x” in front of the number, like this: “0x0553”.

Hexadecimal numbers are also used, for example, to specify an address in RAM and as we said to specify a particular port address.

CPU and I/O Ports

Our CPU has one special wire on it called the I/O/MEM wire. When current is applied to that wire, the system RAM is instructed to ignore the address bus. That means that we send data to the I/O port in a similar way that we would send data to a particular RAM address. The difference is that when the I/O/MEM is active, the RAM will ignore the address bus for a while. When that happens, devices in the system will start to monitor the address bus. The data is then sent on the address bus to a particular address. The address is specified by applying current to a certain pattern of wires on the address bus, and that specifies which address we are sending the data to. The device that has that I/O address will then respond.

All devices on our system must have an I/O port configured. All configured ports on the system must be unique. I/O ports can not be shared. Some devices always have default I/O port assigned. The list of default ports is quite long, but we will mention some of them. For example, keyboard can use address from range 60h to 6Fh. Primary IDE can use range 1F0h to 1F7h, and the secondary IDE is 170h to 177h. COM1 can use 3F8h to 3FFh, COM2 2F8h to 2FFh, COM3 is 3E8h to 3EFh, and COM4 is 2E8h to 2EFh. LPT1 uses 378h to 37F and floppy uses 3F0h to 3F7h. Sound card is set from 220h to 233h. Network Interface Card (NIC) is set from 300h to 31Fh.

When we install a new device on our system, the I/O port has to be configured. On older buses we had to do it manually, but now this will almost always be configured automatically. Some devices will actually have more than one I/O port assigned to them.