INTRODUCTION TO COMPUTER LECTURE 07 TRANSFORMING DATA INTO INFORMATION Although the words data and information are often used interchangeably, there is strict sense consists, data consists of the raw numbers that computer organize to produce information. Data is meaningless until it is not converted into information after some processing. HOW COMPUTER REPRESENT DATA For computer, every thing like numbers, letters, punctuation marks, sounds, pictures and even computer’s own instruction are numbers. It is wonderful for us when we see some word or sentence on screen but actually computer is using some numeric code behind this. For example consider a word “Here” Then computer uses numeric codes for this word are H 01001000 e 01100101 r 01110010 e 01100101 In a computer, however all data must be reduced to electrical switches. A switch has only two possible states ‘ON’ and ‘OFF’ so it has only two numeric symbols 0 stands for ‘OFF’ and 1 stand for ‘ON’. Because there are only two symbols therefore computer is said to function in base 2which is also known as binary system. (bi means two in Latin) BITS AND BYTES Each switch in computer terminology whether ON or OFF, is called bit. The term bit is castration of binary digit. A bit is smallest possible unit of data to represent any meaningful information. Computer needs group of bits. After bit the next larger unit of data is the byte, which is group of 8 bits. With one byte computer can represent up to 256 different values because it is possible to count from 0 to 255 with 8 binary digits.
COMPUTER CODES Numeric data is not the only form of data that is to be handled by a computer. We often require to process alphanumeric data also. An alphanumeric data is string of symbols. Where a symbol may be one of the letters A,B,C,……., Z or one of the digits 0,1,2,3,4,….,9 or a special character such as +,-,*,/,(),=,space etc. An alphabetic data consists of the only letters A,B,C,…..,Z and the blank character. Similarly numeric data consists of only numbers 0,1,2,3,………, 9. However, any data must be represented internally by the bits 0 & 1.
1
INTRODUCTION TO COMPUTER LECTURE 07
BCD CODE The binary coded Decimal (BCD) code is one of the early memory codes. It is based on the idea of converting each digit of decimal number into its binary equaling rather than converting the entire decimal value into a pure binary form. Since 8 and 9 require 4 bits all decimal digits are represented in BCD by 4 bits. For example 4210 is equal to (101010)2 in a pure binary form. Converting 4210 into BCD, however produces the following result. 4210=0100 0010 4 2 Or 01000010 in BCD Decimal Digit BCD Equivalent 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 BCD Equivalent of Decimal Digit (1011,1100,1101,1110,1111) have decimal values from 10 to 15. These arrangements are not used in BCD coding that is 1010 does not represent 1010 in BCD instead. 1010 = 0001 0000 Or 00010000 in BCD Similarly 1510= 0001 0101 Or 00010101 in BCD
EBCDIC(EXTENDED BINARY CODE DECIMAL INTERCHANGE CODE) The major problem with BCD code is that only 64(26) different characters can be represented in it. This is not sufficient for providing decimal numbers (10) lower case letters (26) capital letters (26) and fairly large numbers of others special characters. Hence the BCD code was extended from a 6-bit code to 8-bit code. The added 2 bits are used as additional zone bits expending the zone to 4 bits. The resulting code is called the extended binary code decimal interchange code (EBCDIC). In this code it is possible to represent 256 (28) different characters instead of 64(26). 2
INTRODUCTION TO COMPUTER LECTURE 07 Because ECBDIC is an 8 bits code, it can be easily divided into two 4-bit groups. Each of these 4 bits group can be represented by 1 hexadecimal number. Character A B C D E F G H I
EBCDIC Zone 1100 1100 1100 1100 1100 1100 1100 1100 1100
Code Digit 0001 0010 0011 0100 0101 0110 0111 1000 1001
Hexadecimal Equivalent
J K L M N O P Q R
1101 1101 1101 1101 1101 1101 1101 1101 1101
0001 0010 0011 0100 0101 0110 0111 1000 1001
D1 D2 D3 D4 D5 D6 D7 D8 D9
S T U V W X Y Z
1110 1110 1110 1110 1110 1110 1110 1110
0010 0011 0100 0101 0110 0111 1000 1001
E2 E3 E4 E5 E6 E7 E8 E9
0 1 2 3 4 5 6 7 8 9
1111 1111 1111 1111 1111 1111 1111 1111 1111 1111
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9
C1 C2 C3 C4 C5 C6 C7 C8 C9
3
INTRODUCTION TO COMPUTER LECTURE 07
ASCII (AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE) Another Computer Code that is very widely used is the American Standard Code for Information Interchange (ASCII). ASCII has been adopted by several American Computer manufactures as their computers internal code. ASCII is of two types. ASCII-7 and ASCII-8. ASCII-7 is a 7 bits code that allows 128(27) different characters, The first 3 bits are used as Zone bits and the least 4 bits indicate the digit. Microcomputer using 8-bits or byte use the 7 bit ASCII by leaving the left most first bit of each byte as a zero. ASCII-8 is an extended version of ASCII-7. It is an 8 bits code that allows 256(28) different characters rather than 128. The additional bit is added to the zone bits. Other than the zone bits ASCII-7 and ASCII-8 are identical. Character 0 1 2 3 4 5 6 7 8 9
ASCII-7 Code Zone Digit 011 0000 011 0001 011 0010 011 0011 011 0100 011 0101 011 0110 011 0111 011 1000 011 1001
Hexadecimal Equivalent
A B C D E F G H I J K L M N O
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
0001 0010 0011 0100 1001 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
P Q
101 101
0000 0001
50 51
30 31 32 33 34 35 36 37 38 39
4
INTRODUCTION TO COMPUTER LECTURE 07 R S T U V W X Y Z
101 101 101 101 101 101 101 101 101
0010 0011 0100 0101 0110 0111 1000 1001 1010
52 53 54 55 56 57 58 59 5A
Table for ASCII-7 Character 0 1 2 3 4 5 6 7 8 9
ASCII-8 Code Zone Digit 0101 0000 0101 0001 0101 0010 0101 0011 0101 0100 0101 0101 0101 0110 0101 0111 0101 1000 0101 1001
Hexadecimal Equivalent
A B C D E F G H I J K L M N O
1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010 1010
0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
P Q R S
1011 1011 1011 1011
0000 0001 0010 0011
B0 B1 B2 B3
50 51 52 53 54 55 56 57 58 59
5
INTRODUCTION TO COMPUTER LECTURE 07 T U V W X Y Z
1011 1011 1011 1011 1011 1011 1011
0100 0101 0110 0111 1000 1001 1010
B4 B5 B6 B7 B8 B9 BA
Table for ASCII-8
6