PC Serial Ports
The microprocessor/serial port communication consists of two aspects: an I/O port address and an interrupt request signal (IRQ). The I/O port address represents a small region of the microprocessor's input/output memory space that is used to pass data back and forth to the serial port. This memory region acts something like a mailbox: Outgoing mail (data from the microprocessor to be transmitted to the peripheral device) is placed in the mailbox by the owner (the microprocessor) to be picked up by the mail carrier (the serial port hardware) for subsequent delivery to the destination party (the peripheral device). In turn, the mail carrier (the serial port hardware) places incoming mail (data from the peripheral device) into the box to be picked up by the owner (the microprocessor). This analogy illustrates an additional important point about I/O port addresses: Just as individual mailboxes help the residents in a neighborhood keep their mail from getting mixed up, each device using an I/O port address to communicate with the microprocessor should have a unique address that does not conflict with that of any other device.
IRQ Mechanism
The mailbox analogy is also helpful in understanding the IRQ mechanism. Normally, we place our outgoing mail in our mailbox at any convenient time before the mail carrier arrives to pick it up. The outgoing mail sits in our mailbox until the mail carrier arrives, at which time it is picked up and possibly some incoming mail is placed in the mailbox. Then, some time later, we check our mailbox and retrieve our new incoming mail. The problem with this scheme is that it is not very efficient; both the outgoing and incoming mail spend some time just sitting in the mailbox. A better approach would be if the mail carrier provided some sort of signal (for example, ringing the doorbell) to announce his or her arrival, in which case we could hand over the outgoing mail and pick up the incoming mail immediately.