Analytica GmbH AnaGate CAN duo Manuel d'utilisateur Page 81

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 83
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 80
FAQ - Frequent asked questions
74 © 2007-2010 Analytica GmbH
unsigned char CalcCRC( char * pBuffer, int nBufferLength )
{
int i;
unsigned char nCRC = pBuffer[2]; // skip the length bytes
// XOR over all bytes in the message except the length information and the last byte
for( i = 3; i < nBufferLength -1; i++ )
{
nCRC ^= pBuffer[i];
}
return nCRC;
}
When using the function CalcCRC the parameter pBuffer must point to the data buffer, which
contains the already created complete data telegram. The length parameter nBufferLength
depends on the created command type and can be computed as shown below:
buffer length = sizeof( command length ) + sizeof( command code )
+ sizeof( command id ) + sizeof( CRC ) + sizeof(data)
= 7 + sizeof(data)
Vue de la page 80
1 2 ... 76 77 78 79 80 81 82 83

Commentaires sur ces manuels

Pas de commentaire