This page is a part of VPortPro online Help Manual.
VPortPro-client with Com Port Control by Labtam.
VPortPro makes serial (RS232) data from your PC available on TCP/IP-based networks and makes TCP/IP data available on virtual serial ports of your PC. Visit Home of VPortPro for more information.



Appendix B. Serial Connection Overview


Notes on the RS232 Standard

There are two basic types of serial communications, synchronous and asynchronous. With synchronous communications, the two devices initially synchronize themselves to each other, and then continually send characters to stay in sync. Even when data is not really being sent, a constant flow of bits allows each device to know where the other is at any given time. That is, each character that is sent is either actual data or an idle character. Synchronous communications allows faster data transfer rates than asynchronous methods, because additional bits to mark the beginning and end of each data byte are not required. The serial ports on IBM-style PCs are asynchronous devices and therefore only support asynchronous serial communications.

Asynchronous means "no synchronization", and thus does not require sending and receiving idle characters. However, the beginning and end of each byte of data must be identified by start and stop bits. The start bit indicates when the data byte is about to begin and the stop bit signals when it ends. The requirement to send these additional two bits cause asynchronous communications to be slightly slower than synchronous however it has the advantage that the processor does not have to deal with the additional idle characters.

An asynchronous line that is idle is identified with a value of 1 (also called a mark state). By using this value to indicate that no data is currently being sent, the devices are able to distinguish between an idle state and a disconnected line. When a character is about to be transmitted, a start bit is sent. A start bit has a value of 0 (also called a space state). Thus, when the line switches from a value of 1 to a value of 0, the receiver is alerted that a data character is about to come down the line.

The RS232 port was intended to be a general input/output port, thereby allowing data to be sent and received to and from many different types of external devices. The standard defines the electrical characteristics (i.e. connector pin-outs, voltage levels and electrical signals) for transmitting data from one electronic device to another. The RS232 interface is also called a "serial" interface because digital data is transmitted "serially" one bit at a time. Bytes of data are taken apart by a transmitter with each bit being transmitted in series. The receiving device collects the bits and puts them back together into the original data bytes. The content and structure of any data that is transmitted is not defined by the RS232 standard, however, the most commonly used format for data is text and decimal numbers, i.e. readable data (at least in the measuring instrument industry).

In addition to RS232, RS485 and RS422 data is also serial. RS 485 is also called "multi-drop" as you can address multiple devices over an RS485 cable. Both RS485 and RS422 are easily converted to RS232 or you can purchase special ports for your PC.

Every PC in the world comes equipped with at least one or two serial ports (RS232 connectors). Even laptops and palmtops come with at least one serial port. All IBM PC and compatible computers are typically equipped with two serial ports and one parallel port. A serial port sends and receives data one bit at a time over one wire. Two-way (full duplex) communications is possible with only three separate wires - one to send, one to receive, and a common signal ground wire. The serial port on your PC is a full-duplex device meaning that it can send and receive data at the same time. In order to be able to do this, it uses separate lines for transmitting and receiving data.

Stop bits frame data packets in asynchronous communication. These tell the receiving device that a byte has been sent. Because data is received at irregular intervals, the receiving device must be signaled to let it know when the data bits of a character begin and end. This is done by means of start and stop bits. Modern asynchronous protocols never require more than one stop bit.

Once the start bit has been sent, the transmitter sends the actual data bits. There may either be 5, 6, 7, or 8 data bits, depending on the number you have selected. Both receiver and the transmitter must agree on the number of data bits, as well as the baud rate. Almost all devices transmit data using either 7 or 8 data bits.

Notice that when only 7 data bits are employed, you cannot send ASCII values greater than 127. Likewise, using 5 bits limits the highest possible value to 31.

After the data has been transmitted, a stop bit is sent. A stop bit has a value of 1 - or a mark state - and it can be detected correctly even if the previous data bit also had a value of 1. This is accomplished by the stop bit's duration. Stop bits can be 1, 1.5, or 2 bit periods in length. Note that stop bit 1.5 is supported by most serial port hardware only if data size is set to 5 bits. It is not commonly used.

The transmission rate (or baud rate) is the speed at which a device communicates. Baud rate refers to the number of times the condition of the line changes. This is equal to bits per second only if each signal corresponds to one bit of transmitted data.

Modems must operate at the same baud rate in order to communicate with each other. If the baud rate of one modem is set higher than that of the other, the faster modem usually alters its baud rate to match that of the slower modem.

