Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Serial communication

p = 135-146

Lesson 3.10: Serial Communication
When you have completed this chapter you will:
• Knowing how the data are sent serially
• Do you know what baud rate and calculate the time it takes one byte to be transmitted serially
• Know what the UART
• indicate the usefulness of modem
• list the serial signals and explain their function
• To fix null-modem cable

3.10.1 Introduction
The serial communication is widespread. H serial communication is a simple way to exchange data between two digital devices. Each computer has serial ports for connecting to peripheral devices such as printer, mouse, modem (modem), or even other devices such as multimeters and handheld computers.
 Because of the wide dissemination of serial communication was necessary to create a model which should be complied with by manufacturers. The standard serial communication that prevailed in personal computers is the RS-232C. Thus, a manufacturer can make such a device wants, but if it has serial communication RS-232, you can give and get data easily from any other system (usually a computer) that has the same pattern.
3.10.2 Basic Concepts
The data in the case of serial communications sent or received in the form of consecutive bits, as shown in Figure 3.10.1.
 
Figure 3.10.1: Sending serial data
The bit displayed one after another in the form of voltage on the communication medium, which is a wire conductor. We have two voltage levels, one for the "0" and one for "1." Serial communication in the high voltage corresponding to "0" and low in the "1".
Each bit lasts a short time. The smaller this time so bit more you can send the computer in every second, through the line. In the example in Figure 3.10.1 we send a total of 10 bit with each bit takes time t = 1ms. So in one second can be transmitted more than 1 / r = 1000 bit. The number of bit that can be sent over the serial line is called in a second rate baud (baud rate). The baud rate is measured in baud or bits per second and written bps (bits per second). Multiples of this unit is Kbps or thousands of bits per second and Mbps or millions of bits per second. In the example in Figure 3.10.1, the speed of the serial is 1 Kbps.
3.10.3 The serial port and the UART
The computers can send serial data is provided with an appropriate regional unit, the serial port. As each regional unit so the serial port is on the runway.
 
Figure 3.10.2: The serial port sends data
The data inside a computer as we have seen organized groups with integer bytes, ie 1 byte (8 bits) - 2 byte (16 bits), etc. depending on the width of the corridor.
 Suppose now that the CPU wants to send over the serial port the character 'G'. For this purpose, the CPU communicates with the serial port through the channel and gives the whole character 'G'. The ASCII code for letter 'G' is the number 010 010 112 = 4716 (see Table 2.1.2). The serial port before sending the 'G' will send a zero bit which we call the start bit (Start bit). You will then start sending the 'G' by setting the line sending data (TD) in the state corresponding to the first bit of the character 'G' which is 1. Then you put a set rate baud, one after another all the remaining bit of the letter 'G', ie it will send the bit 1,0,1,0,0,1,0 (the least bit value to the highest value bit). The mission of the character is completed by sending one or two bit with value 1, which we call the end bit (Stop bit).
 Similarly if an external serial device sends data, writes one bit after another on the line to receive data (Receive Data - RD) of the serial port. The serial port is received and when completed a full byte, notifies that KME has received a data byte. The CPU then reads from the serial port.
 
Figure 3.10.3 The serial port receives data
In the example of Figure one external device sends the character "E" to the serial port. O ASCII code of the letter 'E' is the 6910 which is equal to 010000112. Once the serial port complete the adoption of the character after the appearance of fee bit, notifies that KME has received a character. The CPU then reads the character «E» from the serial port.
3.10.4 The UART
 The basic unit of a serial port is the UART. To UART converts parallel data received from the computer bus, a serial and vice versa.
 Consider the previous example where the KME is trying to send the character 'G' and look more carefully at the data output of serial port.
 Notice that the correlation between bits of the voltage is with "inverted" or negative sense. So the zeros correspond to a voltage +12 V and called time (Space) and aces correspond to a voltage-12V and are called signs (Mark). Furthermore we note that when sending a byte via the serial, the UART adds two more bits: One bit of '0 '(voltage +12 V) at the start bit called Start (Start bit) and one or even two aces (voltage -12V) at the end called the end bit (Stop bit).
 Examples of Figures 3.10.2 and 3.10.3 each bit lasts about 0,1042 ms. So in one second can be transmitted at most 1/0, 0001042  9600 bits so the baud rate is 9600 bps. Of course, if we consider that a character other than 8 bits of information we have at least one bit in the beginning and an end, the total number of bits is 10 and the total time is 1,0420 ms for sending a character. In other words, the data transmission speed is 1/0, 0010420 = 960 bytes / sec. In practical use standardized values for baud rates shown in Table 3.10.1.
