cheksum modulo 2^16
显示 更早的评论
I need to calculate the checksum of several 16bit words.
Is ther is a matlab fuction for that.
thanx
6 个评论
patrice boisset
2020-10-23
Walter Roberson
2020-10-23
There are a number of different 16 bit checksums. Search the File Exchange for crc16 for example.
patrice boisset
2020-10-23
Rik
2020-10-23
So you have 4 int16 scalars or are those actually 8 bit words? I would convert the to double to compute the sum and modulo. You can use the method they describe, but I doubt any method you create will beat the performance of the conversion to double and back.
Walter Roberson
2021-10-3
NGR MNFD comments to me:
hello Walter hello dear How can I check the checksum of the force signal binary file? This force signal is measured by a 12-bit adc. I was able to display it through the following method.
fileID1=fopen('control1.let','r');
A= fread(fileID1, [3, 45000], 'uint8')'; % matrix with 3 rows, each 8 bits long, = 2*12bit
fclose(fileID1);
M2H= bitshift(A(:,2), -4);
M1H= bitand(A(:,2), 15);
PRL=bitshift(bitand(A(:,2),8),9); % sign-bit
PRR=bitshift(bitand(A(:,2),128),5); % sign-bit
M( : , 1)= bitshift(M1H,8)+ A(:,1)-PRL;
M( : , 2)= bitshift(M2H,8)+ A(:,3)-PRR;
N1 = reshape(M',[90000,1]);
plot(N1);
Can I also check to see if it is correct or not? I do not know what code to use in MATLAB to calculate checksum? Please show me. Thank you.
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!