# how to set ctr input for nrCRCEncoder

3 views (last 30 days)
DSP Solution on 30 Mar 2023
Commented: DSP Solution on 5 Apr 2023
I tried to use nrCRCEncoder from 5G tool box, but I am not be able to set ctr input. Please help me

Jack on 30 Mar 2023
The nrCRCEncoder function in the 5G Toolbox takes two inputs: in and crcGen:
out = nrCRCEncoder(in,crcGen)
The in input is the message bits to be encoded, and crcGen is the CRC generator polynomial in octal format. The CRC generator polynomial is defined by a vector of coefficients in decreasing order of powers, with the coefficient for the highest power of the polynomial equal to 1.
The ctr input that you are referring to is actually a third input to the function, which is optional. This input is used to set the initialization value of the CRC register, also known as the CRC counter, which is used in the CRC calculation.
If the ctr input is not provided, the CRC counter is initialized to all ones, which is the default initialization value.
To set the ctr input, you can provide it as a third input to the nrCRCEncoder function as follows:
out = nrCRCEncoder(in,crcGen,ctr)
where ctr is a scalar integer value representing the initialization value of the CRC counter.
For example, to set the CRC counter to a value of 0, you can call the nrCRCEncoder function as follows:
out = nrCRCEncoder(in,crcGen,0)
I hope this helps! Let me know if you have any further questions.
DSP Solution on 5 Apr 2023