Transcript for:
Converting ASCII to Binary Explained

in this video we're going to focus on the ascii code the ascii code stands for the american standard code for information interchange so in this problem we are given a a partial ascii table this is not the whole thing and we're asked to convert the word blue to binary so let's go ahead and do that let's make a table that will make this a lot easier for us so we have the letter the decimal value and then the binary value that's going to correspond to that so the first letter is going to be b and then l and then u and then e now we need to pay attention to the capitalization capital b has a decimal value of 66. and then lowercase l has an ascii decimal value of 108 and then u has a value of 117 and then e has a value of 101 so these are the letters that you'll find in a keyboard now our next thing the next thing that we need to do is convert the decimal values into binary values now the ascii code is a seven bit binary system so two to the n minus one or two to the seven minus one that's two to the sixth which is 64. 64 is going to be the highest placement for the binary numbers so it's going to be 64 32 16 8 4 2 and then one so to get 66 we need to add up 64 and 2. so we're going to put a 1 for those values it's 1 0 0 0 0 1 0. so that is the binary equivalent of 66. so the letter b corresponds to the the seven bit binary code that we see here now let's move on to the next one so the letter l has a decimal value of 108 to get 108 we need 64. we need 32 so that's 96. now if we add 16 to 96 that's going to be 112 which is too much since we don't need a 16 we're going to put a zero now we do need an eight so we have 96 plus eight that's 104. we only need four more to get to 108. so we'll put a one on the four and a zero for the two and one so that is the 7-bit binary code for the letter l now for u which is 117 we need the 64 the 32 so that's 96. if we add 16 to 96 that'll give us 112. so we need five more to get the five we need to use a four and a one so that is the binary equivalent of 117 if you add up 64 32 okay i'm not sure what just happened there sometimes this computer acts up but if you add 64 32 16 4 and 1 that'll give you 117 now for the letter e we need to get 101 so we need to add up 64 32 that's 96 so we only need five more to get to 101 so we're going to use the 4 and the 1. so that's the binary code for the letter e in the ascii table so thus we have this the word blue has the binary codes 1 0 0 0 0 1 0 and then for l it's 1 1 zero one one zero zero and for you it's one one one zero one zero one and finally for e one one zero zero one zero one so that's how you could use the ascii table that was given to you to convert a word into binary now let's work backwards so using the ascii table shown below convert the following binary coded message into a word so feel free to pause the video and try this example problem so first let's get the decimal equivalent of each code so this is going to be 64 32 16 8 4 2 and 1. you know what let me write this better i'm gonna have to space out these values so you won't get confused so we have a 64 we have an 8 and we have a 4. so if we add those numbers 64 plus a plus four this is 76 and 76 looking at the ascii table corresponds to the letter l so that's the first one so now let's move on to the second code it's 1 1 0 0 1 0 1. so we have a 64 we have a 32 a 4 and a 1. so 64 plus 32 plus 4 plus 1 and that is 101 and 101 corresponds to the letter e so we have a lowercase e now let's move on to the next one so it's 1 1 0 1 1 0 1. so we have a 64 a 32 an 8 a 4 and a 1. 64 plus 32 plus 8 plus 4 plus 1 so that's going to add up to 109 and 109 corresponds to the letter m so you can probably figure out what word this is going to now let's move on to the next one so we got one one zero one one one one so we have everything except 16 so it's 64 plus 32 plus eight plus four plus two plus one and so that is one eleven so one eleven that's o and now for the last one one one zero one one one zero so we have everything except 16 and one so it's 64 plus 32 plus eight plus four plus two and that is 110 and 110 is n so the binary code corresponds to the word lemon so now you know how to use the ascii table you know how to in the convert between the ascii code and a binary code