Baud rate
110 bps
300 bps
1200 bps
2400 bps
4800 bps
9600 bps
19200 bps
38400 bps
57600 bps
115200 bps
230400 bps
Table 3.10.1
 At the same rate that sends data to the UART in the same rhythm also waiting to receive data. We conclude that the baud rate of two serial devices that communicate must be pre-agreed and same for the two devices. Two devices are connected and have different baud rate can not exchange data.
To achieves the desired baud rate in UART usually has its own clock. The frequency at which they enter or the bit of the UART, ie the rate baud, determined by the KME.

3.10.5 Communication via modem
Let us now consider the case where two computers want to communicate with each other via the telephone network. This connection is particularly desirable because it gives us the option to use very large, well organized and highly developed throughout the world telephone network to exchange data with other remote computers.
From the telephone network arrives at our house a couple of lines through which we want our computer to exchange data with a remote computer. A key disadvantage of the telephone network that is designed to send the human voice, not to support communication between computers. An electric pulse as those produced by the serial port can not pass through a long wire. The reason is that the pulse is deformed and can not be identified from the other end.
For these reasons and for communication over the telephone network is essential for the modem (MOdulator / DEModulator - modulator / demodulator). The modem creates the appropriate pulses received from the computer to go through the telephone network, while giving different possibilities and starting and ending phone calls.
The computer and modem communication is usually done through the serial port. That the data and accept commands from the PC modem through the serial port.
3.10.6 Standard RS232C serial communication
 The standard serial communication that prevailed in computers is, as we mentioned, the RS-232. The RS-232 provides in some detail the serial communication between two computers via modem.
The devices in the standard RS-232, divided into two categories:
a) data terminal equipment DTE (Data Terminal Equipment), which are devices that exchange data. Usually two computers or a computer and a computer terminal.
b) the data communications equipment DCE (Data communication Equipment) which are devices that are inserted to connect two terminals and assist in their communication, such as Modem.
For the interconnection of devices using standard RS-232-C uses two types of connectors type 'D': the 25-pin and 9 pin (pins).

                 
Figure 3.4.4: The D-9 connector and D-25.
The standard provides for the use of 25 marks, but most applications do not require all these signals, so you may make use of the 9-pin connectors (pins). Female plugs of both types can be found on the back of a personal computer PC.
3.10.7 Matching signals and pin RS232-C
The signals corresponding to the terminals of two types of plugs listed in Table 3.10.2.
 D25
