DATA COMMUNICATION CONCEPTS
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts
DATA COMMUNICATION CONCEPTS Communication, whether between human beings or computer systems, involves the transfer of information from a sender to receiver. Data communication refers to exchanger of digital information between two digital devices. In this chapter, we examine some of the basic concepts and terminology relating to data communication. Data representation, serial/parallel data transmission and asynchronous/synchronous data transmission concepts are discussed first. We then proceed to examine some theoretical concepts of Fourier series, Nyquist’s and Shannon’s theorems and their application in data transmission. Digital modulation techniques and baud rate are introduced next. We close the chapter with a discussion on the distinction between transmission and data communication. These terms are used interchangeably in the literature on data communication and are the cause of much confusion and frustration. DATA REPRESTENTATION A binary digit or bit has only two states, “0” and “1” and can represent only two symbols, but even the simplest form of communication between computers requires a much larger set of symbols, e.g. • 52 capital and small letters, • 10 numerals from 0 to 9, • punctuation marks and other special symbols, and • terminal control characters – Carriage Return (CR), Line Feed (LF). Therefore, a group of bits is used as a code to represent a symbol. The code is usually 5 to 8 bits long. 5-bit code can have 25 = combinations and can, therefore, represent 32 symbols. Similarly, an 8-bit code can represent 28 = 256 symbols. A code set is the set of these codes representing the symbols. There are several code sets, some are used for specific applications while others are the proprietary code sets of computer manufacturers. The following two code sets are very common: 1. ANSI’s 7-bit American Standard Code for Information Interchange (ASCII) 2. IBM’s 8-bit Extended Binary-Coded-Decimal Interchange Code (EBCDIC) EBCDIC is vendor-specific and is used primarily in large IBM computers. ASCII is the most common code set and is used worldwide.
ASCII – American Standard Code for information Interchange ASCII is defined by American National Standards Institute (ANSI) in ANSI X3.4. The corresponding CCIT recommendation is T.50 (International Alphabet No. 5 or IA5) and ISO specification is ISO 646. It is 7-bit code and all the possible 128 codes have defined meanings (Table 1). The code set consists of the following symbols: • •
96 graphic symbols (columns 2 to 7), comprising 94 printable characters, SPACE and DEL etc characters 32 control symbols (columns 0 and 1).
BRBRAITT : Nov-2006
2
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts Table 1 ASCII Code Set Bit Numbers
7 6 5
0 0 0 0
0 0 1 1
0 1 2 3 4 5 6 7 8 9 A B C D E F
NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI
DLE SPACE 0 DC1 ! 1 DC2 ” 2 DC3 # 3 DC4 $ 4 NAK % 5 SYN & 6 ETB ’ 7 CAN ( 8 EM ) 9 SUB * : ESC + ; FS , < GS = RS . > US / ?
4321 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
0 1 0 2
0 1 1 3
1 0 0 4
1 0 1 5
1 1 0 6
1 1 1 7
@ A B C D E F G H I J K L M N O
P Q R S T U V W X Y Z [ \ ] ^ –
a b c d e f g h i j k l m n o
P q r s t u v w x y z { | } ~ DEL
The binary representation of a particular character can be easily determined from its hexadecimal coordinates. For example, the coordinates of character “K” are (4,B) and, therefore, its binary code is 100 1011. The control symbols are codes reserved for special functions. Table 2 lists the control symbols. Some important functions and the corresponding control symbols are: • functions relating to basic operation of the terminal device, e.g., a printer or a VDU CR (Carriage Return) LF (Line Feed) • functions relating to error control ACK (Acknowledgement) NAK (Negative Acknowledgement) • functions relating to blocking (grouping) of data characters STX (Start of Text) ETX (End of Text). DC1, DC2, DC3 and DC4 are user definable. DCI and DC3 are generally used as XON and X-OFF for switching the transmitter.
BRBRAITT : Nov-2006
3
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts Table 2 Control Symbols ACK BEL BS CAN CR DC1 DC2 DC3 DC4 DEL DLE EM ENQ EOT ESC ETB ETX
Acknowledgement Bell Backspace Cancel Carriage Return Device Control 1 Device Control 2 Device Control 3 Device Control 4 Delete Data Line Escape End of Medium Enquiry End of Transmission Escape End of Transmission Block End of Text
FF FS GS HT LF NAK NUL RS SI SO SOH STX SUB SYN US VT
Form Feed File Separator Group Separator Horizontal Tabulation Line Feed Negative Acknowledgement Null Record Separator Shift-In Shift-Out Start of Heading Start of Text Substitute Character Synchronous Idle Unit Separator Vertical Tabulation
ASCII is often used with an eighth bit called the parity bit. This bit is utilized for detecting errors which occur during transmission. It is added in the most significant bit (MBS) positions. We will examine the use of parity bits in detail in the chapter on Error Control. EXAMPLE 1 Represent the message “3P.bat” in ASCII code. The eighth bit may be kept as “0” Solution Bit Positions 3 P . b a t
8 0 0 0 0 0 0
7 0 1 0 1 1 1
6 1 0 1 1 1 1
5 1 1 0 0 0 1
4 0 0 1 0 0 0
3 0 0 1 0 0 1
2 1 0 1 1 0 0
1 1 0 0 0 1 0
EBCDIC – Extended Binary Coded Decimal Interchange Code It is an 8-bit code with 256 possible combinations; however, all combinations are not used and have also not been defined. There is no parity bit for error checking in the basic code set. The graphic symbol subset is approximately the same as ASCII. There are several differences in the control characters. EBCDIC is not the same for all devices. There may be variations even within different models of IBM equipment.. In
BRBRAITT : Nov-2006
4
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts EBCDIC, the bit numbering starts from the most significant bit (MSB) and is ASCII, it starts from the least significant bit (LSB).
b0
b1
b2
MSB
b3
b4
b5
b6
b7 LSB
Other Code Sets The following code sets, though not of much significance to the data processing community today, were used one time or the other: Baudot Teletype Code. Also called ITA2 (International Telegraph Alphabet Number 2), it is a 5-bit code and is used in electromechanical teletype machines. 32 codes are possible using 5 bits but in this code there are 58 symbols. The same code is used for two symbols using letter shift/figure shift keys which change the meaning of a code. In telegraphy terminology, binary “1” is called Mark and binary “0” is called Space. BCDIC – Binary Coded Decimal Interchange Code. It is a six-bit code with 64 symbols. Bytes Byte is a group of bits which is considered as a single unit during processing. It is usually eight bits long though is length may be different. A character code, e.g., 1001011 of ASCII, is a byte having a defined meaning “K”, but it should be noted that there may be bytes which are not elements of any standard code set. DATA TRANSMISSION There is always need to exchange data, commends and other control information between a computer and its terminals or between two computer. This information, as we saw in the previous section, is in the form of bits. Data transmission refers to movement of the bits over some physical medium connecting two or more digital devices. There are two options of transmitting the bits, namely, Parallel transmission, or Serial transmission. Parallel Transmission In parallel transmission, all the bits of a byte are transmitted simultaneously on separate wires as show in Fig. 1 and multiple circuits interconnecting the two devices are, therefore, required. It is practical only if the two devices, e.g., a computer and its associated printer are close to each other.
BRBRAITT : Nov-2006
5
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts
0
0
1
1
2
0
3
0
4
1
5
0
6
1
7
1
0
0
1
1
0
0
0
0
1
1
0
0
1
1
1
1 Receiver
Transmitter Fig. 1 Parallel transmission. Serial Transmission
In serial transmission, bits are transmitted serially one after the other (Fig.2). The least significant
MS LSB B 11010010
11010 010
Transmit ter
Receiver Fig. 2 Serial transmission.
Bit (LSB) is usually transmitted first. Note that as compared to transmission, serial transmission requires only one circuit interconnecting the two devices. Therefore, serial transmission is suitable for transmission over long distances. EXAMPLE 2 Write the bit transmission sequence of the message given in Example 1. Solution 3 11001100
p 00001010
BRBRAITT : Nov-2006
01110100 0
b 01000110
α 10000110
t 00101110
6
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts Bits are transmitted as electrical signals over the interconnecting wires. The two binary states “1” transmission is termed unipolar and if we choose to represent a binary “1” by, say, a positive voltage + V volts and binary “0” by a negative voltage – V volts, the transmission is said to be bipolar. Figure 3 shows the bipolar waveform of the character “K”. Bipolar transmission is preferred because the signal does not have any DC component. The transmission media usually do not allow the DC signals to pass through. Bit Rate Bit rate is simply the number of bits which can be transmitted in a second. If t p is the duration of a bit, the bit rate R will be 1/tp. It must be noted that bit duration is not necessarily the pulse duration. For example, in Fig.3, the first pulse is of two-bit duration. Letter, we will come across signal formats in which the pulse duration is only half the bit duration. Receiving Data Bits The signal received at the other end of the transmitting medium is never identical to the transmitted signal as the transmission medium distorts the signal to some extent. As a result, the receiver has to put in considerable efforts to identify the bits. the receiver must know the time instant at which it should look for a bit. Therefore, the receiver must have synchronized clock pulses which mark the location of the bits. The received signal is sampled using the clock pulses, and depending on the polarity of a sample, the corresponding bit is identified (Fig. 4). 1
1
0
1
0
0
1
0
Transmitted Signal Received Signal Clock Signal Sampled Signal
1
1
0
Fig.4 Bit recovery
1
0
0
1
0
Recovered Signal
It is essential that the received signal is sampled at the right instants as otherwise it could be misinterpreted. Therefore, the clock frequency should be exactly the same as the transmission bit rate. Even a small difference will built up as timing error and eventually result in sampling at wrong instants. When the clock frequency is slightly faster or slightly slower than the bit rate, a bit may be sampled twice and may be missed.
BRBRAITT : Nov-2006
7
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts MODES OF DATA TRANSMISSION There are two methods of timing control for reception of bits. The transmission modes corresponding to these two timing methods are called Asynchronous transmission and Synchronous transmission. Asynchronous Transmission We call an action asynchronous when the agent performing the action does so whenever it wishes. Asynchronous transmission refers to the case when the sending end commences transmission of bytes at any instant of time. Only one byte is sent at a time and there is no time relation between consecutive bytes, i.e., after sending a byte, the next byte can sent after arbitrary delay (Fig. 5).In the idle state, when no byte is being transmitted, the polarity of the electrical signal corresponds to “1” Idle
Idle Stop bit
1
1
0
1
0
0
1
Start 0 bit
Idle Stop bit
1
1
0
1
0
0
1
Start 0 bit
Fig. 5 Asynchronous transmission. Due to the arbitrary delay between consecutive bytes, the time occurrences of the clock pulses at the receiving end need to be synchronized repeatedly for each byte. This is achieved by providing two extra bits, a start bit at the beginning and a stop bit at the end of a byte. Start Bit. The start bit is always “0” and is prefixed to each byte. At the onset transmission of a byte, it ensures that the electrical signal changes form idle state “1” to “0” and remains at “0” for one bit duration. The leading edge of the start bit used as a time reference for generating the clock pulses at the required sampling instants. Thus, each onset of a byte results in resynchronization of the receiver clock. Stop Bit. To ensure that the transition from “1” to “0” is always present at the beginning of a byte, it is necessary that polarity of the electrical signal should correspond to “1” before occurrence of the start bit. That is why the idle state is kept at “1”. But there may be two bytes, one immediately following the other and if the last bit of the first byte is “0”, the transition from “1” to “0” will not occur. Therefore, a stop bit is also suffixed to each byte. It is always “1” and its duration is usually 1, 1.5 or 2 bits. Synchronous Transmission A synchronous action, unlike an asynchronous action, is carried out under the control of a timing source. In synchronous transmission, bits are always synchronized to a reference clock irrespective of the bytes they belong to. There are no start or stop bits. bytes are transmitted as a block (group of bytes) in a continuous stream of bits (Fig. 6). Even the inter block idle time is filled with idle characters. Direction of Transmission F lag
Block Of bytes
Flag
Idle data
F lag
Block 2
Block Of bytes
Flag
Block 1
Fig. 6 Synchronous transmission.
BRBRAITT : Nov-2006
8
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts Continuous transmission of bits enables the receiver to extract the clock from the incoming electrical signal . As this clock is inherently synchronized to the bits, the job of the receiver becomes simpler. There is, however, still one problem. The bytes lose their identity and their boundaries need to be identified. Therefore, a unique sequence of fixed number of bits, called flag, is prefixed to each block. The flag identifies the start of a block. The receiver first detects the flag and then identifies the boundaries of different bytes using a counter. Just after the flag there is first bit of the first byte. A more common term for data block is frame. A frame contains may other fields in addition to the flag. We will discuss frame structures later in the chapter on Data Link Control. SIGNAL ENCODING For transmission of the bits as electrical signals, simple positive and negative voltage representation of the two binary states may not be sufficient. Some of the transmission requirements of digital signals are: • Sufficient signal transitions should be present in the transmitted signal for the clock extraction circuit at the receiving end to work properly. • Bandwidth of the digital signal match the bandwidth of the transmission medium. • There should not be any ambiguity in recognizing the binary states of the received signal. There are several ways of representing bits as digital electrical signals. Two broad classes of signal representation codes are: Non-Return to Zero (NRZ) codes and Return to Zero (RZ) codes. 0
0
1
0
1
1
1
0
NRZ-L Coding (Data )
Clock Signal
NRZ-M Coding NRZ-S Coding Fig. 7 NRZ signal encoding NRZ-L. In NRZ-L (Non Return to Zero-Level), the bit is represented by a voltage level which remains constant during the bit duration. NRZ-M and NRZ-S. In NRZ-M (Non Return to Zero-Mark), and NRZ-S (NonReturn to Zero-Space), it is a change in signal level which corresponds to one bit value, and absence of a change corresponds to the other bit value. “Mark” or “1” changes the signal level in NRZ-M and “Space” or “0” changes the signal level in NRZ-S. NRZ-M is also called NRZ-I, Non-Return to Zero-Invert n ones.
BRBRAITT : Nov-2006
9
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts Return to Zero (RZ) Codes We mentioned in the last section that the clock can be extracted from the digital signal if bits are continuously transmitted. However, if there is a continuous string of zeros or ones and if it is coded using one of the NRZ codes, the electrical signal will not have any level transitions. For the receiver clock extraction circuit, it will be as good as no signal. The RZ codes usually ensure signal transitions for any bit pattern and thus overcome the above limitation of NRZ codes. These codes are essentially a combination of NRRZ-L and the clock signal. Figure 8 shows some examples of RZ codes. 0
0
1
0
1
1
1
0
NRZ-L Coding (Data) Clock Signal Manchester Coding Bi-phase-M Coding Bi-phase-S Coding Differential Manchester Coding
Fig. 8 RZ signal encoding. Manchester Code. In this code, “1” is represented as logical AND of “1” and the clock. This produces one cycle of clock. For “0”, this clock cycle is inverted. Note that whatever be the bit sequence each bit period will have one transition. The receiver clock extraction circuit never faces a dearth of transitions. The Manchester code is widely employed to represent data in local area networks. It is also called Biphase-L code. Biphase-M Code. In this code also there is always a transition at the beginning of a bit interval. Binary “1” has another transition in the middle of the bit interval. Biphase-S Code. In this code also there is a transition at the beginning of a bit interval. Binary “0” has another transition in the middle of the bit interval. Differential Manchester Code. In this Code there is always a transition in the middle of a bit interval. Binary “0” has additional transition at the beginning of the interval.
BRBRAITT : Nov-2006
10
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts Other Signal Codes Local area networks based on optical fibres use another type of signal code termed 4B/FB. In this code four data bits are taken at a time and coded into 5 bits. There are 32 possible combinations of 5 bits. of these combinations, 15 codes are selected to represent 16 possible sets of 4 bits. The codes are so selected that there are at least two signal transitions in a group of 5 bits for clock recovery. Base-band Transmission When a digital signal is transmitted on the medium using one of the signal codes discussed earlier, it is called baseband transmission. Baseband transmission is limited to low data rates because at high data rates, significant frequency components are spread over a wide frequency band over which the transmission characteristics of the medium do not remain uniform. For faithful reproduction of a signal, it is necessary that the relative amplitudes and phase relationships of the frequency components are maintained during transmission. For transmitting data at high bit rates we need to use modulation techniques which we will discuss later. TRANSMISSION CHANNEL A transmission channel transports the electrical signals from the transmitter to the receiver. It is characterized by two basic parameters – bandwidth and signal-to-noise ratio. These parameters determine the ultimate information-carrying capacity of a channel. Nyquist derived the limit of data rate considering a perfectly noiseless channel. Nyquist’s theorem states that if B is the bandwidth of a transmission channel which carrier a signal having L levels (a binary digital signal has two levels), the maximum data rate R is given by R = 2B log2 L Bauds When bits are transmitted as an electrical signal having two levels, the bits rate and the “modulation” rate of the electrical signal are the same (Fig. 9). Modulation rate is the rate at which the electrical
Fig. 9 Baud rate for two-level modulation. Signal changes its levels. It is expressed in bauds (“per second” is implied). Note that there is one to one correspondence between bits and electrical levels. It is possible to associate more than one bit to one electrical level. For example, if the electrical signal has four distinct levels, two bits can be associated with one electrical level (Fig. 10). In this case, the bit rate is twice the baud rate. BRBRAITT : Nov-2006
11
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts
Fig. 10 Baud rate for four-level modulation. Modem In Fig. 17, the four levels define four states of the electrical signal. The electrical state can also be defined in terms of other attributes of an electrical signal such as amplitude, frequency or phase. The basic electrical signal is a sine wave in this case. The binary signal modulates one of these signal attributes. The sine wave carries the information and is, therefore termed “carrier”. The device which performs modulation is called a modulator and the device which recovers the information signal from the modulated carrier is called a demodulator. In data transmission, we usually come across devices which perform both modulation as well as demodulation function and these devices are called modems. Modems are required when data is to be transmitted over long distances. In a modem, the input digital signal modulates a carrier which is transmitted to the distant end. At the distant end, another modem demodulates the received carrier to get the digital signal. A pair of modems is, thus, always required. DATA COMMUNICATION Communication and transmission terms are often interchangeably used, but it is necessary to understand the distinction between the two activities. Transmission is physical movement of information and concerns issues like bit polarity, synchronization, clock, electrical characteristics of signals, modulation, demodulation etc. we have so far been examining these data transmission issues. Communication has a much wider connotation than transmission. It refers to meaningful exchange of information between the communicating entities. Therefore, in data communications we are concerned with all the issues relating to exchange of information in the form of a dialogue, e.g., dialogue discipline, interpretation of messages, and acknowledgements.
BRBRAITT : Nov-2006
12
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts Synchronous Communication Communication can be asynchronous and synchronous. In synchronous mode of the communication, the communicating entities exchange messages in a disciplined manner. An entity can send a message when it is permitted to do so. Entity A
Entity B
Hello B! Hello! Do you want to send data? Go ahead. Yes. Here it is. Any more data? No. Bye Bye. The dialogue between the entities A and B is “synchronized” in the sense that each message of the dialogue is a command or response. Physical transmission of data bytes corresponding to the characters of these messages could be in synchronous or asynchronous mode. Asynchronous Communication Asynchronous communication, on the other hand, is less disciplined. A communicating entity can send message whenever it wishes to. Entity A
Entity B
Hello B! Here is some data Did you receive what I sent?
Hello! Here is some data Here is more data Yes.
Here
is
more
data.
Please
acknowledge. Acknowledged, Bye Bye. Note the lack of discipline in the dialogue. The communicating entities send messages whenever they please, Here again, physical transmission of bytes of the messages can be in synchronous or asynchronous mode. We will come across many example of synchronous and asynchronous communication in this book when we discuss protocols. Protocols are the rules and procedures for communication.
BRBRAITT : Nov-2006
13
“DATA NETWORK” FOR JTOs PH-II – Data commn Concepts DIRECTIONAL CAPABILITES OF DATA EXCHANGE There are three possibilities of data exchange: 1. Transfer in both direction at the same time. 2. Transfer in either direction, but only in one direction at a time. 3. Transfer in one direction only. Terminology used for specifying the directional capabilities is different for data transmission and for data communication (Table4). Table 4 Terminology for Directional Capabilities Directional Capability
Transmission
Communication
One direction only One direction at a time (TWA) Both direction at the same time (TWS)
Simplex (SX) Half duplex (HDX)
One Way (OW) Two-Way Alternate
Full duplex (FDX)
Two-Way Simultaneous
SUMMARY Binary codes are used for representing the symbols for computer communications. ASCII is the most common code set used worldwide. The bits of a binary code can be transmitted in parallel or in serial form. Transmission is always serial unless the devices are near each other. Serial transmission mode can be asynchronous or synchronous. Asynchronous transmission is byte by byte transmission and start/stop bits are appended to each byte. In synchronous transmission, data is transmitted in the form of frames having flags to identify the start of a frame. Clock is required in synchronous transmission. Digital signals are coded using RZ codes to enable clock extraction at the receiving end. A communication channel is limited in its information-carrying capacity by its bandwidth and the noise present in the channel. To make best use of this limited capacity of the channel, very sophisticated carrier-modulation methods are used. modems are the devices which carry out the modulation and demodulation functions. Data communication has wider scope as compared to data transmission. Asynchronous and synchronous communication refer to non-disciplined and disciplined exchange of messages respectively.
BRBRAITT : Nov-2006
14