TX bursts

From Tools4SDR

Jump to: navigation, search

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 sends in a continuous way bursts of data. It is provided with the Tools4SDR toolbox and it looks like:

TX bursts screen shot

Its purpose is mainly to test that you can receive signals to Matlab or to your own application with a source which has already been tested.

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 code a signal that will be send by the USRP ?
  • How to send a time limited signal once ?
  • How to send a signal which has no time limit ?

How to code a signal ?

The signal that will be modulated by the USRP is a complex signal. The DLL accepts signals which real part and imaginay part are respectively described by array of float.

In the TX bursts source code, these arrays are defined by

float[][] Data_I;
float[][] Data_Q;

Note that each array has two dimensions. The purpose is to described several signals. So the first dimension is the number of signals, and the second dimension the time index.

When the user click on the "start transmission" button, these arrays are initialized:

Data_I = new float[2][];
Data_I[0] = new float[NbSamplesBursts];
Data_I[1] = new float[NbSamplesInterBurts];

Data_Q = new float[2][];
Data_Q[0] = new float[NbSamplesBursts];
Data_Q[1] = new float[NbSamplesInterBurts];

Which means that:

  • 2 signals are described: the first is the burst of energy. The second the signal with no energy between two bursts.
  • The first signal length is the number of samples into a burst (NbSamplesBursts)
  • The second signal length is the number of samples between two bursts (NbSamplesInterBursts)

The values of the signals are then coded as, for the burst of energy signal:

for (int iT = 0; iT < Data_I[0].Length; iT ++)
{
  if (Signe > 0)
  {
     Data_I[0][iT] = 1;
  }
  else
  {
     Data_I[0][iT] = -1;
  }
  Data_Q[0][iT] = 0;
  
  iP++;
  if (iP == Period)
  {
     iP = 0;
      Signe = -Signe;
  }
};

The second signal, which is zero, is coded as:

for (int iT = 0; iT < Data_I[1].Length; iT++)
{
   Data_I[1][iT] = 0; 
   Data_Q[1][iT] = 0;
};

Note that the signal takes values in the set {-1,0,1}. Whatever maximal and minimal values you use, the signal will be shaped by the DLL to ensure maximal dynamic (maximal transmission power).


How to send a time limited signal once ?

To transmit a signal once, you may use the following command:

MySDR4All.TXOnce(ref Data_I[BufferToSend],ref Data_Q[BufferToSend]);

The function leasts the necessary time to transmit the signal.

In this application, we have to use more elaborate technics since we expect to transmit a signal in a continuous way.

How to send a signal which has no time limit ?

In the TX bursts software, the purpose is to transmit a burst, no data, a burst, no data, etc... This means that we expect to do something like:

int BufferToSend = 0;
while (true)
{
   MySDR4All.TXOnce(ref Data_I[BufferToSend],ref Data_Q[BufferToSend]);
   BufferToSend++;
   if (BufferToSend == Data_I.Length)
   {
       BufferToSend = 0;
   }
}

You can of course do this, but you won't be able to talk to your application anymore. The application will looked like freeze, and you won't be able to stop the transmission.

To avoid this issue, you can use thread. A thread is a window process that runs independently of your application, but which can communicate with your application. In particular, the thread can give to the application some information, and you can also give some information to the thread, such as the signal to transmit or the stop command for example.

This technic is used in this soft. The thread object is defined as:

Thread SendDataThread;

A function that describes the thread code is also written:

public void SendLoop()
{
   int BufferToSend = 0;
   while (true)
   {
      MySDR4All.TXOnce(ref Data_I[BufferToSend],ref Data_Q[BufferToSend]);
      BufferToSend++;
      Invoke(RefreshIHM);
      if (BufferToSend == Data_I.Length)
      {
        BufferToSend = 0;
      }
   }
}

The invoke function is to make the thread communicate with the IHM. It is an empty function in this code.

Finally, when the user click on the "start transmission" button, the thread is created and launched with the commands:

SendDataThread = new Thread(SendLoop);
SendDataThread.Start();

To stop the thread, the function

SendDataThread.Abort();

is called.

Personal tools
Software defined radio