RX to file
From Tools4SDR
Tutorial: Using the USRP with Windows applications
|
| 1. Description of SDR4All toolbox |
| 2. Setup the toolbox |
| 3. Sent and received signals |
| 4. Hello world tutorial |
| 5. RX application |
| 6. TX application |
The application TX bursts has been developed with Microsoft Visual C# 2008 - Express edition, which is a free software distributed by Microsoft.
The source code is available for downloading here.
If you can't compile it, try to remove the SDR4All_DLL reference, and to add it again (as described in the Hello World ! tutorial).
Contents |
What does this application ?
This application receives a signal from the USRP and write it into a file. It looks like:
Its purpose is for testing transmission scheme with a already tested receiver.
How does it work ?
In this section is described how this application works. The part of the code about the list of USRPs, the gathering of information is not described. If you want to understand this part of the source code, you have to read the Hello World ! with Windows and the DLL tutorial.
We focus here on three points:
- How to receive a signal from USRP ?
- How the data are written into the file ?
How to receive a signal from USRP ?
The signal received from the USRP is a complex signal. It is stored in two arrays, one for the real part and one for the imaginary part. The size of the array indicates the number of samples wanted.
In the RX to file application, these arrays are declared and initialized as follows:
float[] Data_I; float[] Data_Q; Data_I = new float[NbSamples]; Data_Q = new float[NbSamples];
To get the signal from USRP, just use the command:
MySDR4All.RXOnce(NbSamples, ref Data_I, ref Data_Q);
How the data are written into the file ?
If you want to read a file after an acquisition, you have to now the file format. It is a binary file, coded as:
FS = new System.IO.FileStream(FileName,System.IO.FileMode.Create);
BinaryW = new System.IO.BinaryWriter(FS);
for (int iS = 0; iS < NbSamples; iS++)
{
BinaryW.Write(Data_I[iS]);
BinaryW.Write(Data_Q[iS]);
}
BinaryW.Close();
FS.Close();
Which means that the file is the sequence of symbols, each symbol described as two float numbers. One for the real part and one for the imaginary part.
