 and welcome to this video session on error correction using hamming codes. Myself, Mr. Vipul Kondekar from Walton Institute of Technology, Sholapur. Learning outcomes of this session will be, student will be able to differentiate between error detection and correction techniques. Then student will be able to generate hamming code for the given ASCII character and at last student will be able to identify where error is single bit error is present in the data and not only detect that error by using hamming code student will be able to correct a single bit error in the data itself. These are the contents of this presentation. So, we will go for error detection correction techniques, hamming code how hamming code can be generated then how it can be used for single bit error correction and how last at last we will see how hamming code can be used for burst error correction. When you are talking about error control this is the basic function of the data link layer. In the error control you are trying to correct single bit or burst errors. Can you think what may be the cause of these errors in the data communication single bit or burst. Now we will go for understanding how we can generate hamming code and then we will see if single bit error occurs in the hamming code then how it can correct that error. Now let us take one example where you want to generate hamming code for ASCII character K. This ASCII character K its binary equivalent is 1001011. So, we will try to generate hamming code for that ASCII character. Now hamming code first step is the bits of the code are code word are numbered consequently starting with the bit 1 at left and bit 2 to its immediate right and so on. So, when you start generating hamming code the bits that are power of 2, 2 raise to 0, 2 raise to 1, 2 raise to 2. So, if you consider these bit locations those are check bits or parity bits. So, if you have a data word to be formed for using hamming code. So, let us say these are the bit locations 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 and so on. So, powers of 2, 2 raise to 0, 1. So, this will be a check bit I call it as P1 bit, 2 raise to 1 is 2. So, this is again a check bit we call it as P2 then 2 raise to 2. So, this will be a check bit and one more check bit. So, these are the check bits the powers of 2 are the check bits and remaining are the data bits. So, data bits let us say this is D1, D2, D3, D4, D5, D6, D7. So, currently we have 7 bits for ASCII characters. So, we can consider 7 if more data bits are there that can be extended. Now, this is the format for the hamming code. Now, we want to generate hamming code word for this particular data. So, how to generate this? So, for that this is the step 2 we will go to the step 2 which is common for all code generation. So, where we will locate the data bit locations positions to be checked by particular parity bit. So, where are the data bit positions? Data bit positions are position number 3 then you have position number 5, 6 then you have position number 7, 9, 10, 11, 12 and so on. Now, how many parity bits currently we are talking about 7 bit character transmission. So, parity bits here are P1 then I call it as P2 then P4 bit is there and P8 bits. So, these are the parity bits. Now, which locations means which parity bit position will be decided by which data bit positions. So, data bit position 3 will contribute in deciding the parity position 1 and 2, 5 will be decided by 1, 4. So, these are the parity positions means when you are talking about parity position P1. So, that will consider the data bit position 3, 5, 7, 9 and 11. So, this is the step number 2 which is common for all Hamming data words. Now, let us move to the next step, step number 3. So, in step number 3 we will go for generation of the actual Hamming code. So, we want to generate Hamming code now. So, when you want to generate Hamming code again we will consider the format for the Hamming code. So, here I should have that parity bit P1, this should be P2, this should be P4, this should be P8 and then remaining are the data locations. So, data location this is D1, but instead of D1 in the character k which you want to transmit that D1 is 1. So, what I do is this will be 1, 0, 0 this will be again 1, 0, 1, 1. So, this is what will be the codeword format. So, only thing is we want to find out this P1, P2, P4 and P8 values, not how to find out this. So, whenever you are using Hamming code first you have to assume that which parity you are going to use. Here I assume that we are using even parity. So, you should make sure that the data bit for parity bit P1. So, you are considering which bit locations bit number 3, bit number 5, bit number 7, bit number 9 and bit number 11. So, these bits are forming odd parity. So, effective parity should be even. So, that is the assumption we are taking. So, assume even parity. So, what I do is P1 I take it as 1. So, when P1 is equal to 1 effectively the parity will be even parity. So, like that if I continue P8 will be 0. So, once I get this P1, P2, P4 and P8 value. So, what I can do is I can write what will be the Hamming code. So, effectively what will be the Hamming code for that ASCII character K? That Hamming code will be P1 which is 1, P2 which is 0, P3 already 1, P4 which is 1, P5 0, 0, 1, 0, 0, 1, 1. So, this is how you can generate the Hamming code word for the given ASCII character. Now, how you can use this Hamming code word for correction of the error? So, very interestingly Hamming code can detect as well as correct the errors. So, now suppose you are transmitting that data and single bit error has occurred in the transmission. So, we have seen that when you are transmitting the data, the data is 1 0 1 1 0 0 1 0 1 1, but let us say the data received is 1 0 1 1 0 0 1 0 1. So, here single bit error has occurred. So, now we will try to understand how it can correct that single bit error. So, now single bit error can be corrected by the Hamming code. So, what it does for correction of that single bit error is it considers that data received. So, what data received is? So, this is 1 0 1 1 0 0 1 0 1 1 1. So, this is the data received. Now, we will go for parity check because we know that at the transmission time we have used even parity. So, we will go for parity check. So, for p 1 parity check for first check we will consider p 1. So, that is 1, then bit number 3, 5, then 7, 9 and 11. So, let us check what is that parity? So, this is 1 1 1 2 3 4 5, 5 numbers of 1s are there. So, if 5 number of 1s are there. So, what is the result? Result is what? The parity is all. So, check result is what? Fail. Now, again you go for second parity check. So, p 2 you consider, then 3, 6, 7, 10, 11. How many 1s are there? Even number of 1s are there. So, parity check is what? It has passed that. Again for fourth check that will be p 8 p 8 and 9 10 11. So, this is 1 1 1. So, odd number of 1s you are finding here. So, parity check is again fail. Now, what you do is here I initialize one counter. So, how to identify where error has occurred? So, I initialize one counter with zero value and then whenever I get parity check fail. So, it is corresponding p k, k value for p k. So, that I consider and with that value the counter will get incremented by 1. So, that becomes 1. So, here check is pass. So, no increment in k. Here again check is pass. So, no increment. So, here check is fail. So, it is forward p k and k is what? 8. So, this will get incremented by 8. So, 1 getting incremented by 8 will be what? 9. So, this will be the conclusion that 9th bit, d 9 bit. So, this 9 bit has got error and then you can alter that particular bit. So, instead of 1 you can consider it as 0. So, that has to be the original data. So, this is how hamming code can correct the single bit error. Now, if burst errors are occurring in the data communication, very interestingly the hamming code can correct burst errors also. Now, how hamming code can correct burst error? So, hamming code can only correct single bit error. However, there is a trick that can be used to permit hamming code to detect as well as correct burst errors also. So, what you do for that is a sequence of un-configurative words are arranged as a matrix. Here we take one example, hamming is the characters you are sending. These are the corresponding ASCII values and then these are its corresponding code words. So, what you do is normally data would be transmitted one code word at a time. Normally you will transmit the data one code word at a time. But when you want to detect burst errors, what we do is at the time of burst for detecting the burst error, normally data would be transmitted one code word at a time from left to right. But to correct the burst errors, the data should be transmitted one column at a time. So, instead of transmitting the data as one row, what I do is I transmit the data as one column. So, assume that some burst error occur in the transmission, then certain bits will change. So, let us say the bits 4, 5 bits are changing. So, this has become 1, this has become 1, this has become 1 again, this has become 0. Suppose these 4 bits have changed because of burst error. But what happens is when you are transmitting the data one column at a time, one column at a time, then starting from the left most column, when all k bits have been sent, the second column is sent. So, when all these k bits are sent, second column data is sent. So, the mastic is reconstructed one column at a time and if burst error of length k occurs, if burst error of length k occurs at the most one bit at the most one bit in each of the code word have been affected. But the hamming code here you observe. So, in one column only those burst error has occurred here in one column only one bit has changed and we know that hamming code can correct single bit error. So, all these bits can be correct references used for this video presentation. Thank you.