Besides the synchronization provided by the use of start and stop bits, an additional bit called a parity bit may optionally be transmitted along with the data. A parity bit affords a small amount of error checking, to help detect data corruption that might occur during transmission. You can choose even parity, odd parity, mark parity, space parity or none at all. When even or odd parity is being used, the number of marks (logical 1 bits) in each data byte is counted, and a single bit is transmitted following the data bits to indicate whether the number of 1 bits just sent is even or odd.

For example, when even parity is chosen, the parity bit is transmitted with a value of 0 if the number of preceding marks is an even number. For the binary value of 0110 0011 the parity bit would be 0. If even parity were in effect and the binary number 1101 0110 were sent, then the parity bit would be 1. Odd parity is just the opposite, and the parity bit is 0 when the number of mark bits in the preceding word is an odd number.

Parity error checking is very rudimentary. While it will tell you if there is a single bit error in the character, it doesn't show which bit was received in error. Also, if an even number of bits were in error then the parity bit would not reflect any error at all.

Mark parity means that the parity bit is always set to the mark signal condition and likewise space parity always sends the parity bit in the space signal condition. Since these two parity options serve no useful purpose whatsoever, they are almost never used.

Flow control is the method by which a device controls the rate at which other devices send data to it. There are six different links involved in a connection: transmitting computer to transmitting modem, transmitting modem to receiving modem, receiving modem to computer, and the reverse of all three links. They can all have different data transmission rates. When the receiving modem is temporarily unable to accept the data, it needs a way to tell the transmitting modem to slow down or wait for it.

If flow control is improperly configured, it may be impossible to connect to a remote system, the transfer rate may be considerably slowed, or the connection may be disrupted. If you see many errors and data retransmissions, check both the device and the communication program settings for flow control. Flow control settings for both the communication program and the device must be the same. Many communication programs set these automatically based on the device, but some must be configured separately.


Notes on DTE and DCE

Two terms you should be familiar with are DTE and DCE. DTE stands for Data Terminal Equipment, and DCE stands for Data Communications Equipment. These terms are used to indicate the pin-out for the connectors on a device and the direction of the signals on the pins. Your computer is a DTE device, while most other devices are usually DCE devices.

If you have trouble keeping the two straight then replace the term "DTE device" with "your PC" and the term "DCE device" with "remote device" in the following discussion.

The RS-232 standard states that DTE devices use a 25-pin male connector, and DCE devices use a 25-pin female connector. You can therefore connect a DTE device to a DCE using a straight pin-for-pin connection. However, to connect two like devices, you must instead use a null modem cable. Null modem cables cross the transmit and receive lines in the cable

RTS stands for Request To Send. This line and the CTS line are used when "hardware flow control" is enabled in both the DTE and DCE devices. The DTE device puts this line in a mark condition to tell the remote device that it is ready and able to receive data. If the DTE device is not able to receive data (typically because its receive buffer is almost full), it will put this line in the space condition as a signal to the DCE to stop sending data. When the DTE device is ready to receive more data (i.e. after data has been removed from its receive buffer), it will place this line back in the mark condition. The complement of the RTS wire is CTS, which stands for Clear To Send. The DCE device puts this line in a mark condition to tell the DTE device that it is ready to receive the data.

Likewise, if the DCE device is unable to receive data, it will place this line in the space condition. Together, these two lines make up what is called RTS/CTS or "hardware" flow control. COM Port Redirector supports this type of flow control, as well as Xon/Xoff or "software" flow control. Software flow control uses special control characters transmitted from one device to another to tell the other device to stop or start sending data. With software flow control the RTS and CTS lines are not used.

DTR stands for Data Terminal Ready. Its intended function is very similar to the RTS line. DSR (Data Set Ready) is the companion to DTR in the same way that CTS is to RTS. Some serial devices use DTR and DSR as signals to simply confirm that a device is connected and is turned on. COM Port Redirector sets DTR to the mark state when the serial port is opened and leaves it in that state until the port is closed. The DTR and DSR lines were originally designed to provide an alternate method of hardware handshaking. It would be pointless to use both RTS/CTS and DTR/DSR for flow control signals at the same time. Because of this, DTR and DSR are rarely used for flow control.




Home | Product | Download | Order Now | Upgrade | Support | Pricing | Company Information | Contact Us


Labtam Copyright 1999 - 2007 LabtamTM Inc.