我的英文不好,这是从英文资料中复制下来的,我现在要生成这个值,大家帮我看看呀
Checksum Byte
The last byte of each message is a checksum.This is a one-byte longitudianl redundancy check(LRC).
It is calculated sa the bit wise exclusive-OR of all the message bytes ,including the message delimiters(STX,ETX)and the address.
The bit wise exclusive-OR function can be calculate by writing the binary value of all the concerned bytes beneath each other and then performing a modulo-2 addition on each column,thus without carry propagation(see examples)

解决方案 »

  1.   

    /********************************************   
      效验码   
      函   数   名:GetLRC   
      功         能:计算效验码LRC   
      入         参:cDataForLRC—要效验的字符串;   
        cLRC—效验码;iLen—要效验的字节数   
      出         参:cLRC—效验码   
      返   回   值:无;   
      *********************************************/   
      void   GetLRC(char   *cDataForLRC,   char   *cLRC,int   iLen)   
      {   
      *cLRC=0x00;   
      for(DWORD   i=0;i<(unsigned)iLen;i++)   
      *cLRC=*cLRC^cDataForLRC[i];   
      return   ;   
      }