Package: comm
Generate CRC code bits and append to input data
The CRCGenerator
object generates cyclic redundancy
code (CRC) bits for each input data frame and appends them to the
frame. The input must be a binary column vector.
To generate cyclic redundancy code bits and append them to the input data:
Define and set up your CRC generator object. See Construction.
Call step
to generate cyclic redundancy
code (CRC) bits for each input data frame according to the properties
of comm.CRCDetector
. The behavior of step
is
specific to each object in the toolbox.
Note:
Starting in R2016b, instead of using the 
H = comm.CRCGenerator
creates a cyclic
redundancy code (CRC) generator System object, H
.
This object generates CRC bits according to a specified generator
polynomial and appends them to the input data.
H = comm.CRCGenerator(
creates
a CRC generator 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.CRCGenerator(POLY,
creates
a CRC generator 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 scalar
or vector with a binary, double or singleprecision data type. 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 that the object calculates for
each input frame as a positive integer. The default is
For example, you can set an input frame size to 
reset  Reset states of CRC generator object 
step  Generate CRC code bits and append to input data 
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 Generator block reference page. The object properties correspond to the block parameters.