Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Representation in Computers

Similar presentations


Presentation on theme: "Data Representation in Computers"— Presentation transcript:

1 Data Representation in Computers
Student :Ahmed Alsaqqa MIS: Rasha Ragheb Atallah

2 Session Objectives Describe what a Number system is
Explain the decimal, octal and hexadecimal number systems Convert a number from one number system to another Practice binary arithmetic List the various standard codes used to represent the unit of information ASCII EBCDIC

3 Session Objectives (Contd.)
Explain Data Representation Explain Data Storage Explain Packed Decimal Binary Arithmetic Calculation Explain CPU and its speed

4 Number systems The additive approach - Number
earlier consisted of symbols e.g. Roman number system - I for 1, II for 2, III for 3 etc. Positional numbering - Symbols represent different values depending on the position they occupy e.g. the Decimal system

5 Decimal Number System In the decimal number system the successive position to the left of the decimal point represent units, tens, hundreds, thousands etc. (3 * 100) + (6*10) + (5*1) = 365 The position of the number affects its value. These kind of number systems therefore are called positional number system. Base Position number (6*10)

6 Decimal Number System (Contd.)
The value of each digit in the number system is determined by: a) The digit itself b) The position of the digit in the number c) The base/radix of the system

7 Binary Number System The binary number system has a base of two and symbols used are 0 and 1. In this number system, as we move to the left, the value of the digit will be two times greater than its predecessor because the base is two. Thus the value of the places are :   64  32  16  8  4  2  1 Binary Number Least Significant bit Most Significant bit

8 Octal number systems Binary Octal 000 0 001 1 010 2 011 3 100 4 101 5
Uses a base of 8 Values increase from right to left 1, 8, 64, Binary Octal

9 Octal Number System The octal system has the base of 8. The value increase from right to left as 1, 8, 64, 512, 4096. The decimal value of an octal number 1204 can be computed as : 1204 = (1 * 512) + (2 * 64) + (0 * 8) + (4 * 1)  =   = 644

10 Octal Number System To convert a number from binary to octal and vice versa, the following table must be kept in mind:  Binary Octal   000 0 001 1 010 2 011 3 100             4 101 5 110             6 111             7

11 Hexadecimal Number Systems
Hexadecimal Decimal A B C D E F

12 Hex. Number Systems(Contd.)
Uses a base of 16 The 16 symbols required for the hexadecimal number system obtained by using the alphabets A, B, C, D, E and F Converting hexadecimal to decimal decimal equivalent of a hexadecimal number A0119 (10 * 65,536)+(0 * 4,096)+(1 * 256)+ ( 1 * 16) + ( 9 * 1) = 6,55, = 6, 55, 641

13 Binary to Decimal Conversion
Converting binary numbers to decimal value <64 <32 <16 <8 <4 <2 <1 The decimal equivalent of is = (1 * 32 ) + (1 * 16) + (0 * 8) + ( 1 * 4) + ( 0 * 2) + (0 * 1) = = 52

14 Decimal to Binary Conversion
Divide the decimal number by the base of the required number system Note the remainder in one column and divide the quotient again with the base Keep repeating this process until quotient is reduced to a zero Reading remainders in the reverse order gives the binary equivalent

15 Decimal to Binary Conversion
E.g. Converting the decimal number 52 to its binary equivalent. Remainder 2 |__52 2 |__26 | 0 2 |__13 | 0 2 |__06 | 1 2 |__03 | 0 2 |__01 | 1 2 |__00 | 1 Thus the binary equivalent of the decimal number 52 is

16 Binary to Hexadecimal Each hexadecimal digit is represented
by 4 binary digits. Binary Hexadecimal A B C D E F

17 Binary to Hexadecimal (Contd.)
Split the quantity into groups of four outwards from right to left Each group of four is directly converted into its hexadecimal equivalent Add zeros to the left of the number if necessary E.g. Binary Hexadecimal Equivalent A C

18 Hexadecimal to Binary Write binary equivalent of each
hexadecimal digit in groups of four E.g. hexadecimal 191A412C Thus the required binary number can be written as : The leading zeroes are omitted

19 Converting from Binary to Octal
The binary number must be divided into groups of three from the octal point- to the right in case of the fractional portion and to the left in case of the integer portion. Each group can then be replaced with their octal equivalent. We may add zero to the left of the number if required. For example : Binary   52524 is the octal equivalent of the given binary number.

20 Converting from Octal to Binary
Each octal digit is replaced with the appropriate ‘triple’ of binary digits. For example :   6         5 Similarly the binary equivalent of the octal number 65 is

21 DATA (in binary Digits)
Binary Concepts 1 -- OFF -- ON DATA (in binary Digits)

22 Data Representation Main() { printf(“ Hello”);
printf(“We are enjoying a world of alphabetical coding”); }

23 Data Representation Digital computers use binary code to
represent characters. Binary code is made up of binary digits or bits. A string of "0s" and "1s" is used to Byte is a sequence of 8 bits. Most computers have words that consist of 8 or 16 bits. In large computers the number of bits per word could be 16 or 32 bits.

