cheksum modulo 2^16
Afficher commentaires plus anciens
I need to calculate the checksum of several 16bit words.
Is ther is a matlab fuction for that.
thanx
6 commentaires
patrice boisset
le 23 Oct 2020
Walter Roberson
le 23 Oct 2020
There are a number of different 16 bit checksums. Search the File Exchange for crc16 for example.
patrice boisset
le 23 Oct 2020
Rik
le 23 Oct 2020
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
le 3 Oct 2021
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.
Réponse acceptée
Plus de réponses (1)
patrice boisset
le 23 Oct 2020
0 votes
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!