Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Teacher CP4 Binary and all that… CP4 Revision.

Similar presentations


Presentation on theme: "The Teacher CP4 Binary and all that… CP4 Revision."— Presentation transcript:

1 The Teacher CP4 Binary and all that… CP4 Revision

2 The Teacher CP4 Binary is a Base 2 Number System Only uses digits 0 and 1 Each digit is called a BIT – short for Binary digIT The Binary Number System

3 The Teacher CP4 Hexadecimal Shorthand way of writing binary numbers Base 16 number system Uses digits 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Each hex digit represents a 4-bit binary number. 6 = 0110 C = 1100

4 The Teacher CP4 Hex Exercise 1.Convert 0110101000111110 16 into hex 2.Convert B2 16 into binary

5 The Teacher CP4 Characters Each character has a unique binary code. Most commonly used system is ASCII A = 01000001 B = 01000010 C = 01000011 etc

6 The Teacher CP4 Positive Integers Calculate using the headings… 1286432168421 Example : Binary representation of 74 10 1286432168421 01001010

7 The Teacher CP4 Negative Integers Two methods : –Sign and Magnitude –Two’s Complement

8 The Teacher CP4 Sign and Magnitude First bit is a Sign bit (0 for Positive; 1 for Negative). Remaining bits are the Size of the integer. Sign6432168421 10010101 Example : -21

9 The Teacher CP4 Two’s Complement Three steps… –Treat as positive –Change all bits –Add 1 1286432168421 00010110 Example : -22 Step 1 : Step 2: 1286432168421 11101001 Step 3: +1 11101010

10 The Teacher CP4 Real Numbers Two methods – –Fixed Point –Floating Point

11 The Teacher CP4 Fixed Point The position of the binary point remains fixed. Eg.: 4 points for the Integer part and 4 bits for the fraction… S4211/21/41/81/16 0101.0100 = 5.25

12 The Teacher CP4 Floating Point Floating Point Format – Mantissa x 2 Exponent Mantissa is a Signed Fraction (Fixed Point) Exponent is a Signed Integer

13 The Teacher Convert a real to Floating Point Form Example : 9.75 Convert into fixed point binary number… Add 0 bits on the right until the correct number of bits for the mantissa : 01001.1100000 (assume 12 bit mantissa, 4 bit exponent for this) Move binary point to left until it is after the sign bit – count how many moves - because that is the exponent 0.10011100000 and the exponent is 4 Final answer : 010011100000 0100 CP4 Sign8421..5.25 01001.11

14 The Teacher CP4 Binary Exercises 1.Using 8-bit Two’s Complement system…how would these numbers be represented? 1.43 10 2.-43 10 2.Using Sign and Magnitude system, how would the above numbers be represented? 3.Convert your answers to [1] into hexadecimal.

15 The Teacher CP4 Binary Exercises [CP4 2006] (i) Convert the 12 bit binary number 101111010111 to hexadecimal. [1] (ii) Why is hexadecimal often used as an alternative to binary? [1] [CP4 2005] In a certain computer, two's complement is used to represent negative integers, using 8 bits. (i) Show how the number -7 10 is represented. [1] (ii) Showing your working, demonstrate that 13 10 is the result of the binary addition of -7 10 to +20 10. [2] (b)In another computer, a sign/magnitude approach is used to represent integers using 8 bits. Explain what is meant by the term sign/magnitude, giving a clearly labelled example [2] (c)In another computer, the character '1' is stored as 00110001. The character '2' is stored as the next higher binary code (00110010) and so on. How will the character '5' be stored? [1]


Download ppt "The Teacher CP4 Binary and all that… CP4 Revision."

Similar presentations


Ads by Google