public function Calculate_CRC8(byval crc as uint16,byval n as uint16) as uint16
dim i as uint16
crc=crc xor n
for i=0 to 7
if crc and 1 then
crc=(crc>>1) xor &H8c
else
crc=crc>>1
end if
next
return crc
end function