D9
Full Modem Signal name Direction of signal
2 3 TD Transmit Data (Transmit Data) PC  Modem
3 2 RD Receive Data (Receive Data) PC  Modem
4 7 RTS Request (Request To Send) PC  Modem
Free 5 8 CTS to send (Clear To Send) PC  Modem
6 6 DSR Data Set Ready PC  Modem
Earth 7 5 SG Signal (Signal Ground)
8 1 CD Carrier Detect (Carrier Detect) PC  Modem
20 4 DTR Data Terminal Ready PC  Modem
22 9 RI indicator bell (Ring Indicator) PC  Modem
12, 13, 14, 16 19 - Signals second inverted channel
15, 17, 21 25 - Signals modern communication
Table 3.10.2 Connector type D 9 and D 25
In the following summarizes the function of such signals.
• TD (Transmit Data): This line is used to send serial data from a computer
• RD (Receive Data): In this line, the downloads serial data into a computer
• RTS (Request to Send): Request data. This mark informs the computer, the modem that wants to send data.
• CTS (Clear to Send): Free to send data. The modem responds to the CTS line to be ready to accept data from the computer. To activate this signal is not necessary to have activated an application sending data from your personal computer line RTS. The modem can be continuously turned on this line if it can accept data.
• CD (Carrier Detect): This signal is activated when the modem detects the carrier frequency modem, on the other end of the line of communication. This signal indicates that the modem on the other side of the line has been located and can connect to it.
• DSR (Data Set Ready): Indicates the modem that the terminal is ready to send or receive data. This signal activates the modem after the boot device.
• DTR (Data Terminal Ready): terminal ready. The computer informs the modem that is ready to exchange data via the serial port. This signal is activated shortly after starting the device.
• RI (Ring Indicator): display bell. Activated when the modem detects a dial tone.
• SG (Signal ground): Signal Ground. In the case of 25-pin connector is in addition to the signal ground pin 7 and a second ground to the chassis (at pin 1). To guard against the currents of earth connection should be connected and 2 grounding them to ground the terminal or computer use.
• The terminals 12, 13, 14, 16 and 19 are the connector of 25 pins serve some modem which they use to communicate and secondary or reverse channel. This is opposite from the rectum and operates at a much lower speed. The terminals 15, 17, 21 and 25 used in the case of modern communication.
In a simple communication system the most common signals are RX, TX and handshaking signals (handshaking) DTR, DSR, CD, CTS, RTS.

3.10.8 Connecting RS-232C
If we want to connect two data terminal equipment (DTE) with RS-232-C (eg computers) and located a short distance from each other, then you can connect without having to interfere with modems. This is called null modem connection and it appears in the following figure.
  In this case we do not usually use all the above lines, but we are interested only 2 basic TD / RD and the ground (SG). The connection makes use only of such cables is shown in Figure 3.10.4.
 
Figure 3.10.5: H null modem connection


What I learned:
• The data in the case of serial communications sent or received in the form of successive bits. Each bit lasts a short time
• For each byte of data sent at least two bit: one bit at least a start and end bit.
• The bit in the serial communication sent by a negative sense.
• The number of bit that can be sent over the serial line in a second rate called baud. The baud rate is measured in baud or bps. To communicate with two devices to exchange data with the same rate baud.
• The data sent to and received TD line by line RD.
• The connector used in serial communication is the D-9 or D-25.
• To modem used to send data via the telephone network. Communicating with a computer modem is serial.
• Connecting two computers without a modem can be done with a cable null - modem.

Terminology
• Serial data transmission
• Rate baud (baud rate)
Control knowledge

1. The data in the case of serial communications transmits the form of _________ bits.
2. The bit in the serial communication sent to inverted logic. Specifically, the bit with a value corresponding to ____ -12 V while the price of ____ bit corresponds to +12 V.
3. In each byte added two extra bit. A bit equal to ___ called bit ______ (Start bit) at the beginning of the mission and one or more bit _____ (Stop bit) value at the end with ____.
4. In serial communication using two types of plugs, the ___ and ____.
5. ____ The line used to send serial data from a computer.
6. The line RD, is used to _____ of the serial data into a computer
7. When a modem detects the existence of another modem to the telephone line then the line _____ sets the serial port.
8. The computer informs the modem that will send the data through the line ____. On the other whenever the modem can receive data has enabled the line _____.

Problems:
1. The ASCII code for character 'H' is 7210 = 010 010 002. Draw the waveform at the output of a computer that TD sequentially sends the character 'H' at a rate baud 300 bps. How long will it take to send the character 'H'? Calculate this time and in the case where the shipment at the rate baud 9600 bps.
2. Connect two computers using a serial cable Null-modem. Calculate the time needed to transfer a file of 400 KB from one computer to another via the serial port, if the communication is done at a rate of 57600 bps.

Demo - Experiment: Using an oscilloscope, we can see exactly how the data are transferred serially to a PC using a terminal program like HyperTerminal program in Windows. Pressing a button then the program will see the mission of the line TD of the corresponding serial port.

Add comment


Security code
Refresh