Detect errors in input data using CRC
The CRCDetector
object computes checksums for
its entire input frame.
To detect errors in the input data using cyclic redundancy code:
Define and set up your CRC detector object. See Construction.
Call step
to detect errors according
to the properties of comm.CRCDetector
. The behavior
of step
is specific to each object in the toolbox.
Starting in R2016b, instead of using the step
method
to perform the operation defined by the System
object™, you can
call the object with arguments, as if it were a function. For example, y
= step(obj,x)
and y = obj(x)
perform
equivalent operations.
H = comm.CRCDetector
creates a cyclic redundancy
code (CRC) detector System
object, H
. This
object detects errors in the input data according to a specified generator
polynomial.
H = comm.CRCDetector(
creates
a CRC detector object, Name
,Value
)H
, with each specified property
set to the specified value. You can specify additional namevalue
pair arguments in any order as (Name1
,Value1
,...,NameN
,ValueN
).
H = comm.CRCDetector(POLY,
creates
a CRC detector object, Name
,Value
)H
. This object has the Polynomial
property
set to POLY
, and the other specified properties
set to the specified values.

Generator polynomial Specify the generator polynomial as a binary or integer row
vector, with coefficients in descending order of powers, or as a polynomial
character vector. The default is
 

Initial conditions of shift register Specify the initial conditions of the shift register as a binary, double or single precision
data type scalar or vector. The default is  

Direct method (logical) When you set this property to Refer to the Communications System Toolbox > System Design > Error Detection and Correction > Cyclic Redundancy Check Coding > CRC Algorithm section to learn more about the direct and nondirect algorithms.  

Reflect input bytes Set this property to true to flip the input data on a bytewise basis prior to entering the
data into the shift register. When you set this property to  

Reflect checksums before final XOR When you set this property to  

Final XOR value Specify the value with which the CRC checksum is to be XORed as a binary scalar or vector. The
object applies the XOR operation just prior to appending the input data. The vector length is
the degree of the generator polynomial that you specify in the  

Number of checksums per input frame Specify the number of checksums available at each input frame.
The default is For example, you can set the input codeword size to
The vector values depend on whether the computed checksums are zero. A

reset  Reset states of CRC detector object 
step  Detect errors in input data using CRC 
Common to All System Objects  

clone  Create System object with same property values 
getNumInputs  Expected number of inputs to a System object 
getNumOutputs  Expected number of outputs of a System object 
isLocked  Check locked states of a System object (logical) 
release  Allow System object property value changes 
This object implements the algorithm, inputs, and outputs described on the CRCN Syndrome Detector block reference page. The object properties correspond to the block parameters.