unsigned int CrcCheck(unsigned char *mData,unsigned short mSize)
{
    unsigned int i,j;
    unsigned char crcL=0,crcH=0; 
    unsigned char saveH=0,saveL=0;
    crcL = 0xFF;
    crcH = 0XFF;
    for(i=0;i<mSize;i++)
    {
        crcL = crcL ^ mData[i]; 
        
        for(j=0;j<8;j++)
        {
            saveH = crcH;
            saveL = crcL;
            crcH >>=1; 
            crcL >>=1; 
            if((saveH & 1) == 1) 
            {
                crcL |=0x80; 
            }
            if((saveL & 1) == 1) 
            {
                crcH ^=0XA0;
                crcL ^=1;
            }
        }
    }
    unsigned short dd = ( crcH << 8 )| crcL;
    return ( crcH << 8 )| crcL;
}

06-21 12:42