13.07.2015 Aufrufe

Erweitertes Handbuch - SYMEK GmbH

Erweitertes Handbuch - SYMEK GmbH

Erweitertes Handbuch - SYMEK GmbH

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

eceived frameno crcwith crc, checksum okwith crc, wrong checksumactionprocess frameprocess frameignore framethis protocol assumes, that the kiss implementation ignores frames with unknown control byte. This is demandis specified in [1].5. CRC-generation and hints on implementationWe won't try to explain the theory of cyclic redundancy check algorithms. More about that matter is found in aarticle of Michael Röhner, DC4OX [2]. This paragraph explains only the details which are necessary for theimplementations.as check-polynom, the crc16-polynom is used. The form of this isX 16 + X 15 + X 2 + 1The crc-generator is started with a seed value of 0. The crc is calculated for all data bytes, including thecommand byte 0x80.As known, for delimiting the KISS frames the FEND-character (0xC0) is used. The case that this characterappears in the data stream is explained separately. This method is called SLIP-encoding.The crc has to be calculated before the SLIP encoding takes place and has to be checked after the SLIPdecodingis completed. There are some reasons for that:- the crc bytes might contain FESC, TFEND, FEND etc.- the SLIP en/decoder is used in some host-implementations (e.g. WAMPES) independantly from KISS toestablish e.g. the connection to the unix-kernel. For this case, crc checks would be no advantageous, butwould be not understood by the other side.The crc are a logical part of the KISS layer.The crc calculations is done in that way:- preset the crc generator with the value of 0.- put all data byte into the crc algorithm one by one, including the crc bytes.- at the end of the procedure, a 0 has to be found in the crc generator. If the value is not equal to zero, atransmission error is detected and the frame has to be discarded.Descriptions of some different crc-generator algorithms are found in [2].The crc-table may be set up by a little C-program:unsigned short Table[256];const int Rest[8] = { 0xC0C1, 0xC181, 0xC301, 0xC601, 0xCC01, 0xD801, 0xF001, 0xA001 };main(){ int i, j;unsigned short value;for (i = 0; i < 256; i++) {value = 0;for (j = 0; j < 8; j++)if (i & (1

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!