Cyclic Redundancy Check function

10 ビュー (過去 30 日間)
JIAN-HONG YE ZHU
JIAN-HONG YE ZHU 2023 年 4 月 11 日
回答済み: Askic V 2023 年 4 月 11 日
Hello, I tried writing two functions to perform CRC, one for a sender and the other for a receiver.
The reference I used is the CRC example on Matlab website: Perform Cyclic Redundancy Check - MATLAB & Simulink - MathWorks United Kingdom
I attatched 4 files, the file called 'FullCode' has the whole code that performs the CRC for sender and receiver.
'crcSend' is the function that reads the data that has to be transmitted from a text file and generates the required CRC code.
'crcReceive' is the function that verifies whether the data transmitted is correct or not.
'message.txt' has the binary data.
I am unsure why when running crcReceive, I am getting that the remainder is not equal to zero, which means a data transmission error has ocurred, even though the code is equal to the code in 'FullCode', which when running, does give me remainder = 0 and hence no data transmission error.
Appreciate any insight on this.

採用された回答

Askic V
Askic V 2023 年 4 月 11 日
As far as I can see, crcreceive.m is missing a portion of code present in the FullCode
divisor = bitshift(divisor,messageLength-divisorDegree-1);
dec2bin(divisor)
divisor = bitshift(divisor,divisorDegree);
dec2bin(divisor)
That is why divisor variable has different values in for loop in FullCode comparing to the for loop in crcReceive.m file.
So, naturally, the results would be different.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLanguage Fundamentals についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by