Candidates should be able to: Convert positive denary whole numbers (0-255) into 8-bit binary numbers and vice versa Add two 8-bit binary integers and explain overflow errors which may occur Convert positive denary whole numbers (0-255) into 2-digit hexadecimal numbers and vice versa. Convert between binary and Hex equivalents of the same number Explain the use of Hex numbers to represent binary numbers
Starter Have a go at converting denary to binary numbers on the booklet provided
Adding binary numbers together FEW RULES:
Adding Binary http://courses.cs.vt.edu/csonline/NumberSystems/Lessons/AddingTwoBinaryNumbers/index.html This clip shows you how binary numbers can be added together.
Adding binary numbers together 00011101 + 10011011
Adding binary numbers together Step 1: Start off by putting the numbers in the top 2 rows in a 4 row table. 3rd row will hold any carry overs 4th row will contain the answer
Adding binary numbers together Step 2: Add the column on the right together From the rules above we know that 1+1 = 10
Adding binary numbers together Step 2: Put a 0 on the bottom row & we carry a 1 over into column 7
Adding binary numbers together Step 3: Column 7 Add the 3 rows together 0+1+1 = 10
Adding binary numbers together Step 3: Column 7 Put 0 at bottom of column 7 Carry the 1 to row 3 of column 6
Adding binary numbers together Step 4: Column 6 1+0+1 = 10
Adding binary numbers together Step 4: Column 6 Put 0 down Carry 1 over to column 5
Adding binary numbers together Step 5: Column 5 1+1+1 = 11
Adding binary numbers together Step 5: Column 5 Put 1 down in column 5 Carry 1 over to row 3 column 4
Adding binary numbers together Step 6: Column 4 1+1+1 = 11
Adding binary numbers together Step 6: Column 4 Put 1 down in column 4 Carry 1 over into column 3
Adding binary numbers together Step 7: Column 3 0+0+1
Adding binary numbers together Step 7: Column 3 Put 1 down in column 3 row 4 Carry 0 to column 2
Adding binary numbers together Step 8: Column 2 0+0+0=0
Adding binary numbers together Step 8: Column 2 Put 0 down in column 2 row 4 Carry 0 into column 1 row 3
Adding binary numbers together Step 9: Column 1 0+1+0 = 1
Adding binary numbers together Step 9: Column 1 Put 1 down in column 1 row 4 Nothing to carry over
Adding binary numbers together RESULTS:
Overflow Errors The last binary add was straightforward. HOWEVER what would happen if the sum in column 1 had been 1+1? The carried 1 would have nowhere to go and would be lost. The problem is called overflow and causes the wrong answer.
Overflow Errors To “solve” this problem what normally happens is a flag in the CPU (processor) The software that has caused the error MUST check to see if this flag has been set - & if so it has to handle the problem.
Hexadecimal Numbers Hexadecimal is the name given to numbers using base 16 Decimal numbers 10 – 15 are represented using letter A – F 16 values so base 16
Hexadecimal Used in computing as it is a much shorter way of representing a byte of data. Binary data = 8 digits, Hexadecimal data = 2 digits E.G. 11111111 = FF Largest byte value is 255 and hexadecimal can represent up to that number
Hexadecimal
http://templehouse.me.uk/gcsecomputing/BinaryHexConversion.html