# HG changeset patch # User Daniele Nicolodi # Date 1363606445 -3600 # Node ID 46fe62febcd0573aa9bcc4b5549f6a321162e68d # Parent 930acf691aa45fdd665e71efdbcbf510f25dcdcf Add dedrifting DDS reset functionality diff -r 930acf691aa4 -r 46fe62febcd0 FXAnalyse.c --- a/FXAnalyse.c Wed Feb 27 09:49:05 2013 +0100 +++ b/FXAnalyse.c Mon Mar 18 12:34:05 2013 +0100 @@ -2243,3 +2243,28 @@ return 0; } +int CVICALLBACK CB_ResetDedriftDDS (int panel, int control, int event, + void *callbackData, int eventData1, int eventData2) +{ + switch (event) + { + case EVENT_COMMIT: + // stop slope measurement and reset slope + SlopeMeasuring = 0; + SetCtrlVal(panel, PANEL_MEASURE_SLOPE, SlopeMeasuring); + CenterFrequencyCh2 = 0.0; + MoyMath2 = 0.0; + Nratio = -1; + CenterFrequencyCh2ToDetermine = TRUE ; + appliedSlope = 0.0; + SetCtrlVal(panel, PANEL_SLOPE_APPLIED, appliedSlope); + // reset DDS + DDSFox_Reset(&DDS1xAD9956); + DDSFox_SetProfile(&DDS1xAD9956); + DDSFox_SetDiv(&DDS1xAD9956, 1); + DDSFox_Set(&DDS1xAD9956, DEDRIFT_DDS_FREQUENCY, appliedSlope); + break; + } + return 0; +} + diff -r 930acf691aa4 -r 46fe62febcd0 FXAnalyse.h --- a/FXAnalyse.h Wed Feb 27 09:49:05 2013 +0100 +++ b/FXAnalyse.h Mon Mar 18 12:34:05 2013 +0100 @@ -1,6 +1,6 @@ /**************************************************************************/ /* LabWindows/CVI User Interface Resource (UIR) Include File */ -/* Copyright (c) National Instruments 2012. All Rights Reserved. */ +/* Copyright (c) National Instruments 2013. All Rights Reserved. */ /* */ /* WARNING: Do not add to, delete from, or otherwise modify the contents */ /* of this include file. */ @@ -171,6 +171,7 @@ #define PANEL_INVERT_SLOPE_SIGN 117 /* control type: radioButton, callback function: CB_InvertSlopeSign */ #define PANEL_MEASURE_SLOPE 118 /* control type: LED, callback function: CB_MeasureSlope */ #define PANEL_SLOPE_MEASURED 119 /* control type: numeric, callback function: (none) */ +#define PANEL_RESET_DEDRIFT_DDS 120 /* control type: command, callback function: CB_ResetDedriftDDS */ /* Menu Bars, Menus, and Menu Items: */ @@ -214,6 +215,7 @@ int CVICALLBACK CB_OnStop(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnStopSlopeCancellingOnUnlocked(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnTimer(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); +int CVICALLBACK CB_ResetDedriftDDS(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_SetSlope(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK QuitCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); diff -r 930acf691aa4 -r 46fe62febcd0 FXAnalyse.uir Binary file FXAnalyse.uir has changed