EasyManua.ls Logo

Waveplayer systems WavePlayer8 - Appendix; CRC Calculation Example: Visual Studio.NET C; Pin Assignment DATA Port

Waveplayer systems WavePlayer8
9 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Appendix
CRC calculation example: Visual Studio .NET C#
byte crc_8(byte[] msg, int len)
{
byte crc = 0x00;
byte data;
bool flag;
byte polynom = 0xD5;
for (int i = 0; i < len; i++)
{
data = msg[i];
for (int bit = 0; bit < 8; bit++)
{
flag = (crc & 0x80) == 0x80 ? true : false;
crc <<= 1;
crc |= (data & 0x80) == 0x80 ? (byte)1 : (byte)0;
data <<= 1;
if (flag) crc ^= polynom;
}
}
return crc;
}
Pin Assignment DATA Port
View on the backside of device.
1=TxD
4=RxD
2=GND