Rsd

The serial port on your PC follows a standard called RS-232D, This standard describes the signal lines, and to which connector pin they are assigned. Strangely, it does not specify a connector type, but the 25-pin D connector is the de facto standard. There are 25 defined pins in the RS-232 standard, Amazingly enough, you may only need three of them.

The three workhorse pins In the RS-232 connector are:

2 (TD) Transmit Data

3 (RD) Receive Data

7 (SG) Signal Ground

As you can see from the list, an RS-232 connection can be very simple: someplace lo send the data, someptace to get the data, and a common ground. If this works, why bother with 25 pins?

Handshaking

In a perfect world, the receiver would be ready to receive whenever the sender was ready to send. Your own real-world experience will tell you, though, that the word "standby" is very useful. Digital communications is no different, and it is often the case that the data flow must be interrupted. This is called fiow control or handshaking. The RS-232 spec defines several status lines that are variously used for "hardware" handshaking:

4 (RTS) Request to Send

5 (CTS) Clear to Send

6 (DSR) Data Set Ready

8 (DCD) Data Carrier Detect

20 (DTR) Data Terminal Ready

These handshaking lines can be used En many ways, but the most common is the RTS/CTS combination. But what about our three-wire setup?

The three-wire connection provides only enough wires to get data to and from the terminal and DCE, This means that handshaking must take the form of software flow control. The standard form of software flow control is called XGN/XOFF protocol. To understand why, and how it works, we have to take a look at ASCII code again.

When transmitting data, it is often necessary lo send some information concerning the connection itself. In the case of flow control, we want to stop and start the data stream. How can we do this? Well, we could send STOP! every time we wanted to stop it, and START! to get it going again. The trouble with this approach becomes apparent when we decide lo send STOP! or START! as part of the message text itself. Well, you say. Hi probably never want to send that anyway, so Til just 'reserve" it as a command. You can't send it as part of a message, and that's that.

Well, this would work, but it would be very cumbersome. If we get a little clever we can reserve a single character, say V Then if V appears in the data stream, whatever follows should be interpreted as a command. This technique is known as an escape character, and is actually used, though not for flow control. While either of these techniques could get the job done, the designers of ASCII came up with a more transparent scheme. They reserved the first 31 codes as control characters. Yup, these are the codes that are generated when you hold down the control key and type a character. These characters need never be part of the text, and so can be immediately interpreted.

Each of the control characters has a name and function. Some of them have fallen into disuse, but there are a few of interest:

Character ASCII

CTRL+G 07

CTRL+H 08

CTRL+I 09

CTRL+J 10

CTRL+L 12

CTRL+M 13

CTRL+Q 17

CTRL+S 19

Function

0 0

Post a comment