Previous Section  < Day Day Up >  Next Section

Hack 79 Boost COM Port Performance

figs/beginner.gif figs/hack79.gif

If your PC has a COM port, tweak your state-of-the-art UAR/T chip through Windows settings.

Back in the olden days of the early PCs, getting online meant dialing in to CompuServe, Delphi, or The Source with a 300- to 1,200-baud modem, only to arrive at the legacy equivalent of Telnet—plain white characters on a green or black screen background, text menus (online servers were truly mainframes back then), and XMODEM downloads of "huge" 300 KB files. Back then, you could connect at 2,400 baud—or better yet 9,600—if your local node supported it, but this was a real challenge and a technical stress on PC serial ports. Generally, a PC built before 1990 couldn't communicate with the outside world any faster than 9,600 bits per second (bps).

The main component that made up the serial/COM port in the PC was a component called the 8250 Universal Asynchronous Receiver/Transmitter chip (UAR/T). The 8250 was capable of transferring data at a rate of 9,600 bps, roughly 960 ASCII characters per second. In the IBM PC-AT systems, the UAR/T was upgraded to the 16450 chip, which doubled the reliable throughput to 19,200 bps.

Both of these chips generated an interrupt signal to the CPU for every character of data or control information that came across the port. This was highly inefficient and bogged down the PC to a crawl, which didn't matter under single-tasking DOS but had a severe impact on the performance of multitasking Windows.

After becoming aware of this tremendous bottleneck, various chip makers created a new version of the UAR/T that provided 16 bytes of first-in/first-out (FIFO) data buffer, which held a chunk of data back until the buffer was full, reducing the need to interrupt the CPU significantly. The 16550 UAR/T was born. Unfortunately, the original 16550 had a design flaw: the buffer didn't work! Very quickly, the 16550A version of the chip was released in which the buffering did work. The result was a serial/COM port that could achieve 115 kilobits-per-second (kbps) transfer rates—a whopping 11.5 kilobytes per second (8 bits for data, 2 bits for data control information). Chip maker SMC created a combined serial/COM and parallel/LPT port chip to condense three ports into one smaller chip—a great idea, but the serial port didn't work right in some of its early production runs, so a special patch program was distributed to turn on all of the chip's features.

Later versions of this popular UAR/T chip came out: the 16650 UAR/T with a 32-byte FIFO, the 16750 UAR/T with a 64-byte FIFO, and the 16950 UAR/T with a 128-byte FIFO. For all their speed advantages, these have never seen the light of regular PC production: except for ISDN data connections, telephone and modem technology never exceeded the 53 kbps speed barrier so there was really no need for a serial port with data throughputs of 256-512 kbps. Instead, Ethernet ports, ISDN, DSL, and cable modems served the need for high-speed data connections, while USB ports handled higher-speed peripheral devices.

In support of these different UAR/T chip communications, software makers and Microsoft had to recognize the type of UAR/T chip present and be able to configure the chip for the best possible performance. Popular programs like Procomm Plus, shareware COM-AND, and Windows 95 were able to take advantage of the newer UAR/Ts and support the old if needed. Buffered 16550 UAR/T support was invisible in DOS and later Windows-based terminal programs; they simply set the device for maximum performance and went about their business. Windows, on the other hand, held back just a bit and limited port speed and buffer use so serial communications didn't visibly impact Windows performance.

Figure 8-4 shows the basic serial port configurations in Windows. Normally the "Bits per second:" parameter is set to 9,600, while optimum performance is achieved if the value is set to 115,200.

Figure 8-4. Basic serial port configuration in Windows XP
figs/pchk_0804.gif


Figure 8-5 shows the advanced settings for a serial port. By default, Windows sets the receive buffer a notch lower than optimum so that communications do not disrupt overall Windows performance

Figure 8-5. Advanced serial port configuration in Windows XP
figs/pchk_0805.gif


Fortunately, Windows-based communications programs, from Hyperterm to Procomm Plus to the CompuServe and AOL services, could override the port speed value and set it to 38,400 or 57,600 themselves to accommodate 14.4, 28.8, and 56K modem technologies, but they did not tamper with the buffering value.

To achieve the best serial port performance, access each COM port's Properties, select the Basic Serial Port Settings dialog (Figure 8-4) through Device Manager, set the port speed as high as possible, and then select the Advanced button to access the UAR/T buffer settings (Figure 8-5) and set both Transmit and Receive buffers to their maximum values.

    Previous Section  < Day Day Up >  Next Section