Download presentation

Presentation is loading. Please wait.

Published byCristobal Shell Modified over 3 years ago

1
Data Storage and manipulation

2
Data Storage Computers store and manipulate data in the form of electronic pulses (high and Low voltages). This digitised data is represented numerically using the binary number system (base 2) which uses only 1 and 0.

3
Converting decimal numbers to binary numbers Divide the number by 2 noting the answer and the remainder. Repeat the division of the answer by 2, again noting the answer and the remainder. When the final answer is zero, write the remainders from the final remainder to the first. This is the binary value.

4
Convert 19 from base 10 to binary

5
Converting binary numbers to decimal numbers

6
Starting from the right, each number is twice the one before it. Write the digits of the binary number in the columns of the table, starting from the right. Add up the decimal values of the columns where there is a 1 to get the decimal equivalent of your number.

7
Example

8
You can add binary numbers using four simple rules: 0+0=0 0+1=1 1+0=1 1 + 1 = 10(10 is the binary value of 2: you say ‘one zero’, not ‘ten’.) (and 1 + I + 1 = ii: you say ‘one one’, not ‘eleven’.) Example 3 Add 1101 + 1001 1101 +1001 10110

9
Binary Addition You can add binary numbers using four simple rules:

11
Representing positive and negative numbers There are three systems used to represent positive and negative numbers: Binary Coded Decimal Sign and magnitude Two’s complement.

12
Binary Coded Decimal (BCD) A four-bit code is also assigned for the + and — signs: + = 1110 — = 1111

13
Binary Coded Decimal (BCD) A four-bit code is also assigned for the + and — signs: + = 1110 — = 1111

14
Example 4 Convert —910 to BCD. Write down the four-bit binary code for the minus sign and each decimal digit. The bits are written all together.

15
Sign and Magnitude System The sign and magnitude system works as follows. 1Write a binary 1 for a minus sign or a 0 for a plus sign. This will be the leftmost bit in the answer 2Ignore the sign of the given number and convert to binary as shown in Example 1. 3Write the binary value, adding any zeros on the left if a specific number of bits is required. Remember to include the sign bit on the left as one of the required bits in the answer.

17
Example 5 Convert -14 to 8-bit sign and magnitude. The number is negative, so the sign bit is 1. 14 converted into binary = 1110 Therefore the answer for -14 in 8 bits is 10001110 in 8-bit sign magnitude 10001110 Sign Value=14

18
Two’s complement system Complements are commonly used to represent negative numbers. You can think of a number as the ‘mirror image’ of its complement written to the same base. In the binary system, the complement of 1 is 0, and vice versa.

19
Two’s complement Two’s complement is very important when you want to subtract one binary number from another. The logic circuits of the ALU can readily add two numbers, but not subtract them. Adding one binary number to the two’s complement of another binary number is equivalent to subtracting the second one from the first one.

20
Two’s complement. Therefore two’s complement not only allows the computer to store both positive and negative integers but also allows it to do both addition and subtraction operations. In this system it is most important to note the number of bits required for the answer. The two’s complement system works like this.

21
1Ignore the sign of the given value and convert the number to binary. 2Add any required zeros on the left of the binary value so that it has the required number of bits. 3If the number is positive then this is the final answer. If it is negative than continue to the next step. 4Invert the bits of the binary number by changing every ito 0 and every 0 to 1. 5Using binary addition, add 1 to this number. This gives the final answer.

22
Example 6 Represent -14 in 8-bit two’s complement. First convert 14 to binary: 14 =1110 in binary which is = 00001110 in 8 bits Inverting each bit gives=11110001 Finally add 1: =11110001 + 1 11110010 Therefore -14 is 11110010 in 8-bit two’s complement.

23
Parity This is an error checking system which makes sure that when data is sent from one computer to another no errors have crept into the code. An extra ‘parity’ bit is added to the end of each binary code. If the system used is odd parity, the extra bit is chosen to ensure there is an odd number of 1-bits in the pattern.

24
Parity Even parity adds a bit to each binary code to ensure there is an even number of 1-bits in the pattern. If one of the digits in the code is wrong when the information is received, then the parity bit will be wrong.

25
Exainple 1101111001 for even parity the parity bit shown is 1 (six 1s) 1101111000 for odd parity; the parity bit shown is 0 (five 1s)

26
Parity

27
Representing alphanumeric characters When data in the form of numbers, letters and symbols is input to a computer, for example using a keyboard, it must be represented inside the computer by binary codes. A different code is used for each symbol.

28
Code System There are two coding systems which provide each character with its own unique binary character code for use on the computer: ASCII — American Standard Code for Information Interchange EBCDIC — Extended Binary Code Decimal Interchange Code

29
ASCII Code ASCII is used on most microcomputers and represents each symbol as a 7- or 8- bit binary code. These codes are sequential for the alphabet and for numbers. That is, if’a’ is represented as 1000001 then ‘b’ is represented as 1000010, ‘c’ is represented as 1000011 and so on. Adding 1 to each pattern gives the code for the next letter. EBCDIC is a similar coding system used mainly on IBM mainframe systems.

30
Example 8 If the ASCII code for ‘d’ is 1000100, find the ASCII code for ‘i’. 1Convert the binary code to decimal. (1000100 = 64 + 4 = 68) 2Determine how far the required letter is from the letter given. (‘i’ is 5 letters after ‘d’) 3Add this number to the decimal value. (68 + 5 = 73) 4Convert this final decimal value to binary. 73 = 1001001 in binary Therefore the ASCII code for ‘i’ is 1001001.

31
Computer Data Computers represent their data as digitised electronic pulses called discrete data. That is, it can only take one of a finite set of values such as 0 or 1. This is different from continuous data, also called analog data, which can take all in- between values: examples are measurements such as height or weight. So the waist sizes of students in a class form continuous data, whereas the number of students in the class represents discrete data.

32
1Convert the following to binary: a 63 b 25 c 54 d 81 e 12 2Convert the following to decimal: a 10110111 b 10101010 c 10001111 3Add the following number: a 0101 and 001 b 0111 and 0010 c 0100 and 0011 4Name the three methods by which positive and negative numbers may be represented.

33
5Convert the following numbers to BCD: a-456 b 512 c 987 d 600 6Convert the following to 8-bit sign and magnitude:a-21b-55 a81 a32 7Represent in 8-bit two’s complement the following: A-21b-55 a81 a32 8If the ASCII code for ‘d’ is 1000100, find the ASCII code for ‘a’

Similar presentations

OK

Number Systems Spring Semester 2013Programming and Data Structure1.

Number Systems Spring Semester 2013Programming and Data Structure1.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on drugs and medicines Download ppt on biodegradable and nonbiodegradable Ppt on needle stick injury pictures Ppt on nmr spectroscopy Ppt on peak load pricing graph Ppt on e procurement Ppt on water borne diseases in india Ppt on deforestation in india Ppt on cross sectional analysis of financial statement information Ppt on general election 2014