Created
August 5, 2014 22:09
-
-
Save prof7bit/7fc558626f94bd8a81b7 to your computer and use it in GitHub Desktop.
crc16 in Pascal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure CRC16_Update(var CRC: Word; Data: Byte); | |
var | |
I: Integer; | |
begin | |
CRC := CRC xor (Word(Data)); | |
for I := 0 to 7 do begin | |
if (CRC and 1) <> 0 then | |
CRC := (CRC shr 1) xor $A001 | |
else | |
CRC := CRC shr 1; | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment