Xem mẫu

  1. Networks and Telecommunications: Design and Operation, Second Edition. Martin P. Clark Copyright © 1991, 1997 John Wiley & Sons Ltd ISBNs: 0-471-97346-7 (Hardback); 0-470-84158-3 (Electronic) Data and the Binary Code System ‘Data’, a plural noun, the term used to describe information which is storedand processed by is in computers. It is essential to know how such data are represented electronically before we can begin to understand how it can be communicated between computers, communication devices or (e.g. facsimile machines) other data storage devices. As a necessary introduction to the concept of ‘digital’ transmission, this chapter is devoted to a description of tha method of representing textual and numeric information which is called the ‘binary code’. 4.1 THE BINARY CODE Binary code is a means of representing numbers. Normally, numbers are quoted in decimal (or ten-state) code. A single digit in decimal code may represent any of ten different unit values, from nought to nine, and is written as one of the figures 0, 1 ,2, 3, 4, 5, 6, 7, 8, 9. Numbers greater than nine are represented by two or more digits: twenty for example is represented by two digits, 20, the first ‘2’ indicating the number of ‘tens’, so that ‘twice ten’ must be added to ‘0’ units, making twenty in all. In a three digit decimal number, such as 235, the first digit indicates the number of ‘hundreds’ (or ‘ten tens’), the second digit the number of ‘tens’ and the third digit the number of ‘units’. The principle extends to numbers of greater value, comprising four or indeed many more digits. Consider now another means of representingnumbersusingonlya two-state or binary code system. In such a system a single digit is restricted to one of two values, either zero o r one. How then are values of two or more to be represented? The answer, as in the decimal case, is to use more digits. ‘Two’ itself is represented as the two digits, one-zero or 10. In the binary code scheme, therefore, 10 does not mean ‘ten’ but ‘two’. The rationale for this is similar to the rationale of the decimal number system with which we are all familiar. 43
  2. 44 DATA AND THE BINARY CODE SYSTEM In decimal the number one-thousand three-hundred and forty-five is written ‘1345’. The rationale is (1 X 103) + (3 X 10’) + (4 X 10) +5 The same number in binary requires many more digits, as follows. 1345(decimal) = 10101000001(binary) (binary) (decimal) = 1X 210 1024 +ox 29 + O +l X28 + 256 +o X 27 + O +l X26 + 64 + o x 25 C O + o X 24 + O +o X 23 $ 0 +O X 22 + o +ox2 + o +l + l = 1345 Any number may be represented in the binary code system, just as any number can be represented in decimal. All numbers when expressed in binary consist only of O and Is, arranged as a series s of binary digits a term which is usually shortened to the jargon bits. The string of bits of abinarynumberare usually suffixed witha ‘B’, to denote abinarynumber.This prevents any confusion that the number might be a decimal one. Thus 41 is written ‘101001B’. 4.2 ELECTRICAL REPRESENTATION AND STORAGE OF BINARY CODENUMBERS The advantage of the binary code system is the ease with which binary numbers can be represented electrically. As each digit, or bit, of a binary number may only be either 0 or 1, the entire number can easily be transmitted as a series of ‘off’ or ‘on’ (some- times also called space and mark) pulses of electricity. Thus forty one (101001B) could berepresented as on-off-on-off-off-on, or mark-space-mark-space-space-mark. The number could be conveyed between two people on opposite sides of a valley, by flashing a torch, either on or off, say every half second. Figure 4.1 illustrates this simple binary
  3. USING THE BINARY CODE TO REPRESENT TEXTUAL INFORMATION 45 ( Transmitter ) flashing torch Figure 4.1 A simple binary communication system communication system in which two binary digits (or bits) are conveyed every second. The speed at which the binary code number, or other information can be conveyed is called the information conveyance rate (or more briefly the information rate). In this example the rate is two bits per second, which can be expressed also as 2 bit/s. Figure 4.1 illustrates a means of transmitting numbers, or other binary coded data by a series of ‘on’ or ‘off electrical states. Transmission of data, however, is not in itself sufficient to permit proper exchange of information between the computers or other equipment located at either end of the line; some method of data storage is needed as well. At the sending end the data have to be stored prior to transmission, and at the receiving end a storage medium is needed not only for the incoming data, but also for the computer programmes required to interpret it. 4.3 USINGTHE BINARY CODETO REPRESENT TEXTUAL INFORMATION The letters of thealphabetcan be stored transmitted binary and over coded communication systems inthesame way as numbers, provided that they have first been binary-encoded. There are four notable binary codingsystems for alphabetic text. In chronological order these are the Morse code, the Baudot code (used in Telex, and also known as international alphabet number 2 IA2), EBCDIC (extended binary coded
  4. 46 THE DATA CODE SYSTEM AND BINARY A N 0 B C D . 0 P Q 1 2 3 E R 4 F S 5 G T 6 H U 7 I v 8 J W 9 K X L Y M 2 ? Figure 4.2 The Morse code decimal interchangecode), and ASCII (American(national) standard code for information interchange, also known international as alphabet IA5). Thesefour coding schemes are now described briefly. 4.4 MORSE CODE The Morse code system of dots and dashes was for use over key and lamp telegraph systems. It wasalso used for signalling by heliographand by flag. Itstwobinary elements are dit and da (dot and dash). Thirty-nine characters were coded, as shown in Figure 4.2. When transmitting, a short pause is inserted to mark the beginning and end of each character; and between words there is a longer pause. As an example of morsecode, we see fromthe figure thatthe word Morse is transmitted as ‘da da’ (pause) ‘da da da’ (pause) ’dit da dit’ (pause) ‘dit dit dit’ (pause) ‘dit’ (which would be written as --/---l. ./. . .l.). - 4.5 BAUDOTCODE (ALPHABET IA2) When the telex system was introduced, the Baudot Code (now called the international alphabet I A 2 ) was developed,with significant advantagesovertheMorsecodefor automatic use. Each character is represented by five binaryelements(usually called mark and space), but seven elements are transmitted in total, because start (space) and stop (mark)bits are also used. Fixing the number of elements cuts out the need for gaps or pauses between alphabetic characters, and separate words are delimited without a break by introducing the space (SP) character (00100). The regular flow of these signals suits automatic transmitting and receiving devices, and makes them easier to design. Figure 4.3 illustrates the Baudot code. Thus thesequence of seven bits sent to represent the letter A are ‘space(start)-mark-mark-space-space-space-mark(stop)’.
  5. ASCII 41 Character Pattern Character Pattern Case (figures) (letters) 5 4 3 2 7 Case (letters) (figures) 5 4 3 2 7 A 0 0 0 1 1 Q 1 1 0 1 1 1 B ? 1 1 0 0 1 R 4 0 1 0 1 0 C 0 1 1 1 0 S 0 0 1 0 1 D f 0 1 0 0 1 T 5 1 0 0 0 0 E 3 0 0 0 0 1 U 7 0 0 1 1 1 F ! 0 1 1 0 1 v 1 1 1 1 0 G 84 1 1 0 1 0 W 2 1 0 0 1 1 H 1 0 1 0 0 X l 1 1 1 0 1 I 8 0 0 1 1 0 Y 6 1 0 1 0 1 J (Bell) 0 1 0 1 1 2 1 0 0 0 1 K ( 0 1 1 1 1 Shift (figures to letters) 1 1 1 1 1 L ) 1 0 0 1 0 Shift (letters to figures) 1 1 0 1 1 M 1 1 1 0 0 Space (SP) 0 0 1 0 0 N 0 1 1 0 0 Carriage Return< 0 1 0 0 0 0 9 1 1 0 0 0 LineFeed 0 0 0 1 0 P 0 1 0 1 1 0 Blank 0 0 0 0 0 1 = Mark (Punch hole on paper tape) 0 = Space (No hole) Figure 4.3 Baudot code (International Alphabet IA2) The word Baudot would thus be transmitted in Baudot code as: A order of B U D 0 T transmit 10011 11000 11100 10010 00011 00001 In passing it is also worth mentioning that the term Baud is commonly used in data communications as the unit of rate of signal change on the line transmission medium (the so-called Baud rate). Telex networks usually operate at a rate of 50 Baud (50 signal changes per second) and they use the Baudot code. As 5 line state changes (from mark- to-space, space-to-mark, space-to-space or mark-to-mark) are required to convey each character, this produces an informationrate of 50 divided by 5, that is to say 10 alphabetic characters per second, which incidentally corresponds roughly to ordinary human speech, when we are speaking or reading deliberately. 4.6 ASCII With the advent of semi-conductors and the first computers, 1963 saw the development of a new seven-bit binary code for computer characters. This code encompassed a wider character range, including not only the alphabetic and numeric characters but also a range of new control characters which are needed to govern the flow of data in and around the computers. The code, named ASCII (pronounced ‘Askey’) is now common in computersystems. The letters stand for American (National) Standard Code for Information Interchange. It is also known as International Alphabet number 5 (IA5) and is defined by ITU-T recommendation T.50. Figure 4.4 illustrates it.
  6. DATA AND THE BINARY CODE SYSTEM of Note that thebit numbers 1-7 (top left-hand corner the table) represent the least to themostsignijicantbits, respectively. Eachletter,however, is usually writtenmost significant bit (i.e. bit number 7) first. Thus the letter C is written ‘1000011’. However, to confuse matters further, the least significant bit is transmitted first. Thus the orderof transmission for the word ‘ASCII’ is (1) (1) (C> (S) (A) order 1001001 1001001 1000011 1010011 1000001 of last Figure 4.4 The ASCII code (International Alphabet IA5)
  7. The characters, may need not be transmitted directly in the formof the 35 bits shown,but are usually separated by other control characters. In particular delimiting bits, so-called start and stop bitsmay be used to separatethe strings representing individual characters. We shall return this subject in Chapter 9 when discussing asynchronous and synchronous to transmission methods. Other control characters are also used by modern computer soft- ware to control the formatting of text (e.g. in Microsoft’s Word format). 4.7 EBCDIC EBCDIC or extended binary coded decimal interchange code is an extension of ASCII, giving more control characters. It uses an 8-bit representation for each character, as shown in Figure 4.5, and is widely used in IBM computers and compatible machines. 4.8 USE OF THE BINARY CODE TO CONVEY GRAPHICAL IMAGES Besides representing numerical and alphabetical (or textual) characters, the binary code can also be used to transmit pictorial and graphical images as well as complex computer information and formatting. Pictures are sentbinary as information by sending (typically) S-bit numbers (representing a value between 1 and 256) to represent the particular colour and shade of a miniscule dot, making up a part of the picture. Put all the coloured dots together again in the right pattern (like an impressionist painting) and the picture reappears. This is the principle by which computer images are communicated. Send a series of pictures, one after the other at a rate of 25 Hz (25 picture frames per second) and you have a television or video signal. Alternatively, if you are willing to tradesome of thedynamicquality of thepicture thus (and cost), there then is videorelephony and videoconferencing, a television-like signal sent over telephone-type connections. ITU-T recommendation H.261 lays down a standard for conversion of a video signal to binary code. To illustrate the principles of graphic image transfer using the binary code, we next take the example of facsimile. 4.9 FACSIMILE Facsimile machines work in pairs, separated by some form of transmission link. At the transmitting end of the link, one facsimile machine scans a piece of paper, and converts the black-and-white image which it sees into a binary-coded stream of data. This data is then transmitted to the receiving facsimile machine, where it is used to produce a black- and-white facsimile reproduction of the original paper image. The working principle of these machines is simple enough, as we may now see. The image on the original is assumed to be composed of a very large number of tiny dots, arranged in a grid pattern on the paper. Figure 4.6, for example, shows how one word on the paper may be broken down into a grid of dots.
  8. 50 SYSTEM CODE BINARY AND THE DATA I IX z > f c I n o r - c r - 0 0 c c
  9. FACSIMILE 51 Figure 4.6 Facsimilescanninggrid The image is reproduced by making a copy of that same grid pattern of dots at the receiving end. The procedure is as follows. Starting at the top left-hand corner, the transmitting facsimile machine scans the original paper document from left to right, following each line of the grid in turn. At the end of each line, the machine returns to the left-hand side of the grid, and moves down to the line below. Each line scanned is transposed by the machine into a string of binary coded data, comprising a series of variable length codewords. code Each word representsnumber a of consecutive squares, or ‘runs’, along the horizontal row of the grid, either an all-black run or an all-white one. White runs and black runs necessarily alternate, as these are the only two colours distinguishable by the scanning device. A small section of the grid is shown in Figure 4.6. For A4 paper, 1728 small picture elements represent one scan a horizontal rowof the of grid, some 21 5 mm in length. (In other words, there are around64 dots, termed picture elements (pixels),per square millimetre). The datasent to represent each line of the grid are thus in the form ‘two white, three black, ten white, two black, etc., etc.’, describing the colours of each consecutive picture element along the row. The end of the row is indicated in the data stream by a terminating code word. Each string of data, corres- ponding to one horizontal scan of the grid, starts with the assumption that the first colour on the left-hand sideis going to be ‘white’ by indicating the white run length. This allows the receiver always to be in the correct colour synchronization at the beginning of the line. If, as frequently, the new line starts with a black picture element, then the initial signal will be ‘white run length of zero elements’. Figure 4.7 shows a small section of two consecutive runs, as a way of explaining the coding method. Starting on line 1 of Figure 4.7, the scanning and transmitting facsimile machine sends a string of data saying ‘white-run length, one; black-run length, one; white, one; black,four; white, four;black, two; white. . .end of line’. For thesecond line, the transmitting facsimile machine carries on ‘white-run length, zero; black, two; white, one; back, six, etc., etc.). At the receiving end, the second facsimile machine slavishly prints out a corresponding series of black and white picture elements, which reproduce Figure 4.7 Facsimilescanningandcoding
  10. 52 CODE AND BINARY DATA THE SYSTEM Figure 4.8 Facsimile terminal. A group 3 facsimile terminal receiving an incoming document. Typically around 25-60 seconds is required to transmit one page, though darker documentsmay take longer (Courtesy of British Telecom) the original image. Returning to Figure4.6, we see how the image of the word ‘paper’ has been coded for transmission and subsequent reproduction with the aid of the scanning grid. Notsurprisingly, facsimile machinesactually slightly sophisticated use more techniquesthanthosedescribed,buttheprinciplesarethesame.Thepurpose of these enhancements to the basic technique to improve the accuracy and overall speed is of transmission and so reduce the time reluired for conveying each paper sheet. Any type of image can conveyed using facsimile machines: typed text, manuscript, be pictures and diagrams. The scanning and image reproducing machinery works in the same way for all of them. Since 1968, when recommendations for CCITT’s first Group I standard apparatus were published, various generations of facsimile machines have been developed. The latest Group 4 facsimile machines produce extremely high quality pictures, and can transmit a page of A4 in a few seconds, as compared with the minutes that group 1 six apparatus took over the same job. 4.10 DIGITAL TRANSMISSION Nowadays most data and much other information are communicated in one or other of the binary coded forms and the ability to sendall sorts of information simultaneously
  11. DIGITAL TRANSMISSION 53 over a single network has led to multimedia communication and computing. This is the term applied to sound, video and data signals transferred simultaneously. As binary coded data are transmitted as a sequence of ‘on’ or ‘off’ states, with each ‘on’ or ‘off’ representing the value ‘1’ or ‘0’ of consecutive binary digits or bits, all information is conveyed essentially as a string of digits, and so the process has acquired the name digitaltransmission. We goon now to assessitsconsiderableadvantagesoverthe analogue technique, and how it can be extended to speech and other analogue signals.
nguon tai.lieu . vn