Stuart Baker Software offers high quality consulting services and products to users of IBM PCs and compatibles (DOS and Windows)
    as well as Interdata, Perkin-Elmer and Concurrent Computer Corporation 3200 series machines (OS/32).

PC Serial Communications


 

Serial Communications Using a PC


by Stuart Baker
Stuart Baker Software
9370 Golondrina Drive
La Mesa, CA 91941-5654
(619) 466-8811

My last few articles addressed connecting PCs to your Concurrent Computer systems using networks. There are still many companies that have not taken up the call of networking their PCs. This leaves many PCs that must be connected using their own serial ports. While this appears simple on the surface, the entire issue of serial communications on a PC is very complex.

If you are the type of person that does not connect his PC to any system, or just uses his modem at 1200 or 2400 bps, this article will not be of interest to you. On the other hand, if you are making direct connections to your Concurrent, or using the new high speed modems, read on. Also, if you are considering upgrading you PC system, the following information may influence the type of hardware you purchase.

Since most people like to get the best possible performance out of their systems, they tend to run directly connected terminals and PCs at the highest speed possible. Because of this, connections to your Concurrent system will usually be at 19,200 bps. If your Concurrent system uses the new Macrolink 16-Line Communications Multiplexer, you will probably be connected at 38,400 bps. For users of high speed (V32bis, V42bis) modems, you can use speeds up to 57, 600 bps. If you are using a slow PC, or many Terminate and Stay Resident (TSR) programs, serial port speeds above 9,600 bps are likely to encounter problems.

Unlike a stand alone terminal, designed for only one function, PCs perform many tasks. Because PCs are so versatile, most of them use TSRs to perform additional functions. Unfortunately, some of these programs may interfere with serial communications. With the addition of another layer like Windows, keeping up with high speed serial communications becomes even more of a challenge.

The current version of PC-Passport uses the serial port's status to detect communications errors. Being able to display hardware errors greatly simplifies troubleshooting serial communications problems. This article addresses overrun errors (read as "lost data").

The standard ACE (Asynchronous Communications Element) used in most PCs has a one character buffer. When an incoming character is assembled, it is placed into the buffer and the application program is interrupted. The ACE then starts to assemble the next character. When the next character is assembled, it is placed into the buffer. If the preceding character has not been read from the buffer, the overrun status is set, indicating that we have lost a character.

Overrun errors have many possible causes, some obvious and some not so obvious. Just try to use a modem running at 57,600 bps on a 4.77 MHz 8088 PC. Its overrun city, the 8088 simply does not have enough power to service interrupts quickly enough. Using a slower speed like 19,200 bps on the 8088 seems to work quite well, but in reality it is bordering on the edge of disaster. Pressing and holding either the Ctrl or Alt key will generally result in overrun errors! This is one of the not so obvious conditions mentioned earlier. Why would pressing a key that does not even generate a character, produce overrun errors? When you press and hold any key, the keyboard generates a continuous stream of interrupts. Depending upon the efficiency of the PC's BIOS, this may consume a considerable amount of CPU time, thus the overrun errors.

Another not so obvious thief of computer resources could be your memory manager. WHAT? How can a memory manager cause problems. Well it can. I have had personal experience with data loss caused by QEMM, Quarterdeck's expanded memory manager. I discovered that when I used QEMM I was losing about 30% of the performance on my 20 MHz 386 system. A call to their technical support revealed that normally QEMM is not a burden to the system, but if you use Stealth mode watch out. Removing the Stealth option cured the data loss.

Windows presents an entirely new challenge. When you run a DOS program in 386 enhanced mode, Windows creates a virtual machine. When your application accesses the serial port hardware, it is not controlling the real serial port. Windows actually controls the hardware and receives characters into its own buffer. It then interrupts your application and pretends that the data is coming from the serial port. Talk about overhead!

With so many potential problems, do you need a 66 MHz 486 to perform serial communications at high speed without loss of data? Thankfully, NO! The answer to all of the above mentioned problems is a buffered ACE. The ACE used in most early PCs will have a number like 8250, 82450 or 16450 (maybe with leading or trailing letters, depending upon the chip manufacture). The chip comes in a 40 pin Dual-In-Line package and a 44 pin Chip Carrier Package. If your current ACE is on a socket, you are in business. The answer to all of your problems is a pin for pin replacement with a part number of 16550A. Simply replace your existing ACE with a 16550A and you are off and running. If you are located in a large city, these parts should be readily available. If not, all is not lost, you can order the Dual-In-Line package by mail. It is available through Digi-Key Corporation for $12.38 plus shipping. All you have to do is call 1-800-DIGIKEY and ask for part number NS16550AFN. I think the part number for the Chip Carrier is NS16550AFV, but I could not locate this number in the Digi-Key catalog.

If your PC's serial ports are on the system board, they probably are not on sockets. In that event, you will need to purchase an interface that uses buffered ACEs. Fortunately, there are VLSI chips that contain two buffered serial ports and one parallel port, so these boards are very reasonably priced at around $60.00.

