Continuously Reading and Writing LabVIEW Data to RIDE DSP Code
RIDE Basics
RIDE’s graphical design methodology is used to quickly and efficiently program real-time algorithms for use on DSP hardware. Traditionally programmers have relied on hand-crafting C and assembly code for a specific application, and used C-compilers and assemblers to target a DSP device. By reducing the level of DSP programming expertise required to code an algorithm on a DSP, many more design engineers can develop a DSP-based algorithm for their specific application. RIDE removes the requirement for traditional text-based programming, and can be used to achieve direct DSP object code generation for today's DSP devices. Features such as code profiling, interrupt processing, conditional operations, and other programming constructs normally associated with the DSP development process are easily achieved with RIDE.
Example Overview
In the RIDE sample code (Figure 3), a sine tone is generated within the DSP and sent to an output D/A convertor, which are connected to a set of speakers. To control the DSP tone frequency, RIDE includes a real-time PC-to-DSP channel control. This channel control receives data from LabVIEW.
In addition to receiving a control frequency from LabVIEW, the RIDE DSP code sends real-time array data back to LabVIEW. This is performed by first uploading the data from the DSP to the PC, then sending through inter-application communication.
In the LabVIEW sample code (Figure 1), the frequency number selected is generated by sending TCP data to RIDE using the SendDataToLabVIEW.vi. LabVIEW also displays the real-time tone generated within the DSP chip. This is performed by RIDE sending real-time data that is uploaded from the DSP over to LabVIEW. To display the real-time values in LabVIEW, RIDE sends a continuous array of data, with LabVIEW reading the data using the ReceiveDataFromRIDE.vi.
LabVIEW Sample Code
The following front panel shows basic bidirectional communication method between RIDE and LabVIEW software. The three LabVIEW controls define the ports data will communicate across. The address of the PC connection is localhost. Finally, the control knob and digital indicator display the control frequency that RIDE will send to the DSP. Finally, the bottom graph panel displays real-time data being sent from the DSP to the speakers.

Figure 1 LabVIEW Front Panel Example to Demonstrate LabVIW to RIDE Communication
The block diagram below (Figure 2) is divided into two main components. In the top loop, control frequency data is sent over to RIDE, which then communicates in real-time to the DSP hardware. In this loop, data is sent only if the control value changes. In the bottom loop, LabVIEW continuously polls for new data.

[+] Enlarge Image
Figure 2 LabVIEW Block Diagram Example to Send and Receive Data from RIDE
RIDE Sample Code
The sample RIDE DSP code below (Figure 3) includes two blocks to receive and send data over to LabVIEW. The three main blocks are the tone generation block, output block and the upload DSP code block.
By double clicking on the RT Sine Generation block, you define the frame size of data that is sent to LabVIEW with each DSP-to-PC upload (Figure 4).

Figure 3 Ride Sample Code to Demonstrating LabVIEW to RIDE Communication

Figure 4 The Framesize defines data size to send LabVIEW with each transfer
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial 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 content with each new revision of related products and drivers. THIS TUTORIAL 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/).
