Main Content

Detect Barker Code Preamble in Frames

Construct two frames consisting of a 7-bit Barker code preamble and a 14-bit payload field. Detect the preamble locations by using the Preamble Detector block.

Based on detection of a Barker code preamble by the Preamble Detector block, the model displays the index location of the last bit in each preamble detected. To load the model and to configure the runtime preamble setting, callback functions are used. For more information, see Model Callbacks (Simulink).

  • When loading the model, a PostLoadFcn callback initializes the preamble value of the Preamble Detector block.

  • For runtime execution, an InitFcn callback gets the runtime setting for the preamble from the Barker Code Generator block.

The Barker Code Generator block outputs a bipolar (-1,1) signal that must be converted to unipolar (0,1) for the Preamble Detector block. When you run the model, the display shows the numbers 7 and 28 corresponding to the locations at the end of the two preambles.