crc16 checksum in matlab
40 views (last 30 days)
Im trying to implement a function that check the checksum of my input, and return if it's false or true (valid or not valid).
crc is crc16 that I input to my function an array that every value is an unsigned decimal value (Byte value, unsigned integer) like arr1=[1, 2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 10] , and my crc is the last two bytes , so I want to verify if my crc is valid by check the checksum of my arr1(implcitly its data of my packet), the other bytes (values) in my array arr1 is the payload data so here in my example the paylaod is [1 ,2 ,3 ,4 ,5 ,6 , 7,8] and the crc is the two last bytes(values) [9,10] .
how can I in matlab calculate the checksum of my given packet (in other words arr1) if the data is valid or not valid by checking the checksum? the checksum if zero this means ok, otherwise it's not valid.