24 Data representation (Contd.)
When data is keyed in, each keystroke is converted to a binary character code and transmitted to the computer Each character to the printer, screen, disk is communicated in binary code. While displaying or printing, the character is converted back to human readable form

25 Data Storage Data is stored and processed in computers in
the binary form. These symbols 0 and 1, are called bits 2 bits give four unique combinations i.e. 00, 01, 10 , 11. A string of 8 bits is called a byte Words are stored one character/byte.

26 Data Storage (Contd.) During calculation the decimal number is converted to its binary equivalent. After calculation the result is converted back to its decimal equivalent.

27 The Packed Decimal Packed decimal - data is stored in
a half- way house between pure binary and one byte per digit Four bits are required to store all 10 symbols that constitute the decimal number system One byte would store the representation of two decimal digits

28 The Packed Decimal (Contd.)
e.g. The number 34 would be stored in character form as: Byte Byte 2 Using packed decimal the same number would be stored as : Byte

29 Binary Arithmetic Addition
The following rules of binary addition are to be remembered: 0 + 0 = 0 0 + 1 = 1 = 1 + 0 1 + 1 = 0 carry 1 to the next column to the left = 1 carry 1 to the next column e.g. Carry 11011 100010

30 Complementary Subtraction
Three steps to perform subtraction : Find the complement of the number you are subtracting To the complement of the number add the number we are subtracting from If there is a carry of 1 add the carry to the result of the addition else re-complement the sum and attach a negative sign

31 Complementary Subtraction (Contd.)
To find the complement of a binary number invert all the bits e.g. Number Complement

32 Complementary Subtraction (Contd.)
Example of subtraction : e.g.1 Step 1. Find the complement of It is

33 Complementary Subtraction (Contd.)
Step 2. Add the number you are subtracting from carry Since there is a carry of 1, Add the carry + _______ 1

34 Complementary Subtraction (Contd.)
e.g Step 1. Complement of is Step 2. Carry Step 3. Since there is no carry we re-complement the result and add a negative sign Thus the answer is

35 Multiplication 10101 x11001 ------- 00000 ----------- 1000001101
Rules for Multiplication: 0 x 0 = 0 0 x 1 = 0 1 x 0 = 0 1 x 1 = 1 E.g * 11001

36 Division 1. Start from the left of the dividend
2. Perform subtraction i.e. divisor should be subtracted from the dividend a) if subtraction is possible put 1 in the quotient and subtract the divisor from digits of the dividend else put 0 in the quotient b) bring down the next digit to the right of the remainder 3. Do step 2 till no more digits remain in the dividend

37 Division The complete table for binary division is: 0/1 = 0 1/1 = 1
For example: / 110 Then, 0101 (Quotient) ________ (Dividend) (Divisor) Step 1 Step 2b Step 2a Step 2b Step 2b 11 (Remainder)

38 Unit of Information Most computers use a coded version of true
binary numbers to represent letters, special symbols, decimal numbers etc. 7 digits are required to uniquely represent all 128 characters Standardised coding to enable transfer of data between computers

39 ASCII Common standard is the American Standard
Code for Information Interchange (ASCII) ASCII uses 7 bits per character possible to provide 128 different arrangements Separate Codes are used to convey - end of file, end of page etc. to the computer These codes are called non-printable control characters ASCII code is used to represent data internally in personal computers

40 EBCDIC Extended Binary Coded Decimal Interchange Code ( EBCDIC)
EBCDIC uses 8 bits per character Thus 256 characters can be represented using EBCDIC The EBCDIC code is used in IBM mainframe models and other similar machines Electronic Circuits available to transform characters from ASCII to EBCDIC and vice- versa One can achieve the same results using a computer program

41 An insight into CPU CPU also referred, as Microprocessor is actually the brain of a computer. There are lot of chips on the motherboard and they all kind of look alike. There are several companies who manufacture microprocessor chips : Advanced Micro Devices (AMD), Cyrix, Intel …

42 CPU Properties The following are some of CPUs properties:

43 What is meant by CPU speed?
Every computer contains an internal clock that regulates the rate at which each instruction is executed. The clock speed is measured in terms of MegaHertz (MHz). 1 Mhz is equal to 1 million cycles per second. Hence a computer with 120 MHz speed means 120 million cycles per second. It must be noted that a faster CPU with less hard disk space would result into a mediocre machine performance.

44 What if I increase the speed of clock?
Running a microprocessor much faster than the speed for which it has been tested and approved is also called as “Overclocking”. In many cases you can force your CPU to run faster by setting the jumper on the motherboard. But it may cause overheating. Normally, running a CPU too fast will not damage the chip but the computer would not function properly.

45 What is meant by Word Size and how is it related with speed?
Every computer has internal work areas, kind of little workbenches. These workbenches are called as registers. Registers are special high-speed storage area within the CPU. All data must be represented in the register before it can be processed. The number of the registers a CPU has and the size of each (in terms of bits) determine the speed and performance of the CPU. The largest number a computer can process in one operation is determined by size of a word.


Download ppt "Data Representation in Computers"

Similar presentations


Ads by Google