Many of today's high performance systems come with buffered serial ports as standard equipment. My new Dell 466/ME comes with two buffered ACEs on the system board. I think the computer manufactures are missing the boat, the slow machines need buffered serial ports more than the high performance machines, and the cost difference is very small.

When you power up your PC, the new ACE starts with all buffering disabled, so it works just like your original ACE. Because of this, software that is not aware of the buffered ACEs will work as it always has. Software that recognizes the 16550A will enable the buffering and take full advantage of the chip.

Let's take a look at the features of these new ACEs. These chips offer a 16 character FIFO buffer in place of the one character buffer of the original ACEs. This feature alone gives your application 15 times as long to read a character before the overrun status gets set. But this is not the real advantage of these new chips. The application program can also set an interrupt threshold that greatly reduces the overhead of processing interrupts. Let's look at this feature in more detail.

In addition to enabling the FIFO buffer, the application program can select an interrupt threshold of 1, 4, 8 or 14 characters. For example, PC-Passport selects a threshold of one for 300 bps, four for 600 bps and eight for all other speeds. Let's say that you set the ACE to interrupt every eight characters. As characters arrive, they are placed into the FIFO buffer until the threshold is reached. When the threshold is reached, your application receives its first interrupt. When the interrupt is serviced, the application reads all of the characters from the FIFO. You can readily see that this will reduce the amount of resources required to read data by almost 800%! But what happens if the incoming flow of data stops when only five characters are in the FIFO buffer. This new ACE is very smart, if another character does not arrive within four character times, it generates an interrupt to allow your application to flush the data from the FIFO buffer.

You may have noticed that PC-Passport sets a lower threshold for 300 and 600 bps than it does for the other speeds. If you think about the fact that it takes over .25 second to receive eight characters at 300 bps, it is obvious why we made this choice. Leaving the threshold set to eight makes for a very erratic display of data. We don't expect that many people are using 300 bps anymore, but we may as well make it look good if they do. Setting a threshold of one for 300 bps also eliminates the four character delay when data flow stops. At speeds above 300 bps, the four character delay is not really noticeable.

So what do all these neat features mean in the real world? The performance is incredible. Between reducing the amount of computer resources required and extending the number of characters that may arrive before overrun status is set, even the slowest PCs can handle very high speeds without losing data. Let's look once again at the extreme example of using a modem at 57,600 bps on a 4.77 MHz 8088. With the buffered ACEs installed, all of the overrun errors are gone! The system has no problem servicing interrupts. Since the throughput does not even come close to 57,600 bps, the PC must use flow control to throttle the host, but their is no danger of losing data due to overrun errors.

If you are using Windows, the buffered ACEs are an absolute must. The Windows 3.1 serial port driver is 16550 aware and takes full advantage of the chip. In our testing, we have run PC-Passport at 38,400 bps without any loss of data. Since Windows needs a lot of computer resources, a 800% reduction in interrupt service overhead goes a long way. Not only are overrun errors virtually eliminated, but serial port throughput is greatly increased. Since Windows is a multi-tasking environment, it is still possible to have enough contention from other applications to cause data loss even with the 16550 ACEs installed.

If you are having problems with lost data, it's time to upgrade your serial ports. It's not often that you can get so much performance improvement for such a small amount of money. If you are not having problems at this time, you should still consider the upgrade to insure you will not have problems in the future. If you are considering the purchase of new computer hardware you should insure that it comes equipped with 16550A buffered ACEs.

If you are considering the purchase of a new modem, I highly recommend going with the V32bis, V42, V42bis type modems. These modems can communicate over the telephone line at 14,400 bps and achieve throughput approaching 57,600 bps with the aid of their data compression techniques. Thanks to the CCITT standards, modems from many companies communicate with each other with no problems. If you plan on purchasing an internal modem, make sure that it contains a 16550 compatible interface.

Using these new chips, you can successfully use an original IBM PC to run MTM and Reliance OS/32 sessions at 38,400 bps. If your PC has a MDA display, you can expect throughput of about 7000 bps running PC-Passport from DOS. You will not have problems with lost data, but you will not see the snappy display performance that you would expect when running at 38,400 bps. By comparison a 20 MHz 386 has no trouble maintaining a throughput of 38,400 bps. At this speed, Reliance screens virtually snap onto the screen.

Well that about does it for this issue. Ellen is already working hard on Interchange 94! So it is definitely time for everyone to start making plans to attend Interchange 93. We need another good turnout.

Return to Index
Article Copyright 1993 Stuart J. Baker

This SBSW.COM page has been optimized for printing.
Web Content Copyright © 1997 - 2010 Stuart Baker Software. All rights reserved.

Please use our Feedback form to submit questions or comments about this web site.
Web Content Copyright © 1997 - 2010 Stuart Baker Software. All rights reserved.
This site was last modified: Wednesday, December 29, 2010