Data and the Binary Code System ‘Data’, a plural noun, is the term used to describe information which is stored in and processed by computers.. Figure 4.1 illustrates a means of transmi
Trang 1Data and the Binary Code System
‘Data’, a plural noun, is the term used to describe information which is stored in and processed by 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 (e.g facsimile machines) or 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’
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 representing numbers using only a 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
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)
Trang 244 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)
= 1 X 210 + o x 29 + l X 2 8 + o X 27 + l X 2 6 + o x 25
+ o X 24
+ o X 23 + O X 22 + o x 2 + l
(decimal)
1024
+ 256
+ 64
= 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 Os and Is, arranged as a series
of binary digits a term which is usually shortened to the jargon bits The string of bits of
a binary number are usually suffixed with a ‘B’, to denote a binary number 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 CODE NUMBERS
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
be represented 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
Trang 3USING THE BINARY CODE TO REPRESENT TEXTUAL INFORMATION 45
( T r a n s m i t t e r )
f l a s h i n g t o r c h
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
TEXTUAL INFORMATION
The letters of the alphabet can be stored and transmitted over binary coded
communication systems in the same way as numbers, provided that they have first
been binary-encoded There are four notable binary coding systems 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
Trang 446 DATA AND THE BINARY CODE SYSTEM
A
B
C
D
E
F
G
H
I
J
K
L
M
N
0
Q
R
S
T
U
v
W
X
Y
2
0
1
2
3
4
5
6
7
8
9
?
Figure 4.2 The Morse code
decimal interchange code), and ASCII (American (national) standard code f o r information interchange, also known as international alphabet IA5) These four
coding schemes are now described briefly
The Morse code system of dots and dashes was for use over key and lamp telegraph systems It was also used for signalling by heliograph and by flag Its two binary
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 morse code, we see from the figure that the 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.)
When the telex system was introduced, the Baudot Code (now called the international
alphabet I A 2 ) was developed, with significant advantages over the Morse code for
automatic use Each character is represented by five binary elements (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 the sequence of seven bits sent to represent the letter A are ‘space(start)-mark-mark-space-space-space-mark(stop)’
Trang 5ASCII 41
Case (letters) (figures) 5 4 3 2 7 Case (letters) (figures) 5 4 3 2 7
A
B
C
D
E
F
G
H
I
J
K
L
M
N
0
P
0 0 0 1 1
? 1 1 0 0 1
0 1 1 1 0
f 0 1 0 0 1
3 0 0 0 0 1
! 0 1 1 0 1
84 1 1 0 1 0
1 0 1 0 0
8 0 0 1 1 0
(Bell) 0 1 0 1 1
( 0 1 1 1 1
) 1 0 0 1 0
1 1 1 0 0
0 1 1 0 0
9 1 1 0 0 0
0 1 0 1 1 0
S
v
2
Shift (figures to letters) Shift (letters to figures) Space (SP)
Carriage Return<
Line Feed Blank
1 0 1 1 1
0 1 0 1 0
0 0 1 0 1
1 0 0 0 0
0 0 1 1 1
1 1 1 1 0
1 0 0 1 1
1 1 1 0 1
1 0 1 0 1
1 0 0 0 1
1 1 1 1 1
1 1 0 1 1
0 0 1 0 0
0 1 0 0 0
0 0 0 1 0
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:
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 information rate 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
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 computer systems 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
Trang 6DATA AND THE BINARY CODE SYSTEM
Note that the bit numbers 1-7 (top left-hand corner of the table) represent the least to
the most signijicant bits, respectively Each letter, however, is usually written most significant bit (i.e bit number 7) first Thus the letter C is written ‘100001 1’ However,
to confuse matters further, the least significant bit is transmitted first Thus the order of transmission for the word ‘ASCII’ is
1001001 1001001 1000011 1010011 1000001 of
last first transmit
Figure 4.4 The ASCII code (International Alphabet IA5)
Trang 7The characters, may need not be transmitted directly in the form of the 35 bits shown, but are usually separated by other control characters In particular delimiting bits, so-called
start and stop bits may be used to separate the strings representing individual characters
We shall return to this subject in Chapter 9 when discussing asynchronous and synchronous
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 sent as binary 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 trade some of the dynamic quality of the picture (and thus cost), then there 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
Trang 850 DATA AND THE BINARY CODE SYSTEM
I
z
>
f
c
In
o r -
c r
-0 0
Trang 9FACSIMILE 51
Figure 4.6 Facsimile scanning grid
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 code words Each code word represents a number 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 of a horizontal row of the grid, some 21 5 mm in length (In other words, there are around 64 dots, termed picture
elements (pixels), per square millimetre) The data sent 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 side is 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 the second 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 Facsimile scanning and coding
Trang 1052 DATA AND THE BINARY CODE 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 documents may
take longer (Courtesy of British Telecom)
the original image Returning to Figure 4.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
Not surprisingly, facsimile machines actually use slightly more sophisticated
techniques than those described, but the principles are the same The purpose of these enhancements to the basic technique is to improve the accuracy and overall speed
of transmission and so reduce the time reluired for conveying each paper sheet
Any type of image can be conveyed using facsimile machines: typed text, manuscript, 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 six minutes that group 1
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 send all sorts of information simultaneously