Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: May 22, 2010

LabVIEW FPGA Manchester Encoding and Biphase SPDIF Decoding Reference Examples

5 ratings | 3.00 out of 5
Print

Overview

The examples provide a reference for encoding and decoding biphase modulated digital data streams in LabVIEW FPGA. One of the biphase encoding schemes shown in the commonly used Manchester encoding. A second project includes examples for acquiring nd decoding a S/PDIF digital audio data stream.

Table of Contents

  1. Biphase Generation
  2. S/PDIF Input
  3. Further Documentation

Downloads

Filename: lvfpgaspdif10.zip
Requirements: View

Filename: lvfpgabiphaseencoding_10.zip
Requirements: View

The ZIP files contains two LabVIEW projects with a number of LabVIEW FPGA examples showing the implementation of bi-phase encoders and decoders. Unzip the contents of the file to an empty directory.

Bi-phase encoding of digital communication protocols as well as these examples are described in more detail in Developing Digital Communication Interfaces with LabVIEW FPGA (Part 2).

Biphase Generation

Simple Bi-phase Generator

Example of basic digital communication bi-phase encoding. This example streams a sequence of bytes to a digital output line using the selected bi-phase encoding scheme. The bit rate for the output can be selected. This example only generates the raw data and does not prepend and header or synchronization bits which would be necessary for a receiver to accurately acquire and process the data.

Generate Manchester Signal

Basic example showing generation of a Manchester encoded data stream. The data to be sent is generated in one loop and passed to a FPGA FIFO. The subVI which generates the Manchester data stream reads the data bytes form the FIFO and passes them to the digital output. The subVI prepends a simple header to each data packet which allows a reader (see next example) to synchronize and acquire/parse the data. The header consists of a thee half bit pulse followed by a one half bit pulse. The three half bit pulse is not a valid component of regular Manchester encoding and can therefore be differentiated from the rest of the protocol. In addition it can be used by the receiver to to easily measure the bit rate of the protocol. By dividing the length of the three half bit pulse in half (3/4 of a bit), the receiver has a measure to differentiate between full and half bit pulses in the rest of the protocol.

Generate and Read Manchester Signal

An extension of the previous example which adds a Manchester receiver subVI. You must physically wire the digital output channel to your input channel to loop back the data outside the I/O connector of your FPGA R series card or C series module. The Manchester receiver subVI is expecting the data packet to be prepended by a header as explained in the previous section.

S/PDIF Input

This project includes two very similar FPGA VIs which illustrate acquiring and decoding a S/PDIF data stream using a LabVIEW FPGA Single Cycle Loop (SCL). The only difference between these two VIs is the update of the analog output channels using the decoded and extracted audio samples. This allows you to monitor the audio which is acquired by the example using a pair of headphones or speakers connected to the analog output channels of an R series device.

The timing constants placed in the FPGA code are specific to a SPDIF data stream with an audio scan rate of 48 kHz. These values and VIs will not work for SPDIF streams using a different scan rate. To customize the VIs you must adjust the timing threshold values accordingly.

The host VIs provided in the project illustrate extracting and monitoring the audio and raw S/PDIF data.

Additional host and FPGA diagnostic VIs are provided to read the digital signal and verify proper cabling and acquisition.

Hardware Configuration

This project is configured for a PXI RT target and a PXI-7831R FPGA card. The I/O channels are configured to be DIO0 on Connector 0 for the SPDIF Input signal and Analog Out 0 and 1 on Connector 0 for the audio output.

The S/PDIF signal connected to the digital input needs to be compatible with the TTL input levels of the digital lines of the R series device. For testing, the digital audio output of a Creative® Sound Blaster® Live!™ 5.1 card was used.

The configuration in the project can be changed to use other R series devices or to move the R series device to a Windows target. LabVIEW Real-Time is not required for this example to be operate properly.

Further Documentation

Bi-phase encoding of digital communication protocols as well as these examples are described in more detail in Developing Digital Communication Interfaces with LabVIEW FPGA (Part 2).

Requirements


Filename: lvfpgaspdif10.zip

Software Requirements


Application Software: LabVIEW Full Development System 8.5
Toolkits and Add-Ons: LabVIEW FPGA Module 8.5
Language(s): LabVIEW

Hardware Requirements


Hardware Group: CompactRIO, Reconfigurable I/O (RIO)
Driver: NI-RIO 2.4

 
Filename: lvfpgabiphaseencoding_10.zip

Software Requirements


Application Software: LabVIEW Full Development System 8.5.1
Toolkits and Add-Ons: LabVIEW FPGA Module 8.5.1
Language(s): LabVIEW

Hardware Requirements


Hardware Group: CompactRIO, Reconfigurable I/O (RIO)
Hardware Model: PXI-7811R, PXI-7813R, PXI-7830R, PXI-7831R, PXI-7833R, PXI-7834R, PXI-7841R, PXI-7842R, PXI-7851R, PXI-7852R, PXI-7853R, PXI-7854R, PXI-7951R, PXI-7952R, PXI-7953R, PXI-7954R
Driver: NI-RIO 2.4

 
5 ratings | 3.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).