Header

Wednesday 4 September 2013

IGNOU BCA 4th sem Solved Assignment - How Cyclic Redundancy Check (CRC) is used in error-detection? Explain using an example, where Message bits M=1010101010 and Generator bits G=10001.

How Cyclic Redundancy Check (CRC) is used in error-detection? Explain using an example, where Message bits M=1010101010 and Generator bits G=10001.
Ans
For certain applications, verifying the integrity of the data you are sending and receiving can be very important. Because of this, the Maestro has optional 7-bit cyclic redundancy checking, which is similar to a checksum but more robust as it can detect errors that would not affect a checksum, such as an extra zero byte or bytes out of order.
Cyclic redundancy checking can be enabled by checking the “Enable CRC” checkbox in the “Serial Settings” tab of the Maestro Control Center application. In CRC mode, the Maestro expects an extra byte to be added onto the end of every command packet (except Mini SSC command packets). The most-significant bit of this byte must be cleared, and the seven least-significant bits must be the 7-bit CRC for that packet. If this CRC byte is incorrect, the Maestro will set the Serial CRC error bit in the error register and ignore the command. The Maestro does not append a CRC byte to the data it transmits in response to serial commands.
A detailed account of how cyclic redundancy checking works is beyond the scope of this document, but you can find a wealth of information using Wikipedia. The CRC computation is basically a carryless long division of a CRC “polynomial”, 0x91, into your message (expressed as a continuous stream of bits), where all you care about is the remainder. The Maestro uses CRC-7, which means it uses an 8-bit polynomial and, as a result, produces a 7-bit remainder. This remainder is the lower 7 bits of the CRC byte you tack onto the end of your command packets.
The CRC-7 algorithm is as follows:
1.      Express your 8-bit CRC-7 polynomial and message in binary, LSB first. The polynomial 0x91 is written as 10001001.
2.      Add 7 zeros to the end of your message.
3.      Write your CRC-7 polynomial underneath the message so that the LSB of your polynomial is directly below the LSB of your message.
4.      If the LSB of your CRC-7 is aligned under a 1, XOR the CRC-7 with the message to get a new message; if the LSB of your CRC-7 is aligned under a 0, do nothing.
5.      Shift your CRC-7 right one bit. If all 8 bits of your CRC-7 polynomial still line up underneath message bits, go back to step 4.
6.      What’s left of your message is now your CRC-7 result (transmit these seven bits as your CRC byte when talking to the Maestro with CRC enabled).




10101010100000
10001|||||||||
-----|||||||||
  10001|||||||
  10001|||||||
  -----|||||||
  000000100000
         10001
         -----
          1111
R = 1111
XOR approach:
10101010100000
10001|||||||||
-----|||||||||
  10001|||||||
  10001|||||||
  -----|||||||
  00000010000|
        10001|
        ------
        000010
R=0010

No comments:

Post a Comment