Example Code

USRP 294X Generate from Text File

Code and Documents

Attachment

Overview

This example is built for the USRP 294x family of devices, however it will work for other USRP devices as well.  Its purpose is to read in IQ data from a text file (comma separated) and generate the given signal.  It also accounts for varying frequencies, IQ rates, and sizes of text files by scaling the data set and rotating the queue accordingly.

Description

1.  First, we open the file and split the data into two arrays, one for I data and one for Q data. 

2.  Then we take the size of the array and scale the size of the data set that needs to be sent through the queue to get the necessary throughput. 

3.  Next, the data is sent to a circular buffer that sends the “chunks” of data.  This is necessary to find the middle point between optimizing LabVIEW memory while still maintaining the throughput rate.

4.  Open the USRP 2943R and set the IQ Rate and Carrier Frequency.  Delay 5 seconds to allow the top loop to enqueue data.

5.  Take the given “Upload Chunk Size” value to send that data set to the queue and rotate the data set array by that number of samples.

6.  (Optional)  Set the gain and verify the value is sent.

7.  Take the samples that are on the queue and send them to be transmitted.  Then, clear that data from the queue.

8.  Close the references to the USRP 2943R and the queue.


Steps to Implement or Execute Code

1.  Download the “Signal Generation Demo.zip” folder. Then extract all files from the folder.

2.  Open the unzipped folder and click on “Signal Generation Demo.lvproj.”

3.  Once the Project Explorer opens, double click the “Tx Streaming (Host).vi,” which is under the Signal Generation Demo folder.

4.  Select the file path for the text file that you would like to run this example.

5.  Enter the name of your device in the “device name” control. If you are unsure of the name, you can find it by opening NI MAX and looking under the “Devices and Interfaces” tab. It most likely will be named USRP_2943R or something similar.

6.  Click the white “Run” arrow on the top left of the front panel to run the program (shown in the image below).

7.  You can set the Gain by entering a value in the “Gain” control and pushing the “Set Value” button.  You should see a presentation similar to the following image:


Picture3.png

Requirements

Software

LabVIEW 2014

Hardware

USRP 294X (demo was done wtih the USRP 2943R)

Additional Images or Video

Demo Video:

http://www.screencast.com/t/jPl2T0jka0ZM


John R.
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Dexter329
Member
Member
on

Hi johnr4

 

Could you please upload the example Sample.txt ?

I wonder if the format goes like:

1+1j, 2+2j, 3+3j, 4+4j, 5+5j, ...

and then the waveform would show the magnitude of each signal,

I fail seeing correct result, is there anything I did wrong?

 

Thanks in advance!

Dexter329
Member
Member
on

problem solved !!

it's like:

 

10,10

20,20

30,30 and so on

 

Thanks !!

Contributors