
Another example of analog vs. digital systems can be found in sound recordings. Vinyl records store sounds in analog fashion. The level of the signal encodes the pitch and intensity of the sounds. Compact disks store sounds in digital fashion. The bits are read and converted into a signal to produce the sounds. CDs sound very crisp when you listen to them. Some sound information can be lost in digital recordings, however.
Today's computer systems are digital systems. They store information in discrete bits as we have seen. Each bit is either on or off. The levels of the signals do not vary in between on and off.
Having established that today's computers use digital techniques, we turn next to what sort of codes are used to capture information. One might envision an analog keyboard, in which different voltages were assigned to each key, and the information stored in analog form. This method might work, but it would certainly lead to errors over time, and it would be dependent on a good deal of tuning to store the large number of different characters used by computers today.
For this reason (among others) we use digital coding techniques to store characters input from a keyboard. This decision forces us to make another decision: how many bits will we use to represent the characters? If we assume that we need at least 52 characters for the English alphabet, 10 for digits, about 30 or so for other symbols, and at least 10-15 for "control characters" such as the enter key, backspace, delete, etc, then we have a minimum of about 100 characters that we should be able to represent. How many bits does that translate into? To answer this question, we have to go back to a consideration of place value notation.
Decimal numbers use place value notation. We take it for granted, but what we are really saying when we write the number 9756 is:
6 x 10 to the zero power (1) = 6; plus
5 x 10 to the power 1 (10) = 50; plus
7 x 10 to the power 2 (100) = 700; plus
9 x 10 to the power 3 (1000) = 9000.
The concept of place value, then is that, starting with a base number we assign a value of that number raised to the powers 0, 1, 2, 3, ... from right to left, and the final number is the sum of each of those digits with their place value significance.
We could use other base numbers than 10. If we used 2, the number 1010 means
0 x 2 to the power 0 (1) = 0; plus
1 x 2 to the power 1 (2) = 2; plus
0 x 2 to the power 2 (4) = 0; plus
1 x 2 to the power 3 (8) = 8.
Therefore 1010 (base 2) is equivalent to 10 (base 10). Notice that, in base 2, we only have two different numbers available (0 and 1), whereas in base 10 we have 10 different numbers available (0 - 9, but not 10).
It is also possible to use other base numbers. One of the important ones used in computers is base 16. To represent 16 different numbers, we cannot use only decimal values (0-9), since we need more different characters. Instead, we will use 0, 1, ... 9, A, B, B, D, E, and F, giving us 16 different symbols. Using these "numbers" the number 24E means
"E" x 16 to the power 0 (1) = 14; plus
4 x 16 to the power 1 (16) = 64; plus
2 x 16 to the power 2 (256) = 512.
In decimal notation, this number would be represented as 590.
Returning to the question that started us thinking about place value: if we need to represent at least 100 characters, and we are going to use binary (base 2) numbers, we have to have at least 7 bits. The number 1111111 (base 2) means
1 x 2 to 0 (1) = 1; (sum so far = 1) plus
1 x 2 to 1 (2) = 2; (sum so far = 3) plus
1 x 2 to 2 (4) = 4; (sum so far = 7) plus
1 x 2 to 3 (8) = 8; (sum so far = 15) plus
1 x 2 to 4 (16) = 16 (sum so far = 31) plus
1 x 2 to 5 (32) = 32 (sum so far = 63) plus
1 x 2 to 6 (64) = 64 (sum so far = 127).
Since we need at least 7 bits to represent this minimal set of characters, computer designers decided to use 8 bits (even numbers work better) in defining a byte. They also agreed on a standard code and even got it approved by the American National Standards Institute (ANSI). This code was given the name American Standard Code for Information Interchange, or ASCII, which is the most widely used character set in computers today. (There are many others, but you do not need to know much about them for now.) ASCII is a 7-bit code, but it is always represented using a complete 8-bit byte. (The 8th bit was used for parity checking in the same way that the 9th track on magnetic tapes is used for parity checking; this practice is no longer considered as important as it once was, and many communication protocols do not use parity checks any more.) The complete set of ASCII codes in decimal, octal, and hexadecimal is shown below (and is in your lab manual). For now, however, let's see how the first 32 numbers of this series are represented in decimal, binary and hexadecimal notation:
decimal binary hexadecimal
0 0 0
1 1 1
2 10 2
3 11 3
4 100 4
5 101 5
6 110 6
7 111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
16 10000 10
17 10001 11
18 10010 12
...
31 11111 1F
32 100000 20
...
126 1111110 7E
127 1111111 7F
Hexadecimal notation is valuable as a means for representing ASCII characters, since they can be described with only two digits (base 16). You may never have to use this notation, but if you see it, at least you will understand where it comes from.
The ASCII code includes 32 control characters, 52 alphabetic characters, 10 numeric codes, and 33 other symbols including a space. Since these characters only use 7 bits, there are another 128 numbers available in a byte that are not defined in ASCII. These numbers all have a "1" in the first bit of the byte. Personal computers use these characters for an additional set of graphic symbols, and sometimes we see these characters when we inadvertently try to print a file that contains non-ASCII characters. You are likely to see smiling faces, hearts, spades and clubs, and a number of other symbols. When you do, you know that you have tried to display non-ASCII, and that usually means there is something wrong somewhere.
A video on coding systems by Prof. Walters is available in 1101 Hart Hall that may be of interest to you. It is titled Coding Systems for Characters and it can be found under the ECS015 Videos (video lecture #4).
Go to the index of
lectures for ECS15 - Fall 1997 .
Go to the homepage for ECS15 - Fall 1997 .
