Vocademy |
The serial port is the oldest I/O port on computers, having been borrowed from the Teleprinter. In fact, the first proper I/O devices on computers were Teleprinters. This was a natural combination since the Teleprinter is a digital communication device. Computers needed a communication device to make it easier for people to get data into and out of them.
The core of a serial port is a circuit called a Universal Asynchronous Receiver Transmitter (UART). The core of the UART is a shift shift register. This shift register can accept data from or present data to the data bus in parallel. It could also accept data one bit at a time from the serial port circuitry and present data one bit at a time to the serial port circuitry. To transmit data, the UART first retrieves its data in parallel and then shifts it to the serial output one bit at a time. To receive data, the UART retrieves the data one bit at a time on the serial input, shifting the data from one flip-flop to the next with each clock pulse until a full byte or word, etc., has been received. It then presents this data in parallel to the data bus.
|
Serial ports use a signaling specification defined by the Electronic Industries Association (EIA) as Recommended Standard 232C (RS232C). RS232 is asynchronous. This means there is no information sent from the transmitting device to the receiving device to tell when the data is good; there is no clock signal sent along with the data. The transmitting and receiving devices must be configured to use the same baud rate.[1] Clocks in the sending and receiving circuits must be synchronized frequently for the system to work.
A logical 1 is represented by -12V, and a logical 0 is represented by +12V.
|
|
When using RS232, you are connecting two shift registers, one in the transmitting device and one in the receiving device. Both shift registers are clocked at the same time, causing the bits to shift from one register to the other as if the two shift registers were one big shift register. However, as explained above, the clock in the transmitting device is not sent to the receiving device. Therefore, the receiving device needs its own clock, which must be synchronized with the clock in the transmitting device.
|
This is done by the start bit. When the transmitting RS232 port is ready, it will hold the outgoing data wire at -12 V. This -12 V held on the transmit wire is called a "stop bit" and tells the receiving device to be ready for data.[2] Circuitry in the receiving device watches for the voltage to transition to +12 V. When the transition occurs, it synchronizes the clock in the receiving device. The period of time between this transition and the first data bit is called the "start bit."
To use RS232 ports, you must first configure the transmitting and receiving devices to agree on the following parameters:
Baud rate: up to 115,200 bits per
second
Data bits: 7 or 8
Stop bits: 1 or 2
Parity: none, even, or odd
This was done with jumpers or DIP switches in the distant past but is now done with software.
RS232 is limited to cables that are 25 feet long. This is because it uses an unbalanced signal (one data wire with a ground wire). RS422 is a version of RS232 that uses differential signaling (two wires with opposite voltages and no ground). RS422 can carry signals up to 10 Mbps for distances up to 1,500 meters.
The RS232 serial port was originally
developed mainly to connect to telephone modems. Later, they were used to connect
to printers and mice. Some modern motherboards still have a serial port
connector in the I/O cluster. Motherboards that don't have a serial port
connector usually have a serial port header somewhere on the board. You will
find few items for the average user to connect to the serial port, but specialty
devices still use RS232, such as microcontrollers and embedded systems.
IBM-based PCs have support for four RS232 serial ports. Early PCs had two
physical ports, one with a 25-pin D-Sub connector and the other with a 9-pin
D-Sub connector.
|
The pinouts of the connectors are as follows:
25-pin Connector
1 Shield Ground
2 Receive Data (RX or
RD)
3 Transmit Data (TX or TD)
4 Request To Send (RTS)
5 Clear To Send
(CTS)
6 Data Set Ready (DSR)
7 Signal Ground
8 Carrier Detect (CD)*
20 Data Terminal Ready (DTR)
23 Ring Indicator (RI) or Ring Detector
(RD)*
Pins 9 through 19, 24, and 25 are used for secondary signals and are not used on PCs.
9-pin Connector
1 Carrier Detect (CD)*
2
Receive Data (RX or RD)
3 Transmit Data (TX or TD)
4 Data Terminal Ready
(DTR)
5 Signal Ground
6 Data Set Ready (DSR)
7 Request To Send (RTS)
8 Clear To Send (CTS)
9 Ring Indicator (RI) or Ring Detector (RD)*
*Only used by modems and may not be on all ports.
With support for four serial ports and only two physical ports, at least two more ports could be connected via the expansion bus. AST produced a combination memory expansion and serial port board with six serial ports called the Six Pack. Such boards were used in the days before the Internet to connect multiple modems for remoter users.
The RS232 port was designed for modems, but by the early 1990s, it was common to have "internal" modems plugged directly into the expansion bus. These internal modems were a combination serial port and matching modem on a single expansion card.[3] Other than the convenience of not having a modem and cable on the desk, one common reason for using internal modems was that older computers couldn't keep up with faster modems. The internal modem often had a faster serial port than most computers' serial ports. So, to use a fast modem, you either had to install a faster serial port or get an internal modem.
Serial port and Com port are not exactly synonymous. If you had four serial ports, they would be Com 1, Com 2, Com 3, and Com 4. However, serial port 1 doesn't have to be Com 1. The serial port that uses I/O address 03F8h is Com 1, regardless of whether that is serial port 1 or another port. The I/O address assignments for the ports are listed below.
An important point to remember when using more than two serial ports was that only two ports could use interrupts. IRQ 4 was used by Com 1 and Com 3, whereas IRQ 3 was used by Com 2 and Com 4. Therefore, you could not put a mouse on Com 1 and a modem on Com 3. This is because both the mouse and modem use interrupts. On the other hand, you could use a mouse on Com 1 and a serial printer on Com 3 because serial printers don't use interrupts (the AST Six Pack used special drivers to get around this).
The resource assignments for the serial ports are as follows:
Com 1
IRQ 4
I/O address 03F8
Com 2
IRQ 3
I/O
address 02F8
Com 3
IRQ 4
I/O address 03E8
Com 4
IRQ 3
I/O
address 02E8
Most modern computers with a serial port have a single serial port configured as Com 1, Com 2, Com 3, or Com 4.
Windows 3 could not skip Com port numbers. This caused a problem with internal modems. Typical computers had two physical serial ports assigned to Com 1, Com 2, and Com 1 usually had a mouse plugged into it. If you installed an internal modem (a modem on an expansion card), you could not assign its serial port to Com 3 because that would conflict with the mouse on Com 1 (see above for the IRQ problem). Therefore, the logical thing to do was configure the modem as Com 4. This worked fine in DOS, but Windows would reassign the modem to Com 3, causing it to conflict with the mouse. Therefore, it was common practice to disable serial port two on the multi-I/O card and assign the internal modem to Com 2.
"Null modem" is perhaps the silliest name ever invented for a piece of computer equipment. To connect two computers, you connect a serial port to a modem, the modem connects to another modem over telephone lines, and the other modem connects to the other computer through its serial port. What if the computers are in the same room? You don't need the modems; you can connect the serial ports directly to each other. What is the name of the cable that connects the two computers via their serial ports? Wait for it...a null modem. I guess "serial cable" was just too obvious.
Before inexpensive Ethernet cards,
connecting computers with a serial cable to copy files was common. Several
programs could facilitate this, but the most famous was LapLink (because it was
used to copy files between laptop and desktop computers). Therefore, another
name for a serial cable was a LapLink cable. These cables often had both 25-pin
and 9-pin connectors on each end, so it didn't matter which connector was
available on each computer.
Vocademy |