LimeSDR program in Matlab
25 visualizaciones (últimos 30 días)
Miguel Albuquerque el 21 de Jun. de 2022
Hey guys, thanks in advance.
I am developing a SAR passive radar in Matlab with LimeSDR. I am using jocover and RakhDamir programs to connect LimeSDR to matlab.
The code I present you, let me receive Fs*Ts samples and then when LimeSDR gets that samples it stops receiving. However, I want to receive samples continually, until I presss a button on the keypad to stop receiving on LimeSDR , and then save all the samples in a file to save in my computer. How can I do that, maybe with a while loop?
% Start the module
fprintf('Start of LimeSDR\n');
% Receive samples on RX0 channel
indRx = 1;
[samples, ~, samplesLength] = dev.receive(Fs*Ts,0);
bufferRx(indRx:indRx+samplesLength-1) = samples;
% Receive samples on RX1 channel
indRx1 = 1; % index of the last received sample
[samples1, ~, samplesLength1] = dev.receive(Fs*Ts,1);
bufferRx1(indRx1:indRx1+samplesLength1-1) = samples1;
% Cleanup and shutdown by stopping the RX stream and having MATLAB delete the handle object.
fprintf('Stop of LimeSDR\n');
Ben Cunningham el 23 de Jun. de 2022
Editada: Ben Cunningham el 23 de Jun. de 2022
The following code will give you a while loop which can be stopped by clicking on the pop-up figure. It makes use of a global variable and a quick and dirty dialogue with a callback. Consider consulting the documentation for dialogs to make an optimised design.
global gStop % Global variable to stop while loop
gStop = false;
% Create a dialogue which when clicked calls the 'stopStream' function
stopBtn = dialog('Name', 'Click to Stop', "ButtonDownFcn",@stopStream);
% Create while loop which runs until global gStop is true
% Receive from SDR
drawnow % Gives dialog a chance to call stopStream and set the global variable
close(stopBtn) % Close once stopped
% Sets global gStop to true
gStop = true;
For saving to file consider using the matlab save function like:
save capturedDataFile.mat myData
For large quantities of data, and perhaps to write to a single file each while loop iteration consider using the baseband file writer.