# HG changeset patch # User Daniele Nicolodi # Date 1397561707 -7200 # Node ID fefe921a9784b36e169b6f211f7a999043b76343 # Parent 72fafb670eafc101861a0b31cb6a04375da3f352 Use DDS4 for shifting Sr beatnote frequency to 10 kHz diff -r 72fafb670eaf -r fefe921a9784 FXAnalyse.c --- a/FXAnalyse.c Mon Apr 14 12:50:21 2014 +0200 +++ b/FXAnalyse.c Tue Apr 15 13:35:07 2014 +0200 @@ -248,7 +248,7 @@ int nobs = 0; int settling = 0; -double f0_DDS1 = 110000000.0, f0_DDS2, f0_DDS3, df_DDS3; +double f0_DDS1 = 110000000.0, f0_DDS2, f0_DDS3, f0_DDS4, df_DDS3; double SlopeTime1 = 40.0, DeltaT_1 = 40.0, delta_f_lock_1 = 500e3; double SlopeTime2 = 40.0, DeltaT_2 = 40.0, delta_f_lock_2 = 500e3; @@ -1052,7 +1052,7 @@ // record current DDS frequencies f0_DDS2 = ad9912.frequency[1]; - f0_DDS3 = ad9912.frequency[2]; + f0_DDS4 = ad9912.frequency[3]; t1 = utc; t2 = t3 = 0.0; @@ -1088,9 +1088,9 @@ SetCtrlVal(MainPanel, PANEL_DDS1, ad9912.frequency[0]); // adjust DDS3 to keep beatnote within the bandpass filter - double fDDS3 = f0_DDS3 + Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; - ad9912_set_frequency_w(&ad9912, 2, fDDS3); - SetCtrlVal(MainPanel, PANEL_DDS3, ad9912.frequency[2]); + double fDDS4 = f0_DDS4 + Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; + ad9912_set_frequency_w(&ad9912, 3, fDDS4); + SetCtrlVal(MainPanel, PANEL_DDS4, ad9912.frequency[3]); // allow counter to settle settling = 3; @@ -1142,9 +1142,9 @@ SetCtrlVal(MainPanel, PANEL_DDS1, ad9912.frequency[0]); // adjust DDS3 to keep beatnote within the bandpass filter - double fDDS3 = f0_DDS3 - Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; - ad9912_set_frequency_w(&ad9912, 2, fDDS3); - SetCtrlVal(MainPanel, PANEL_DDS3, ad9912.frequency[2]); + double fDDS4 = f0_DDS4 - Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; + ad9912_set_frequency_w(&ad9912, 3, fDDS4); + SetCtrlVal(MainPanel, PANEL_DDS4, ad9912.frequency[3]); // allow counter to settle settling = 3; @@ -1195,10 +1195,10 @@ // back to nominal frep ad9912_ramp_frequency_w(&ad9912, 0, f0_DDS1, FREP_STEP_SIZE); ad9912_set_frequency_w(&ad9912, 1, f0_DDS2); - ad9912_set_frequency_w(&ad9912, 2, f0_DDS3); + ad9912_set_frequency_w(&ad9912, 3, f0_DDS4); SetCtrlVal(MainPanel, PANEL_DDS1, ad9912.frequency[0]); SetCtrlVal(MainPanel, PANEL_DDS2, ad9912.frequency[1]); - SetCtrlVal(MainPanel, PANEL_DDS3, ad9912.frequency[2]); + SetCtrlVal(MainPanel, PANEL_DDS4, ad9912.frequency[3]); // done Measuring_3 = N_MEASUREMENT_NONE; @@ -1243,7 +1243,7 @@ Sign3 = -1.0; else Sign3 = +1.0; - ad9912_set_frequency_w(&ad9912, 3, Frequency3); + ad9912_set_frequency_w(&ad9912, 0, Frequency3); Getsign3 = FALSE; SetCtrlVal(MainPanel, PANEL_SIGN3, Sign3); } @@ -1342,13 +1342,13 @@ } if (recenter.sr) { - // adjust DDS3 frequency to keep Ch3 reading at 10 kHz - double freq = ad9912.frequency[2]; + // adjust DDS4 frequency to keep Ch3 reading at 10 kHz + double freq = ad9912.frequency[3]; double adj = 10000 - rollmean_ch3.mean; freq = freq + adj; - ad9912_set_frequency_w(&ad9912, 2, freq); - SetCtrlVal(MainPanel, PANEL_DDS3, ad9912.frequency[2]); - logmsg("recenter Sr beatnote (ch3) to 10 kHz: DDS3 adjustment=%+3e", adj); + ad9912_set_frequency_w(&ad9912, 3, freq); + SetCtrlVal(MainPanel, PANEL_DDS4, ad9912.frequency[3]); + logmsg("recenter Sr beatnote (ch3) to 10 kHz: DDS4 adjustment=%+3e", adj); } recenter.t0 = utc; @@ -1675,7 +1675,7 @@ Measuring_3 = FALSE; ad9912_ramp_frequency_w(&ad9912, 0, f0_DDS1, FREP_STEP_SIZE); ad9912_set_frequency_w(&ad9912, 1, f0_DDS2); - ad9912_set_frequency_w(&ad9912, 2, f0_DDS3); + ad9912_set_frequency_w(&ad9912, 3, f0_DDS4); break; } @@ -1729,7 +1729,7 @@ return 0; } -int CVICALLBACK CB_OnFind275K (int panel, int control, int event, +int CVICALLBACK CB_AdjustDDSFreq (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double frequency; @@ -1738,16 +1738,21 @@ case EVENT_COMMIT: switch (control) { - case PANEL_FIND275K2: + case PANEL_ADJUST_DDS2: frequency = ad9912.frequency[1] + 275000 - Ch4; ad9912_set_frequency_w(&ad9912, 1, frequency); SetCtrlVal(MainPanel, PANEL_DDS2, ad9912.frequency[1]); break; - case PANEL_FIND10K3: + case PANEL_ADJUST_DDS3: frequency = ad9912.frequency[2] + 10000 - Ch2; ad9912_set_frequency_w(&ad9912, 2, frequency); SetCtrlVal(MainPanel, PANEL_DDS3, ad9912.frequency[2]); break; + case PANEL_ADJUST_DDS4: + frequency = ad9912.frequency[3] + 10000 - Ch3; + ad9912_set_frequency_w(&ad9912, 3, frequency); + SetCtrlVal(MainPanel, PANEL_DDS4, ad9912.frequency[3]); + break; } break; } @@ -2158,6 +2163,7 @@ } return 0; } + int CVICALLBACK CB_DedriftDDSFreq (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { diff -r 72fafb670eaf -r fefe921a9784 FXAnalyse.h --- a/FXAnalyse.h Mon Apr 14 12:50:21 2014 +0200 +++ b/FXAnalyse.h Tue Apr 15 13:35:07 2014 +0200 @@ -101,9 +101,9 @@ #define PANEL_SIGN2 65 /* control type: numeric, callback function: CB_BeatnoteSign */ #define PANEL_FINDSIGN1 66 /* control type: command, callback function: CB_OnFindSign */ #define PANEL_SIGN1 67 /* control type: numeric, callback function: CB_BeatnoteSign */ -#define PANEL_FIND10K3_2 68 /* control type: command, callback function: CB_OnFind275K */ -#define PANEL_FIND10K3 69 /* control type: command, callback function: CB_OnFind275K */ -#define PANEL_FIND275K2 70 /* control type: command, callback function: CB_OnFind275K */ +#define PANEL_ADJUST_DDS4 68 /* control type: command, callback function: CB_AdjustDDSFreq */ +#define PANEL_ADJUST_DDS3 69 /* control type: command, callback function: CB_AdjustDDSFreq */ +#define PANEL_ADJUST_DDS2 70 /* control type: command, callback function: CB_AdjustDDSFreq */ #define PANEL_RESETSLOPE 71 /* control type: command, callback function: CB_OnResetSlope */ #define PANEL_CHECKBOX_STOPIFAUTODE 72 /* control type: radioButton, callback function: CB_OnStopSlopeCancellingOnUnlocked */ #define PANEL_CHECKBOX_KEEPSLOPE 73 /* control type: radioButton, callback function: CB_OnCROX */ @@ -157,6 +157,7 @@ /* Callback Prototypes: */ +int CVICALLBACK CB_AdjustDDSFreq(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_BeatnoteSign(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_ChangeDDSOut(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_ChangeDDSStep(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); @@ -172,7 +173,6 @@ int CVICALLBACK CB_OnCROX(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnEstimateN(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnEventMain(int panel, int event, void *callbackData, int eventData1, int eventData2); -int CVICALLBACK CB_OnFind275K(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnFindSign(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnFreqPlot(int panel, int control, int event, void *callbackData, int eventData1, int eventData2); int CVICALLBACK CB_OnLoggingPanelEvent(int panel, int event, void *callbackData, int eventData1, int eventData2); diff -r 72fafb670eaf -r fefe921a9784 FXAnalyse.uir Binary file FXAnalyse.uir has changed