Monday, May 10, 2010

crc learning

according to my supervisor, i have to learn crc in order to complete my project. so i trying to understand what is crc all about. Acording to googgle.com, crc is like a parity checking code that attached to the information we are about to sending. for each piece of information we are about to send, we have to calculate their crc value based on the general polynomial or devisor value. we have to xor our devisor value with the original information value.

adopted from wikipedia.com(way to calculate the crc value)

Computation of CRC

To compute an n-bit binary CRC, line the bits representing the input in a row, and position the (n+1)-bit pattern representing the CRC's divisor (called a "polynomial") underneath the left-hand end of the row. Here is the first calculation for computing a 3-bit CRC:

11010011101100 <--- input 1011           <--- divisor (4 bits) -------------- 01100011101100 <--- result 

If the input bit above the leftmost divisor bit is 0, do nothing and move the divisor to the right by one bit. If the input bit above the leftmost divisor bit is 1, the divisor is exclusive-ORed into the input (in other words, the input bit above each 1-bit in the divisor is toggled). The divisor is then shifted one bit to the right, and the process is repeated until the divisor reaches the right-hand end of the input row. Here is the last calculation:

00000000001110 <--- result of previous step           1011 <--- divisor -------------- 00000000000101 <--- remainder (3 bits) 

Since the leftmost divisor bit zeroed every input bit it touched, when this process ends the only bits in the input row that can be nonzero are the n bits at the right-hand end of the row. These n bits are the remainder of the division step, and will also be the value of the CRC function (unless the chosen CRC specification calls for some postprocessing).


after we calculate the crc value we have to added them to each byte of sending value before the transmitting process. up to this point, we can send the data and we will checking our correctness of data at the receiver side.if the crc value in the receiver and transmitter is same then the information is say to be sending successfully. otherwise we have to resend the information and check again at the receiver.

No comments:

Post a Comment