# S12XD - Can any one help me in calculating this 11 bit CRC using the following algorithm

Discussion created by ganguly saurav on Sep 18, 2007
Latest reply on Oct 18, 2007 by Vivek Rajan
Hai all,
Can any one help me in calculating this 11 bit CRC using the following algorithm i think its little bit tricky.Can any one please tell me how to calculate the CRC by using this please tell me.I am giving the algorithm and all the data can any one reply.

The following pseudo code summarizes the CRC calculation algorithm:

vCrcReg(vCrcSize - 1 : 0) = vCrcInit; // Initialize the CRC register

while(vNextBit)

// determine if the CRC polynomial has to be applied by taking

// the exclusive OR of the most significant bit of the CRC register

// and the next bit to be fed into the register

vCrcNext = vNextBit EXOR vCrcReg(vCrcSize - 1);

// Shift the CRC register left by one bit

vCrcReg (vCrcSize - 1 : 1) = vCrcReg(vCrcSize - 2 : 0);

vCrcReg(0) = 0;

// Apply the CRC polynomial if necessary

if vCrcNext

vCrcReg(vCrcSize - 1 : 0) = vCrcReg(vCrcSize - 1 : 0) EXOR vCrcPolynomial;

end; // end if

end; // end while loop

parameters to be used in above algorithm

vCrcSize = cHCrcSize; // (= 11) size of the register is 11 bits

vCrcInit = cHCrcInit; // (= 0x1A) initialization vector of header

// CRC

vCrcPolynomial = cHCrcPolynomial; // (= 0x385) hexadecimal representation of

// the header CRC polynomial

Vnext bit is 00000000000100111111

Can any one please help me in calculating this and how to claculate it.

Thanking you,

Bye,

saurav99.

--
Alban Edit: Please always include FSL Part Number in Message Subject line.

Message Edited by Alban on 2007-09-18 06:17 PM