Binary Logic Lets think about the Binary!
What is Binary? Computers use binary as it’s a lot simpler! Each CPU is made up of millions of transistors which can only have TWO states (ON/OFF). We will be thinking of it as either 1 or 0. Anything can be converted into a binary number so a computer can understand, process and store it.
How binary is calculated? We have FOUR shapes worth a different amount but ONLY ONE of each. How do we get 1? 1 All we need is ONE GREEN TRIANGLE!
How binary is calculated? We have FOUR shapes worth a different amount but ONLY ONE of each. How do we get 2? All we need is ONE BLUE CIRCLE! 2
How binary is calculated? We have FOUR shapes worth a different amount but ONLY ONE of each. How do we get 3? All we need is ONE GREEN TRIANGLE and ONE BLUE CIRCLE! 2 1
How binary is calculated? We have FOUR shapes worth a different amount but ONLY ONE of each. How do we get 5? All we need is ONE GREEN TRIANGLE and ONE ORANGE SQUARE! 1 4
How binary is calculated? We have FOUR shapes worth a different amount but ONLY ONE of each. How do we get 7? All we need is ONE GREEN TRIANGLE and ONE ORANGE SQUARE! 1 2 4
How binary is calculated? We have FOUR shapes worth a different amount but ONLY ONE of each. What’s the highest number we can make? =
Binary Numbers If we use a shape we mark it as ‘1’ otherwise it’s a ‘0’ TOTAL
How many 8’s can fit into 5? The answer can be 1 or 0. Click to continue… How many 8’s can fit into 5? The answer can be 1 or 0. Click to continue… 8 fits into 5 zero times… So we put a 0 in the 8 column. Click to continue… 8 fits into 5 zero times… So we put a 0 in the 8 column. Click to continue… 8421 Let’s take the number 5 and work out the binary representation… 5 0 Does 4 fit into 5? 1 or 0 times? Click to continue… Does 4 fit into 5? 1 or 0 times? Click to continue… 4 fits into 5! So we put a 1 in the 4 column. Click to continue… 4 fits into 5! So we put a 1 in the 4 column. Click to continue… 1 We then have to take the 4 we have noted away from the original number… Click to continue… We then have to take the 4 we have noted away from the original number… Click to continue… 1 This leaves 1 left over – we will now test our numbers against 1 instead. Click to continue… This leaves 1 left over – we will now test our numbers against 1 instead. Click to continue… How many 2’s fit into 1? Click to continue… How many 2’s fit into 1? Click to continue… 2 is larger than 1, so we put a zero in the 2 column. Click to continue… 2 is larger than 1, so we put a zero in the 2 column. Click to continue… 0 Does 1 fit into 1? The answer can be 1 or 0. Click to continue… Does 1 fit into 1? The answer can be 1 or 0. Click to continue… 1 1 fits into 1 exactly So, one last time, a 1 goes in the final column. Click to continue… 1 fits into 1 exactly So, one last time, a 1 goes in the final column. Click to continue… So 5 = 0101 in 4-bit binary. We can check we have the answer right by adding the columns that hold a = 5, so 0101 is correct. So 5 = 0101 in 4-bit binary. We can check we have the answer right by adding the columns that hold a = 5, so 0101 is correct.
Practice! Complete Binary Worksheet 1
What are binary numbers used for? Anything the computer needs! We have been calculating Nibbles (4 bits) but computers usually work in Bytes (8 bits) We know what the FIRST FOUR bits stand for, what do you think the NEXT FOUR stand for?
8421 What is the binary number for 129? OR
8421 What is the binary number for 71?
Practice! Complete Binary Worksheet 2
Gates We know that BITS are either 1 or 0 but there are “gates” which can change the value. Do you like to play football? 1 = Yes 0 = No NOT 5 say “Yes” & 3 say “No” Do you not like to play football? 1 = Yes 0 = No 5 say “No” & 3 say “Yes” 1 becomes 0 & 0 becomes 1
Gates
Do you like to play playstation? 1 = Yes 0 = No AND 5 say “Yes” & 3 say “No” Do you like to play playstation AND sing? 1 = Yes 0 = No 1 says “Yes” & 7 say “No” Both questions must be ‘1’ to output ‘1’ Do you like to sing? 1 = Yes 0 = No 2 say “Yes” & 6 say “No”
Gates
Do you like to play playstation? 1 = Yes 0 = No OR 5 say “Yes” & 3 say “No” Do you like to play playstation OR sing? 1 = Yes 0 = No 1 says “Yes” & 7 say “No” One or more questions must be ‘1’ to output ‘1’ Do you like to sing? 1 = Yes 0 = No 2 say “Yes” & 6 say “No”
Gates
Truth Tables We sometimes represent these gates on a Truth Table, e.g.: Copy the truth table into your notes and also create the truth tables for the NOT and OR gates
Practice! Go onto and complete the following tasks on one sheet: a)Create an A OR B circuit b)Create (A OR B) and C c)Create (Not A) AND B d)Create (Not (A AND B)) OR C Print out this one page by taking a screen shot and create the truth tables for these tasks A, B & C are light switches