Howto CRC16

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Howto CRC16

1,136件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mclane on Fri Oct 05 12:04:54 MST 2012
I have studied the crc code examples for the 1227 but I have no clue how to use them.

I need to calculate a crc16 checksum over a string of chars.
Can anyone help me how to do it?

Where can I find more details about the parameters to be provided to the functions prototyped in crc.h?
0 件の賞賛
返信
2 返答(返信)

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Oct 05 13:17:33 MST 2012

Quote: mclane
I have studied the crc code examples for the 1227 but I have no clue how to use them.

I need to calculate a crc16 checksum over a string of chars.
Can anyone help me how to do it?

Where can I find more details about the parameters to be provided to the functions prototyped in crc.h?



UM10441 Chapter 22: LPC122x CRC engine :confused:
0 件の賞賛
返信

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ArtjomGromak on Fri Oct 05 13:07:07 MST 2012

Quote: mclane

Where can I find more details about the parameters to be provided to the functions prototyped in crc.h?


Sample:

crc.c
uint16_t Crc16( uint8_t *s)
{
unsigned short crc = 0xFFFF;
unsigned char i;

while(*s)
{
crc ^= *s++ << 8;

for( i = 0; i < 8; i++ )
crc = crc & 0x8000 ? ( crc << 1 ) ^ 0x1021 : crc << 1;
}

return crc;
}

crc.h

#ifndef CRC16_H_
#define CRC16_H_

#include <stdint.h>
uint16_t Crc16( uint8_t *s);

#endif
0 件の賞賛
返信