Serial (RS232) Port Interface-Lect 2
Serial (RS232) Port Interface-Lect 2
• Unlike a parallel I/O port, which consists of a number of data lines and
each time transmits a byte; the serial data transmission requires only one
line. A byte is transmitted bit by bit.
• This reduces data lines between devices. It reduces the rate of data
transfer too; maximum data rates may be up to 20 kbps.
Serial data transmission:
• A serial data format includes four parts: a start bit (1 bit), serial data bits (5, 6, 7 or 8 bits), parity
check bit (1 bit) and stop bits (1 or 1.5 bit). Figure 1.6 shows a typical serial data format. When no
data is sent, the data line is at logic high. This is called the waiting stage.
• The beginning of a data transmission is indicated by pulling the line to the logic low state for 1 bit
time. This bit is the start bit.
• The data bits are then sent out one after another. The number of the data bits can be 6, 7 or 8.
• The parity check can be ODD, EVEN or NONE. The odd and even parities indicate that the total
number of ones ('1') in the transmitted serial data is an odd number or an even number. It is only
reliable to detect single-bit errors. Errors occurred to several bits cannot be detected.
• The last bits are the stop bits, which pull the data line to the high state for at least 1 bit time to
indicate the end of the data transmission. The number of the stop bits can be 1, 1.5 and 2 bits
• The standard baud rates for an RS232 serial port are 110, 150, 300, 600, 1200, 2400, 4800, 9600 and 19200.
• Knowing the baud rate, the number of bytes to be transmitted per second can be calculated. For example, if a
serial data has 8 data bits, no parity check and 1 stop bit, the total length of serial data bits is 10.
• The transfer rate for characters is the baud rate divided by 10. A baud rate of 9600 will transfer 960
characters per second.
• A specially designed electronic device which generates and receives the asynchronous serial data is called
the Universal Asynchronous Receiver/Transmitter (UART).
• In order to achieve a long distance communication, the TTL voltage level is converted to higher voltage level
(logic 0 = - 12 to - 3V, logic 1 = +3V to +12V). This is achieved by using dedicated RS232 drivers/receivers.
All drivers/receivers have an inverting action
RS232 port connector and connections
• A standard RS232 interface is a 25-pin interface housed in a 25-pin or a 9-pin D-type male connector.
Figure 1.7 gives the pin-out and functions of connectors.
Fig. 1.7: pin-out and function of the RS232 connectors and computers
• Two types of RS232 link between a computer and an external device are shown in Figure 1.8. The
arrows show the direction of data flow. Figure 1.8(a) is known as the null modem. Figure 1.8(b) shows
a connection using only three lines.
• A computer can have up to four RS232 interfaces installed. They are labeled COM1 to COM4. Each
COM port is associated with a UART inside the computer.
• The serial data signal SIN and SOUT are in a non-inverting form. The UART produces the TT'L/CMOS
voltage levels only. RS232 line drivers/receivers are connected between the UART and the RS232
connector.
• Base addresses of COM ports : The base addresses of COM1 to COM4 are summarized below.
COMI: 3F8h
COM2: 2F8h
COM3: 3E8h
COM4: 2E8h
• When a computer is switched on or reset, the BIOS checks all possible RS232 addresses.
• The memory locations for COM1 to COM4 are listed below.
• Another useful one-byte memory location is 0000:4011h. It stores the total number
of COMs installed. The information is contained in bit 3, bit 2 and bit 1 of the byte.
bit 3=0, bit 2=0, bit 1=0 >>> no COM port installed
bit 3=0, bit 2=0, bit 1=1 >>> one COM port installed
bit 3=0, bit 2=1, bit 1=0 >>> two COM ports installed
bit 3=0, bit 2=1, bit 1=1 >>> three COM ports installed
bit 3=1, bit 2=0, bit 1=0 >>> four COM ports installed