Classic Computer Magazine Archive COMPUTE! ISSUE 20 / JANUARY 1982 / PAGE 70


Getting Outside The Computer

Michael E. Day
Chief Engineer
Edge Technology

Getting a computer to communicate with the outside world is not an easy task. In fact, many of the "internals" of the typical computer are devoted to the task of converting information from or to a form that the computer can understand.

Sometimes attached equipment (peripherals) is designed to meet the computer part way. This helps to reduce the circuitry and/or work that the computer needs to convert the information into or out of a form it can understand.

Keyboards are sometimes set up this way. Other times, due to the complexity of the work involved, a large amount of the work must be done by the computer.

Monitors, for example, can cause some difficulty since, if the computer is spending too much time "servicing" the attached devices, too little time is left to run the program. An example of an extreme case of this is the SINCLAIR ZX80 which actually spends all of its time servicing the monitor and keyboard. Because of this, it must stop servicing the display in order to run a program (causing the display to go blank). The ZX81 cures this problem by having a slightly improved display service routine which gives the computer a little time to squeeze in the program.

In order to solve this problem, IC manufacturers came up with a "Video Controller" IC. This little chip (a computer in its own right!) does all the service work for the computer, and allows the computer to do more important things like running your program.


When the computer is to communicate over the phone line, the same problem occurs. The computer can spend a large amount of time doing the required work, or we can bring in another device to do it for the computer. This is called the UART (Universal Asynchronous Receiver Transmitter) or USART (Universal Synchronous / Asynchronous Receiver Transmitter) depending on which flavor you like.

A UART accepts information from the computer in a form which the computer understands and converts it to the form necessary to transmit the information out of the computer. Additionally, it accepts information sent to the computer and converts it to a form which the computer uses.

Inside the computer, we deal with data in a form called byte. When this is translated to the form it takes on the outside it becomes a character. A byte is made up of eight bits, with bit being the simplest form of data representation inside a computer. A bit consists of nothing more than an ON or OFF condition. When a computer is using the information it works with all eight bits of the byte at once. This is called parallel operation since eight bits are used simultaneously. Since each bit has two possible conditions (on or off) and since we are working with eight bits at once, this means that by using these bits together we can represent two to the eighth (256) possible conditions.

By taking some of these 256 states and defining them as representing something such as characters in the alphabet, we provide a means for the computer to work with information as we humans understand it.

Since the computer must know whether data is your information or its own, one of the bits is usually set aside to indicate this. This leaves us two to the seventh (128) possible things which we can represent as our own information. When using the computer to communicate to other equipment, the equipment generally requires certain "control codes" to perform some of its functions — returning the carriage on a printer or clearing the screen on a video terminal. Generally, 34 of the possible representations* are set aside for the purpose of controlling equipment. This leaves 94 possibilities left to represent all the characters in the alphabet (both uppercase and lowercase letters) the numbers (0 through 9) and some of the more commonly used symbols.

When we want to send this information over the phone lines, we run into a problem. The phone network is an entirely different environment, and is not at all compatible with computerized information.

Digital Into Audio

This is where the MODEM comes in. The MODEM changes the digital signals which the computer likes into the audio signals the phone network likes. (For this discussion we will assume that a BELL 103 compatible MODEM is being used in the originate mode.)

When an on condition is sent to the MODEM, it transmits a 1270 Hz signal. When an off condition is sent to the MODEM, it transmits a 1070 Hz audio signal.

This allows us to send digital signals, but we still have a problem. The computer is dealing with 256 possible combinations at any one time, but the modem can only handle two conditions at any one time. This is what the UART is for. The UART takes a byte that the computer feeds it and breaks it down into bits that can be sent through the MODEM. In order to do this it takes the eight bits which make up the byte and transmits them one at a time. The timing of this is critical. The computer at the other end (the remote unit) that is receiving this information has to have some way to reconstruct this sequence back into the byte that the computer can understand. It must have a UART to do this. We can't just send the information whenever we feel like it.

Timing Is Critical

The first thing we have to do is define what a bit will be. This is defined as being an on or off condition for a specified period of time (This is referred to as the bit time or bit rate). This way, the remote UART can know that, once it starts to receive the information, the first bit will be presented to it for one bit time. Then, the next bit will be presented to it for another bit time. This continues until the last bit has been sent.

We also must specify which bit is to be sent first. By taking the bits that make up a byte and labeling one of them as the Least Significant Bit (LSB), and another as the Most Significant Bit (MSB) we can define that we will send the LSB first followed by the next to the least significant bit until we reach the most significant bit which is the last one that gets sent. This allows the remote UART to know what order the bits are being sent and it can reconstruct a byte properly.

Since this is a time-dependent activity, we need to have a way to synchronize the two UARTs so that the one that is receiving the information is looking at the right bit at the right time. To do this, the UART adds an extra bit to the byte that is being sent called a start bit. When no information is being sent, the UART will send a continuous on signal to indicate that it is in an idle condition (sometimes referred to as a marking condition). When something is to be sent, the UART will send a single off bit to let the remote UART know that it should begin collecting bits.

Since the computer only uses seven bits to represent a character, the UART makes use of the eighth bit for itself. This is usually referred to as the parity bit. The parity bit is created by adding up the number of on bits in the character that is being sent and, if there are an even number of on bits in the character, the parity bit is turned on. If there is an odd number, it is turned off (assuming that the standard even parity convention is being used). This lets the remote UART know if the information sent was lost or damaged during transmission. The remote UART does this by adding up the on bits it receives and then compares this sum to the parity bit that the first UART sends it.

One Final Problem

Now we have only one final problem with which to deal. The remote UART knows that the transmission has begun when it receives the start bit, but what happens if the parity bit (which is the last bit sent) is an off bit like the start bit? The remote UART has to have some way of being able to recognize the next start bit. To do this, we have to insure that an idle condition always precedes the start bit so that there will always be an on condition prior to the off condition generated by the start bit. So, the UART adds one final bit to the information called the stop bit. The stop bit is always an on bit insuring that there is always an idle condition generated before the next is sent. This means that a sum total often bit times is required for the computer to send each character.

In the next column, I will discuss the inter-reaction of the UART and the computer with regard to timing.

* Note: the "space" as an alphabetic character does not exist. It is, in reality, a control function. It has come to be used and referred to as a character because it is simpler to represent this non-character condition in the context in which real characters are used. This is analogous to the number zero which is not really a number, but is used as one to represent the condition of nothingness.