PNI TCM User Manual
Page 66
PNI Sensor Corporation
DOC#1014688 r06
TCM User Manual
– July 2013
Page 61
k Mount edXUpPl us180
/ / 9
k Mount edXUpPl us270
/ / 10
k Mount edYUpPl us90
/ / 11
k Mount edYUpPl us180
/ / 12
k Mount edYUpPl us270
/ / 13
k Mount edZDownPl us90
/ / 14
k Mount edZDownPl us180
/ / 15
k Mount edZDownPl us270
/ / 16
/ / Res ul t I Ds
k Er r None = 0,
/ / 0
k Er r Save,
/ / 1
} ;
/ / f unct i on t o c al cul at e CRC- 16
UI nt 16 CRC( v oi d * dat a, UI nt 32 l en)
{
UI nt 8 * dat aPt r = ( UI nt 8 * ) dat a;
UI nt 32 i ndex = 0;
/ / Updat e t he CRC f or t r ans mi t t ed and r ecei v ed dat a us i ng
/ / t he CCI TT 16bi t al gor i t hm ( X^ 16 + X^ 12 + X^ 5 + 1) .
UI nt 16 c r c = 0;
whi l e( l en- - )
{
c r c = ( uns i gned char ) ( c r c >> 8) | ( cr c << 8) ;
c r c ^ = dat aPt r [ i ndex ++] ;
c r c ^ = ( unsi gned c har ) ( cr c & 0x f f ) >> 4;
c r c ^ = ( cr c << 8) << 4;
c r c ^ = ( ( c r c & 0xf f ) << 4) << 1;
}
r et ur n c r c ;
}