Input-Output Ports Explained By Semalt Expert
In computers, any device (for example, a controller installed on an expansion card or a motherboard) except RAM is treated as a peripheral by CPU. Data exchange between the central processor and peripheral devices is carried out through input-output ports. IO port is a buffer device or register of a controller, digital signal processor, etc. which are directly connected to the computer IO bus. Through input-output ports, you can connect a variety of internal and external devices to your computer to expand its capabilities.
IO ports allow you to establish a connection between the devices and software in the computer. They are similar to two-way radio channels since the exchange of information in either direction occurs on the same channel.
To control the exchange of data between computer devices, each IO port is assigned its own unique number - port address. On PC 16-bit code is used to address IO ports. Therefore, there are 216 = 65 536 ports, numbered from OOOOh to FFFFh. The standard IO range for IBM-compatible computers is 0-3FFh. These include ports for keyboard controllers, hard drives and floppy disks, EGA / VGA video adapters, sound cards, serial and parallel interfaces, game ports and any other peripheral equipment. A peripheral device is capable of using multiple IO ports. Note that you can actually use addresses up to FFFFh. For example, ports of WT synthesis processor of the sound card have IO range 620h-E23h.
Ports are addressed by central processor when executing a program. To avoid indicating the specific address of each peripheral IO port during programming as well as to change the address promptly depending on the particular computer configuration, IO base address is used. The base address is assigned to each peripheral device and corresponds to the lowest address in the port group. The addressing of remaining ports of a peripheral device is carried out by specifying the offset relative to the base address.
IO base address of the peripheral device can be any address from IO range. BIOS reserves part of IO range for standard hardware devices that can't be used by other peripherals. For example, for LPT1 interface IO range 378h - 37Eh is reserved in which IO base address can be selected. Then the possibility of conflicts will be eliminated when addressing ports at hardware-software level. Since three registers are used for control and monitoring of LPT1, within this IO range, there are 5 possible values of base address - 378h-s-37Ch.
For data exchange with ports programmed input/output (PIO) is used. It transmits words with a bit depth of 8, 16 or 32 bits using string commands. The word can be transmitted for one or more bus cycles with an indication of the corresponding address in each memory access cycle. Bus exchange cycles are initiated during the execution of an IO command. The number of cycles depends on the alignment of the address along the word boundary and data bit depth of used bus. PIO data exchange speed exceeds the exchange speed of standard Direct Memory Access (DMA) channel.