root/ResearchApps/PHY/WARPLAB/WARPLAB_SISO/M_code/warplab_siso_Gui_50MHz.m
| Revision 812, 21.0 kB (checked in by MelissaDuarte, 9 months ago) |
|---|
| Line | |
|---|---|
| 1 | function varargout = warplab_siso_Gui_50MHz(varargin) |
| 2 | % Begin initialization code - DO NOT EDIT |
| 3 | gui_Singleton = 1; |
| 4 | gui_State = struct('gui_Name', mfilename, ... |
| 5 | 'gui_Singleton', gui_Singleton, ... |
| 6 | 'gui_OpeningFcn', @warplab_siso_Gui_50MHz_OpeningFcn, ... |
| 7 | 'gui_OutputFcn', @warplab_siso_Gui_50MHz_OutputFcn, ... |
| 8 | 'gui_LayoutFcn', [] , ... |
| 9 | 'gui_Callback', []); |
| 10 | if nargin && ischar(varargin{1}) |
| 11 | gui_State.gui_Callback = str2func(varargin{1}); |
| 12 | end |
| 13 | |
| 14 | if nargout |
| 15 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
| 16 | else |
| 17 | gui_mainfcn(gui_State, varargin{:}); |
| 18 | end |
| 19 | % End initialization code - DO NOT EDIT |
| 20 | global warplab_sisoGUI; |
| 21 | warplab_siso_GUIdefines; |
| 22 | |
| 23 | |
| 24 | % --- Executes just before warplab_siso_Gui_50MHz is made visible. |
| 25 | function warplab_siso_Gui_50MHz_OpeningFcn(hObject, eventdata, handles, varargin) |
| 26 | % This function has no output args, see OutputFcn. |
| 27 | % hObject handle to figure |
| 28 | % eventdata reserved - to be defined in a future version of MATLAB |
| 29 | % handles structure with handles and user data (see GUIDATA) |
| 30 | % varargin command line arguments to warplab_siso_Gui_50MHz (see VARARGIN) |
| 31 | % Choose default command line output for warplab_siso_Gui_50MHz |
| 32 | handles.output = hObject; |
| 33 | % Update handles structure |
| 34 | guidata(hObject, handles); |
| 35 | |
| 36 | %Close any stale sockets |
| 37 | pnet('closeall'); |
| 38 | |
| 39 | global warplab_sisoGUI; |
| 40 | |
| 41 | %Options |
| 42 | warplab_sisoGUI.CaptOffset = 1000; |
| 43 | warplab_sisoGUI.TxLength = 16384; |
| 44 | warplab_sisoGUI.TxGainBB = 3; %Tx Baseband Gain [0:3] |
| 45 | warplab_sisoGUI.TxGainRF = 40; %Tx RF Gain - [0:63] |
| 46 | warplab_sisoGUI.RxGainBB = 20; %Rx Baseband Gain - [0:31] |
| 47 | warplab_sisoGUI.RxGainRF = 1; %Rx RF Gain - [1:3] |
| 48 | warplab_sisoGUI.CarrierChannel = 11; |
| 49 | |
| 50 | % Axes |
| 51 | axes(handles.axes_I); |
| 52 | xlabel('Rx I'); |
| 53 | |
| 54 | axes(handles.axes_Q); |
| 55 | xlabel('Rx Q'); |
| 56 | |
| 57 | axes(handles.axes_TxIQ); |
| 58 | xlabel('Tx Spectrum'); |
| 59 | |
| 60 | axes(handles.axes_RxIQ); |
| 61 | xlabel('Rx Spectrum'); |
| 62 | |
| 63 | |
| 64 | |
| 65 | % --- Outputs from this function are returned to the command line. |
| 66 | function varargout = warplab_siso_Gui_50MHz_OutputFcn(hObject, eventdata, handles) |
| 67 | % varargout cell array for returning output args (see VARARGOUT); |
| 68 | % hObject handle to figure |
| 69 | % eventdata reserved - to be defined in a future version of MATLAB |
| 70 | % handles structure with handles and user data (see GUIDATA) |
| 71 | |
| 72 | % Get default command line output from handles structure |
| 73 | varargout{1} = handles.output; |
| 74 | |
| 75 | |
| 76 | |
| 77 | function edit_TxVector_Callback(hObject, eventdata, handles) |
| 78 | % hObject handle to edit_TxVector (see GCBO) |
| 79 | % eventdata reserved - to be defined in a future version of MATLAB |
| 80 | % handles structure with handles and user data (see GUIDATA) |
| 81 | |
| 82 | % Hints: get(hObject,'String') returns contents of edit_TxVector as text |
| 83 | % str2double(get(hObject,'String')) returns contents of edit_TxVector as a double |
| 84 | global warplab_sisoGUI; |
| 85 | warplab_siso_GUIdefines; |
| 86 | evalin('base','t = 0:20e-9:(2^14-1)*20e-9;'); |
| 87 | warplab_sisoGUI.radio2TxData = evalin('base',get(hObject,'String')); |
| 88 | |
| 89 | % --- Executes during object creation, after setting all properties. |
| 90 | function edit_TxVector_CreateFcn(hObject, eventdata, handles) |
| 91 | % hObject handle to edit_TxVector (see GCBO) |
| 92 | % eventdata reserved - to be defined in a future version of MATLAB |
| 93 | % handles empty - handles not created until after all CreateFcns called |
| 94 | |
| 95 | % Hint: edit controls usually have a white background on Windows. |
| 96 | % See ISPC and COMPUTER. |
| 97 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 98 | set(hObject,'BackgroundColor','white'); |
| 99 | end |
| 100 | global warplab_sisoGUI; |
| 101 | warplab_siso_GUIdefines; |
| 102 | evalin('base','t = 0:20e-9:(2^14-1)*20e-9;'); |
| 103 | warplab_sisoGUI.radio2TxData = evalin('base',get(hObject,'String')); |
| 104 | |
| 105 | % --- Executes on button press in pushbutton_Go. |
| 106 | function pushbutton_Go_Callback(hObject, eventdata, handles) |
| 107 | % hObject handle to pushbutton_Go (see GCBO) |
| 108 | % eventdata reserved - to be defined in a future version of MATLAB |
| 109 | % handles structure with handles and user data (see GUIDATA) |
| 110 | %Download the samples to be transmitted |
| 111 | global warplab_sisoGUI; |
| 112 | set(handles.text_status, 'String', 'Running...'); |
| 113 | |
| 114 | set(hObject, 'Enable', 'Off'); |
| 115 | % warplab_siso_GUIdefines; |
| 116 | |
| 117 | warplab_siso_GUIinitialize; |
| 118 | |
| 119 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 120 | % Start of Code to avoid conflict between users, only needed for the |
| 121 | % workshop |
| 122 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 123 | % if(okToUseBoards == 0) |
| 124 | % set(hObject, 'Enable', 'On'); |
| 125 | % set(handles.text_status, 'String', 'Done!'); |
| 126 | % return; |
| 127 | % end |
| 128 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 129 | % End of Code to avoid conflict between users, only needed for the |
| 130 | % workshop |
| 131 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 132 | |
| 133 | |
| 134 | updateOptions(hObject, eventdata, handles); |
| 135 | |
| 136 | %Download the samples to be transmitted |
| 137 | warplab_writeSMWO(warplab_sisoGUI.udp_Tx, warplab_sisoGUI.radio2TxData, warplab_sisoGUI.RADIO2_TXDATA); |
| 138 | |
| 139 | %Enable Tx Radio #2 |
| 140 | warplab_sendCmd(warplab_sisoGUI.udp_Tx, warplab_sisoGUI.RADIO2_TXEN, warplab_sisoGUI.pktNoTx); |
| 141 | |
| 142 | %Enable Rx Radio #2 |
| 143 | warplab_sendCmd(warplab_sisoGUI.udp_RxA, warplab_sisoGUI.RADIO2_RXEN, warplab_sisoGUI.pktNoTx); |
| 144 | |
| 145 | %Enable the transmission |
| 146 | warplab_sendCmd(warplab_sisoGUI.udp_Tx, warplab_sisoGUI.TX_START, warplab_sisoGUI.pktNoTx); |
| 147 | |
| 148 | %Enable the capture |
| 149 | warplab_sendCmd(warplab_sisoGUI.udp_RxA, warplab_sisoGUI.RX_START, warplab_sisoGUI.pktNoTx); |
| 150 | |
| 151 | %Send the SYNC packet |
| 152 | warplab_sendSync(warplab_sisoGUI.udp_Sync); |
| 153 | |
| 154 | %Read back the received samples |
| 155 | global rxData rxOTR rxRSSI; |
| 156 | |
| 157 | %Read back the received samples |
| 158 | [RawRxData] = warplab_readSMRO(warplab_sisoGUI.udp_RxA, warplab_sisoGUI.RADIO2_RXDATA, warplab_sisoGUI.TxLength); |
| 159 | % Process the received samples to obtain meaningful data |
| 160 | [rxData,rxOTR] = warplab_processRawRxData(RawRxData); |
| 161 | % Read stored RSSI data |
| 162 | [RawRSSIData] = warplab_readSMRO(warplab_sisoGUI.udp_RxA, warplab_sisoGUI.RADIO2_RSSIDATA, warplab_sisoGUI.TxLength/8); |
| 163 | % Procecss Raw RSSI data to obtain meningful RSSI values |
| 164 | [rxRSSI] = warplab_processRawRSSIData(RawRSSIData); |
| 165 | |
| 166 | %[rxData rxOTR rxRSSI] = warplab_RxDataRead(warplab_sisoGUI.udp_RxA, 2, warplab_sisoGUI.TxLength); |
| 167 | evalin('base', 'global rxData rxOTR rxRSSI;'); |
| 168 | |
| 169 | %Reset the receivers |
| 170 | warplab_sendCmd(warplab_sisoGUI.udp_RxA, warplab_sisoGUI.RX_DONEREADING, warplab_sisoGUI.pktNoTx); |
| 171 | |
| 172 | %Disable the receiver |
| 173 | warplab_sendCmd(warplab_sisoGUI.udp_RxA, warplab_sisoGUI.RADIO2_RXDIS, warplab_sisoGUI.pktNoTx); |
| 174 | |
| 175 | %Disable the transmitter |
| 176 | warplab_sendCmd(warplab_sisoGUI.udp_Tx, warplab_sisoGUI.RADIO2_TXDIS, warplab_sisoGUI.pktNoTx); |
| 177 | |
| 178 | % close sockets |
| 179 | pnet('closeall'); |
| 180 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 181 | % Start of Code to avoid conflict between users, only needed for the |
| 182 | % workshop |
| 183 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 184 | % !del c:\boards_lock.txt |
| 185 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 186 | % End of Code to avoid conflict between users, only needed for the |
| 187 | % workshop |
| 188 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 189 | |
| 190 | |
| 191 | set(handles.text_status, 'String', 'Done!'); |
| 192 | |
| 193 | axes(handles.axes_I); cla; c = axis(gca); |
| 194 | plot(real(rxData)); |
| 195 | axis(gca, c); grid on; |
| 196 | xlabel('Rx I'); |
| 197 | |
| 198 | axes(handles.axes_Q); cla; c = axis(gca); |
| 199 | plot(imag(rxData)); |
| 200 | axis(gca, c); grid on; |
| 201 | xlabel('Rx Q'); |
| 202 | |
| 203 | freq_axis = 50e6*(0:2^14)/2^14; |
| 204 | freq_axis_shift = fftshift(freq_axis); |
| 205 | freq_ticks=[freq_axis_shift(1:2^13)-freq_axis_shift(2^13),freq_axis_shift(2^13+1:2^14+1)]; |
| 206 | |
| 207 | axes(handles.axes_TxIQ); cla; c = axis(gca); |
| 208 | spectrum=10*log10(abs(fftshift(fft(warplab_sisoGUI.radio2TxData)))); |
| 209 | plot(freq_ticks(2^12:3*2^12),spectrum(2^12:3*2^12)); |
| 210 | % spectrum=10*log10(abs(fftshift(fft(warplab_sisoGUI.radio2TxData)))) |
| 211 | % plot(freq_ticks,10*log10(abs(fftshift(fft(warplab_sisoGUI.radio2TxData))))); |
| 212 | %plot(10*log10(abs(fft(warplab_sisoGUI.radio2TxData,2^14)))); |
| 213 | %axis tight; |
| 214 | grid on; |
| 215 | xlabel('Tx Spectrum'); |
| 216 | |
| 217 | axes(handles.axes_RxIQ); cla; c = axis(gca); |
| 218 | spectrum=10*log10(abs(fftshift(fft(rxData(warplab_sisoGUI.CaptOffset:2^14),2^14)))); |
| 219 | plot(freq_ticks(2^12:3*2^12),spectrum(2^12:3*2^12)); |
| 220 | %plot(10*log10(abs(fftshift(fft(rxData))))); |
| 221 | %plot(10*log10(abs(fft(rxData,2^14)))); |
| 222 | %axis tight; |
| 223 | grid on; |
| 224 | xlabel('Rx Spectrum'); |
| 225 | set(hObject, 'Enable', 'On'); |
| 226 | |
| 227 | % --- Executes during object creation, after setting all properties. |
| 228 | function text_status_CreateFcn(hObject, eventdata, handles) |
| 229 | % hObject handle to text_status (see GCBO) |
| 230 | % eventdata reserved - to be defined in a future version of MATLAB |
| 231 | % handles empty - handles not created until after all CreateFcns called |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | % --- Executes during object deletion, before destroying properties. |
| 238 | function figure1_DeleteFcn(hObject, eventdata, handles) |
| 239 | % hObject handle to figure1 (see GCBO) |
| 240 | % eventdata reserved - to be defined in a future version of MATLAB |
| 241 | % handles structure with handles and user data (see GUIDATA) |
| 242 | pnet('closeall'); |
| 243 | |
| 244 | function edit_TxGainBB_Callback(hObject, eventdata, handles) |
| 245 | % hObject handle to edit_TxGainBB (see GCBO) |
| 246 | % eventdata reserved - to be defined in a future version of MATLAB |
| 247 | % handles structure with handles and user data (see GUIDATA) |
| 248 | |
| 249 | % Hints: get(hObject,'String') returns contents of edit_TxGainBB as text |
| 250 | % str2double(get(hObject,'String')) returns contents of edit_TxGainBB as a double |
| 251 | |
| 252 | |
| 253 | % --- Executes during object creation, after setting all properties. |
| 254 | function edit_TxGainBB_CreateFcn(hObject, eventdata, handles) |
| 255 | % hObject handle to edit_TxGainBB (see GCBO) |
| 256 | % eventdata reserved - to be defined in a future version of MATLAB |
| 257 | % handles empty - handles not created until after all CreateFcns called |
| 258 | |
| 259 | % Hint: edit controls usually have a white background on Windows. |
| 260 | % See ISPC and COMPUTER. |
| 261 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 262 | set(hObject,'BackgroundColor','white'); |
| 263 | end |
| 264 | global warplab_sisoGUI; |
| 265 | set(hObject, 'String', sprintf('%d', warplab_sisoGUI.TxGainBB)); |
| 266 | |
| 267 | |
| 268 | function edit_TxGainRF_Callback(hObject, eventdata, handles) |
| 269 | % hObject handle to edit_TxGainRF (see GCBO) |
| 270 | % eventdata reserved - to be defined in a future version of MATLAB |
| 271 | % handles structure with handles and user data (see GUIDATA) |
| 272 | |
| 273 | % Hints: get(hObject,'String') returns contents of edit_TxGainRF as text |
| 274 | % str2double(get(hObject,'String')) returns contents of edit_TxGainRF as a double |
| 275 | |
| 276 | |
| 277 | % --- Executes during object creation, after setting all properties. |
| 278 | function edit_TxGainRF_CreateFcn(hObject, eventdata, handles) |
| 279 | % hObject handle to edit_TxGainRF (see GCBO) |
| 280 | % eventdata reserved - to be defined in a future version of MATLAB |
| 281 | % handles empty - handles not created until after all CreateFcns called |
| 282 | |
| 283 | % Hint: edit controls usually have a white background on Windows. |
| 284 | % See ISPC and COMPUTER. |
| 285 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 286 | set(hObject,'BackgroundColor','white'); |
| 287 | end |
| 288 | global warplab_sisoGUI; |
| 289 | set(hObject, 'String', sprintf('%d', warplab_sisoGUI.TxGainRF)); |
| 290 | |
| 291 | |
| 292 | |
| 293 | function edit4_Callback(hObject, eventdata, handles) |
| 294 | % hObject handle to edit4 (see GCBO) |
| 295 | % eventdata reserved - to be defined in a future version of MATLAB |
| 296 | % handles structure with handles and user data (see GUIDATA) |
| 297 | |
| 298 | % Hints: get(hObject,'String') returns contents of edit4 as text |
| 299 | % str2double(get(hObject,'String')) returns contents of edit4 as a double |
| 300 | |
| 301 | |
| 302 | % --- Executes during object creation, after setting all properties. |
| 303 | function edit4_CreateFcn(hObject, eventdata, handles) |
| 304 | % hObject handle to edit4 (see GCBO) |
| 305 | % eventdata reserved - to be defined in a future version of MATLAB |
| 306 | % handles empty - handles not created until after all CreateFcns called |
| 307 | |
| 308 | % Hint: edit controls usually have a white background on Windows. |
| 309 | % See ISPC and COMPUTER. |
| 310 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 311 | set(hObject,'BackgroundColor','white'); |
| 312 | end |
| 313 | |
| 314 | |
| 315 | |
| 316 | function edit_RxGainRF_Callback(hObject, eventdata, handles) |
| 317 | % hObject handle to edit_RxGainRF (see GCBO) |
| 318 | % eventdata reserved - to be defined in a future version of MATLAB |
| 319 | % handles structure with handles and user data (see GUIDATA) |
| 320 | |
| 321 | % Hints: get(hObject,'String') returns contents of edit_RxGainRF as text |
| 322 | % str2double(get(hObject,'String')) returns contents of edit_RxGainRF as a double |
| 323 | |
| 324 | |
| 325 | % --- Executes during object creation, after setting all properties. |
| 326 | function edit_RxGainRF_CreateFcn(hObject, eventdata, handles) |
| 327 | % hObject handle to edit_RxGainRF (see GCBO) |
| 328 | % eventdata reserved - to be defined in a future version of MATLAB |
| 329 | % handles empty - handles not created until after all CreateFcns called |
| 330 | |
| 331 | % Hint: edit controls usually have a white background on Windows. |
| 332 | % See ISPC and COMPUTER. |
| 333 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 334 | set(hObject,'BackgroundColor','white'); |
| 335 | end |
| 336 | global warplab_sisoGUI; |
| 337 | set(hObject, 'String', sprintf('%d', warplab_sisoGUI.RxGainRF)); |
| 338 | |
| 339 | function edit_RxGainBB_Callback(hObject, eventdata, handles) |
| 340 | % hObject handle to edit_RxGainBB (see GCBO) |
| 341 | % eventdata reserved - to be defined in a future version of MATLAB |
| 342 | % handles structure with handles and user data (see GUIDATA) |
| 343 | |
| 344 | % Hints: get(hObject,'String') returns contents of edit_RxGainBB as text |
| 345 | % str2double(get(hObject,'String')) returns contents of edit_RxGainBB as a double |
| 346 | set(handles.slider_RxGainBB, 'Value', str2double(get(hObject,'String'))); |
| 347 | |
| 348 | |
| 349 | % --- Executes during object creation, after setting all properties. |
| 350 | function edit_RxGainBB_CreateFcn(hObject, eventdata, handles) |
| 351 | % hObject handle to edit_RxGainBB (see GCBO) |
| 352 | % eventdata reserved - to be defined in a future version of MATLAB |
| 353 | % handles empty - handles not created until after all CreateFcns called |
| 354 | |
| 355 | % Hint: edit controls usually have a white background on Windows. |
| 356 | % See ISPC and COMPUTER. |
| 357 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 358 | set(hObject,'BackgroundColor','white'); |
| 359 | end |
| 360 | global warplab_sisoGUI; |
| 361 | set(hObject, 'String', sprintf('%d', warplab_sisoGUI.RxGainBB)); |
| 362 | |
| 363 | % --- Executes on slider movement. |
| 364 | function slider_RxGainBB_Callback(hObject, eventdata, handles) |
| 365 | % hObject handle to slider_RxGainBB (see GCBO) |
| 366 | % eventdata reserved - to be defined in a future version of MATLAB |
| 367 | % handles structure with handles and user data (see GUIDATA) |
| 368 | |
| 369 | % Hints: get(hObject,'Value') returns position of slider |
| 370 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
| 371 | set(handles.edit_RxGainBB, 'String', round(get(hObject, 'Value'))); |
| 372 | |
| 373 | % --- Executes during object creation, after setting all properties. |
| 374 | function slider_RxGainBB_CreateFcn(hObject, eventdata, handles) |
| 375 | % hObject handle to slider_RxGainBB (see GCBO) |
| 376 | % eventdata reserved - to be defined in a future version of MATLAB |
| 377 | % handles empty - handles not created until after all CreateFcns called |
| 378 | |
| 379 | % Hint: slider controls usually have a light gray background. |
| 380 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 381 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
| 382 | end |
| 383 | global warplab_sisoGUI; |
| 384 | set(hObject, 'Value', warplab_sisoGUI.RxGainBB); |
| 385 | |
| 386 | function edit_CaptureOffset_Callback(hObject, eventdata, handles) |
| 387 | % hObject handle to edit_CaptureOffset (see GCBO) |
| 388 | % eventdata reserved - to be defined in a future version of MATLAB |
| 389 | % handles structure with handles and user data (see GUIDATA) |
| 390 | |
| 391 | % Hints: get(hObject,'String') returns contents of edit_CaptureOffset as text |
| 392 | % str2double(get(hObject,'String')) returns contents of edit_CaptureOffset as a double |
| 393 | |
| 394 | |
| 395 | % --- Executes during object creation, after setting all properties. |
| 396 | function edit_CaptureOffset_CreateFcn(hObject, eventdata, handles) |
| 397 | % hObject handle to edit_CaptureOffset (see GCBO) |
| 398 | % eventdata reserved - to be defined in a future version of MATLAB |
| 399 | % handles empty - handles not created until after all CreateFcns called |
| 400 | |
| 401 | % Hint: edit controls usually have a white background on Windows. |
| 402 | % See ISPC and COMPUTER. |
| 403 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 404 | set(hObject,'BackgroundColor','white'); |
| 405 | end |
| 406 | |
| 407 | function edit_Channel_Callback(hObject, eventdata, handles) |
| 408 | % hObject handle to edit_Channel (see GCBO) |
| 409 | % eventdata reserved - to be defined in a future version of MATLAB |
| 410 | % handles structure with handles and user data (see GUIDATA) |
| 411 | |
| 412 | % Hints: get(hObject,'String') returns contents of edit_Channel as text |
| 413 | % str2double(get(hObject,'String')) returns contents of edit_Channel as a double |
| 414 | |
| 415 | |
| 416 | % --- Executes during object creation, after setting all properties. |
| 417 | function edit_Channel_CreateFcn(hObject, eventdata, handles) |
| 418 | % hObject handle to edit_Channel (see GCBO) |
| 419 | % eventdata reserved - to be defined in a future version of MATLAB |
| 420 | % handles empty - handles not created until after all CreateFcns called |
| 421 | |
| 422 | % Hint: edit controls usually have a white background on Windows. |
| 423 | % See ISPC and COMPUTER. |
| 424 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 425 | set(hObject,'BackgroundColor','white'); |
| 426 | end |
| 427 | |
| 428 | |
| 429 | function updateOptions(hObject, eventdata, handles) |
| 430 | global warplab_sisoGUI; |
| 431 | warplab_siso_GUIdefines; |
| 432 | warplab_sisoGUI.TxGainBB = eval(get(handles.edit_TxGainBB, 'String')); |
| 433 | warplab_sisoGUI.TxGainRF = eval(get(handles.edit_TxGainRF, 'String')); |
| 434 | warplab_sisoGUI.RxGainBB = eval(get(handles.edit_RxGainBB, 'String')); |
| 435 | warplab_sisoGUI.RxGainRF = eval(get(handles.edit_RxGainRF, 'String')); |
| 436 | warplab_sisoGUI.CaptOffset = eval(get(handles.edit_CaptureOffset, 'String')); |
| 437 | warplab_sisoGUI.CarrierChannel = eval(get(handles.edit_Channel, 'String')); |
| 438 | |
| 439 | %Define the options vector; the order of opitons is set by the FPGA's code |
| 440 | warplab_sisoGUI.optionsVector = [warplab_sisoGUI.CaptOffset warplab_sisoGUI.TxLength-1 (warplab_sisoGUI.RxGainBB + warplab_sisoGUI.RxGainRF*2^16) (warplab_sisoGUI.TxGainRF + warplab_sisoGUI.TxGainBB*2^16) warplab_sisoGUI.CarrierChannel]; |
| 441 | warplab_setOptions(warplab_sisoGUI.socketHandles,warplab_sisoGUI.optionsVector); |
| 442 | |
| 443 | |
| 444 | % --- Executes during object creation, after setting all properties. |
| 445 | function axes_RxIQ_CreateFcn(hObject, eventdata, handles) |
| 446 | % hObject handle to axes_RxIQ (see GCBO) |
| 447 | % eventdata reserved - to be defined in a future version of MATLAB |
| 448 | % handles empty - handles not created until after all CreateFcns called |
| 449 | |
| 450 | % Hint: place code in OpeningFcn to populate axes_RxIQ |
| 451 | axis(gca, [-1 1 -1 1]); |
| 452 | grid on; |
| 453 | |
| 454 | |
| 455 | % --- Executes during object creation, after setting all properties. |
| 456 | function axes_TxIQ_CreateFcn(hObject, eventdata, handles) |
| 457 | % hObject handle to axes_RxIQ (see GCBO) |
| 458 | % eventdata reserved - to be defined in a future version of MATLAB |
| 459 | % handles empty - handles not created until after all CreateFcns called |
| 460 | |
| 461 | % Hint: place code in OpeningFcn to populate axes_RxIQ |
| 462 | axis(gca, [-1 1 -1 1]); |
| 463 | grid on; |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | % --- Executes on slider movement. |
| 469 | function slider_TxGainRF_Callback(hObject, eventdata, handles) |
| 470 | % hObject handle to slider_TxGainRF (see GCBO) |
| 471 | % eventdata reserved - to be defined in a future version of MATLAB |
| 472 | % handles structure with handles and user data (see GUIDATA) |
| 473 | |
| 474 | % Hints: get(hObject,'Value') returns position of slider |
| 475 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
| 476 | set(handles.edit_TxGainRF, 'String', round(get(hObject, 'Value'))); |
| 477 | |
| 478 | % --- Executes during object creation, after setting all properties. |
| 479 | function slider_TxGainRF_CreateFcn(hObject, eventdata, handles) |
| 480 | % hObject handle to slider_TxGainRF (see GCBO) |
| 481 | % eventdata reserved - to be defined in a future version of MATLAB |
| 482 | % handles empty - handles not created until after all CreateFcns called |
| 483 | |
| 484 | % Hint: slider controls usually have a light gray background. |
| 485 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 486 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
| 487 | end |
| 488 | global warplab_sisoGUI; |
| 489 | set(hObject, 'Value', warplab_sisoGUI.TxGainRF); |
| 490 | |
| 491 | % --- Executes during object creation, after setting all properties. |
| 492 | function axes_I_CreateFcn(hObject, eventdata, handles) |
| 493 | % hObject handle to axes_I (see GCBO) |
| 494 | % eventdata reserved - to be defined in a future version of MATLAB |
| 495 | % handles empty - handles not created until after all CreateFcns called |
| 496 | |
| 497 | % Hint: place code in OpeningFcn to populate axes_I |
| 498 | axis(gca, [1 2^14 -1 1]); |
| 499 | grid on; |
| 500 | |
| 501 | % --- Executes during object creation, after setting all properties. |
| 502 | function axes_Q_CreateFcn(hObject, eventdata, handles) |
| 503 | % hObject handle to axes_Q (see GCBO) |
| 504 | % eventdata reserved - to be defined in a future version of MATLAB |
| 505 | % handles empty - handles not created until after all CreateFcns called |
| 506 | |
| 507 | % Hint: place code in OpeningFcn to populate axes_Q |
| 508 | xlabel(hObject,'Rx Q'); |
| 509 | axis(gca, [1 2^14 -1 1]); |
| 510 | grid on; |
| 511 | %xlabel('Rx Q'); |
| 512 | %plot(imag(rxData)); |
| 513 | %axis(gca, c); grid on; |
| 514 | |
| 515 | |
| 516 |
Note: See TracBrowser
for help on using the browser.