# HG changeset patch # User Daniele Nicolodi # Date 1391437355 -3600 # Node ID 9154291658efe89b229af6f8ff0bbc3334134fd6 # Parent f4633519a62847ebb9c4dabe3f370e9e8b01d85c Simplify DDS frequency juggling in N measurement Clarify variable names. Update display at the end of the cicle with actual frequency values. Remove unnecessary SetFrequency() calls after RampFrequency(). diff -r f4633519a628 -r 9154291658ef FXAnalyse.c --- a/FXAnalyse.c Mon Feb 03 15:10:41 2014 +0100 +++ b/FXAnalyse.c Mon Feb 03 15:22:35 2014 +0100 @@ -184,7 +184,8 @@ int Measuring_2 = N_MEASUREMENT_NONE; int Measuring_3 = N_MEASUREMENT_NONE; -double FrequDDS1=110000000.0; +double f0_DDS1 = 110000000.0, f0_DDS2, f0_DDS3; + double Slope_1=0.0, Slope_2=0.0, Slope_3=0.0, Beatslope_2=0.0; double SlopeTime1=40.0, SlopeTime2=40.0, SlopeTime3=40.0; double Ch4Slope = 0.0; @@ -196,9 +197,6 @@ int n_1=0, n_2=0, n_3=0; -double FrequencyDDSBesInit = 0.0; -double FrequencyDDS3Init = 0.0; - double DeltaDDS3=0.0,Delta10K_Plus=0.0,Delta10K_Minus=0.0; double Nu1=0.0, Nu2= 200000-147000+282143746.557455e6; @@ -250,7 +248,7 @@ .freq0 = 70e6, .threshold = 100.0, .applied = 0.0, - .interval = 40.0, + .interval = 30.0, .t0 = 0.0 }; @@ -710,11 +708,11 @@ // with a thousands separator: use string controllers and a // custom formatting function char buffer[256]; - SetCtrlVal(MainPanel,PANEL_MATH1, thousands(buffer, sizeof(buffer), "%.6f", Math1)); - SetCtrlVal(MainPanel,PANEL_MATH2, thousands(buffer, sizeof(buffer), "%.3f", Math2)); - SetCtrlVal(MainPanel,PANEL_MATH3, thousands(buffer, sizeof(buffer), "%.3f", Math3)); - SetCtrlVal(MainPanel,PANEL_MATH4, thousands(buffer, sizeof(buffer), "%.3f", Math4)); - SetCtrlVal(MainPanel,PANEL_MATH5, thousands(buffer, sizeof(buffer), "%.3f", Math5)); + SetCtrlVal(MainPanel, PANEL_MATH1, thousands(buffer, sizeof(buffer), "%.6f", Math1)); + SetCtrlVal(MainPanel, PANEL_MATH2, thousands(buffer, sizeof(buffer), "%.3f", Math2)); + SetCtrlVal(MainPanel, PANEL_MATH3, thousands(buffer, sizeof(buffer), "%.3f", Math3)); + SetCtrlVal(MainPanel, PANEL_MATH4, thousands(buffer, sizeof(buffer), "%.3f", Math4)); + SetCtrlVal(MainPanel, PANEL_MATH5, thousands(buffer, sizeof(buffer), "%.3f", Math5)); // update timeseries plots for (struct plot *plot = plots; plot->data; plot++) @@ -736,13 +734,12 @@ // initialization step // set DDS1 to nominal frequency - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); - GetCtrlVal(MainPanel, PANEL_DDS2, &FrequencyDDSBesInit); - t2_1 = t3_1 = 0.0; + f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); t1_1 = utc; - + t2_1 = 0.0; + t3_1 = 0.0; stat_zero(&stat_math1); stat_zero(&stat_ch4); @@ -759,11 +756,9 @@ if ((utc - t1_1) > SlopeTime1) { Slope_1 = stat_math1.slope; Ch4Slope = stat_ch4.slope; - SetCtrlVal(CalcNPanel, CALCN_SLOPE, Slope_1); // frep positive step - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1 + DeltakHz_1 * 1000.0, FREP_STEP_SIZE); - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 + DeltakHz_1 * 1000.0); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + DeltakHz_1 * 1000.0, FREP_STEP_SIZE); // allow counter to settle settling = 3; @@ -783,9 +778,7 @@ } double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); - fDDS2 += 275000 - Ch4; - SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2 + 275000 - Ch4); // allow counter to settle settling = 3; @@ -815,8 +808,7 @@ n_1 = 0; // frep negative step - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1 - DeltakHz_1 * 1000.0, FREP_STEP_SIZE); - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 - DeltakHz_1 * 1000.0); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - DeltakHz_1 * 1000.0, FREP_STEP_SIZE); // allow counter to settle settling = 3; @@ -857,10 +849,8 @@ Frepplus_1 = 0.0; // back to nominal frep - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1, FREP_STEP_SIZE); - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); - SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); // done Measuring_1 = N_MEASUREMENT_NONE; @@ -878,13 +868,11 @@ // initialization step // set DDS1 to nominal frequency - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); - GetCtrlVal(MainPanel, PANEL_DDS2, &FrequencyDDSBesInit); - GetCtrlVal(MainPanel, PANEL_DDS3, &FrequencyDDS3Init); + f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); + f0_DDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); t1_2 = utc; - stat_zero(&stat_math1); stat_zero(&stat_ch2); @@ -903,20 +891,14 @@ if ((utc - t1_2) > SlopeTime2) { Slope_2 = stat_math1.slope; Beatslope_2 = stat_ch2.slope; - SetCtrlVal(CalcNPanel, CALCN_SLOPE, Beatslope_2); // frep positive step - double fDDS1 = FrequDDS1 + DeltakHz_2 * 1000; - printf("fDDS1 = %g\n", fDDS1); + double fDDS1 = f0_DDS1 + DeltakHz_2 * 1000; DDS4xAD9912_RampFrequency(&DDS4xAD9912,1, fDDS1, FREP_STEP_SIZE); - SetCtrlVal(MainPanel, PANEL_DDS1, fDDS1); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, fDDS1); // adjust DDS3 to keep beatnote within the bandpass filter. prediction - double fDDS3 = FrequencyDDS3Init - DeltakHz_2*1000*(-Sign1/Sign2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2); + double fDDS3 = f0_DDS3 - DeltakHz_2*1000*(-Sign1/Sign2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2); DeltaDDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); - printf("deltaDDS3 = %g\n", DeltaDDS3); - SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); // allow counter to settle @@ -937,12 +919,10 @@ } double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; - SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); double fDDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3) + 10000 - Ch2; DeltaDDS3 = DeltaDDS3 + 10000 - Ch2; - SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); // allow counter to settle @@ -973,15 +953,12 @@ n_2 = 0; // negative frequency step - double fDDS1 = FrequDDS1 - DeltakHz_2 * 1000; + double fDDS1 = f0_DDS1 - DeltakHz_2 * 1000; DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, fDDS1, FREP_STEP_SIZE); - SetCtrlVal(MainPanel, PANEL_DDS1, fDDS1); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, fDDS1); // adjust DDS3 to keep beatnote within the bandpass filter. prediction - double fDDS3 = FrequencyDDS3Init + DeltakHz_2*1000*(-Sign1/Sign2)*Ndiv*(Nu2)/(Nu1); + double fDDS3 = f0_DDS3 + DeltakHz_2*1000*(-Sign1/Sign2)*Ndiv*(Nu2)/(Nu1); DeltaDDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); - SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); // allow counter to settle @@ -1017,13 +994,9 @@ SetCtrlVal(CalcNPanel, CALCN_N, N_2); // back to nominal frequency - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1, FREP_STEP_SIZE); - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); - SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); - DDS4xAD9912_SetFrequency (&DDS4xAD9912, 2, FrequencyDDSBesInit); - SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init-Beatslope_2*(utc-t1_2)); - DDS4xAD9912_SetFrequency (&DDS4xAD9912, 3, FrequencyDDS3Init-Beatslope_2*(utc-t1_2) ); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3 - Beatslope_2 * (utc - t1_2)); t1_2 = 0.0; t2_2 = 0.0; @@ -1048,8 +1021,7 @@ case N_MEASUREMENT_INIT: // init - SetCtrlVal(MainPanel, 1, FrequDDS1); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); settling = 3; t1_3 = utc; @@ -1059,8 +1031,8 @@ f_beat_Sr_plus = f_beat_Sr_minus = 0.0; // record current DDS frequencies - FrequencyDDSBesInit = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); - FrequencyDDS3Init = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); + f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); + f0_DDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); // next step Measuring_3 += 1; @@ -1087,11 +1059,10 @@ t2_3 = utc; // frep positive step - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 + DeltakHz_3 * 1000); - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1 + DeltakHz_3 * 1000, FREP_STEP_SIZE); - // compensate with DDS3 to keep measured beatnote in counter box range - double fDDS3 = FrequencyDDS3Init + Sign1 * Sign3 * N3/N1 * Ndiv * DeltakHz_3 * 1000; - SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + DeltakHz_3 * 1000, FREP_STEP_SIZE); + + // adjust DDS3 to keep beatnote within the bandpass filter + double fDDS3 = f0_DDS3 + Sign1 * Sign3 * N3/N1 * Ndiv * DeltakHz_3 * 1000; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); // allow counter to settle @@ -1113,7 +1084,6 @@ // adjust DDS frequency to keep 55 MHz tracker oscillator locked double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; - SetCtrlVal(MainPanel, PANEL_DDS2, fDDS2); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); // allow counter to settle @@ -1144,11 +1114,10 @@ t3_3 = utc; // frep negative step - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1 - DeltakHz_3 * 1000); - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1 - DeltakHz_3 * 1000, FREP_STEP_SIZE); - // compensate with DDS3 to keep measured beatnote in counter box range - double fDDS3 = FrequencyDDS3Init - Sign1 * Sign3 * N3/N1 * Ndiv * DeltakHz_3 * 1000; - SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - DeltakHz_3 * 1000, FREP_STEP_SIZE); + + // adjust DDS3 to keep beatnote within the bandpass filter + double fDDS3 = f0_DDS3 - Sign1 * Sign3 * N3/N1 * Ndiv * DeltakHz_3 * 1000; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); // allow counter to settle @@ -1200,14 +1169,9 @@ n_3 = 0; // back to nominal frep - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1, FREP_STEP_SIZE); - // back to initial DDS3 frequency - SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init); - // back to initial DDS2 frequency - SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); // done Measuring_3 = N_MEASUREMENT_NONE; @@ -1223,7 +1187,6 @@ Sign1 = -1.0; else Sign1 = +1.0; - SetCtrlVal(MainPanel, PANEL_DDS1, Frequency1); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency1); Getsign1 = FALSE; SetCtrlVal(MainPanel, PANEL_SIGN1, Sign1); @@ -1242,7 +1205,6 @@ else Sign2 = +1.0; } - SetCtrlVal(MainPanel, PANEL_DDS1, Frequency2); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, Frequency2); Getsign2 = FALSE; SetCtrlVal(MainPanel, PANEL_SIGN2, Sign2); @@ -1254,7 +1216,6 @@ Sign3 = -1.0; else Sign3 = +1.0; - SetCtrlVal(MainPanel, PANEL_DDS3, Frequency3); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, Frequency3); Getsign3 = FALSE; SetCtrlVal(MainPanel, PANEL_SIGN3, Sign3); @@ -1338,7 +1299,6 @@ double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); double adj = 275000.0 - rollmean_ch4.mean; freq = freq + adj; - SetCtrlVal(MainPanel, PANEL_DDS2, freq); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, freq); logmsg("recenter ch4 to 275 kHz: DDS2 adjustment=%+3e", adj); } @@ -1348,7 +1308,6 @@ double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); double adj = 10000 - rollmean_ch2.mean; freq = freq + adj; - SetCtrlVal(MainPanel, PANEL_DDS3, freq); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); logmsg("recenter Hg beatnote (ch2) to 10 kHz: DDS3 adjustment=%+3e", adj); } @@ -1358,7 +1317,6 @@ double freq = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); double adj = 10000 - rollmean_ch3.mean; freq = freq + adj; - SetCtrlVal(MainPanel, PANEL_DDS3, freq); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); logmsg("recenter Sr beatnote (ch3) to 10 kHz: DDS3 adjustment=%+3e", adj); } @@ -1369,6 +1327,12 @@ rollmean_zero(&rollmean_ch4); } } + + // update DDS frequencies display + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); + SetCtrlVal(MainPanel, PANEL_DDS4, DDS4xAD9912.frequency[3]); // local time struct tm *ltime = localtime(&event.time.tv_sec); @@ -1662,10 +1626,10 @@ GetPanelAttribute(CalcNPanel, ATTR_VISIBLE, &visible); if (! visible) { measuring = MEASURING_N_Lo; + SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Lo"); SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_1); SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime1); SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, DeltakHz_1); - SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Lo"); SetCtrlVal(CalcNPanel, CALCN_SLOPE, 0.0); SetCtrlVal(CalcNPanel, CALCN_N, 0.0); DisplayPanel(CalcNPanel); @@ -1675,10 +1639,10 @@ GetPanelAttribute(CalcNPanel, ATTR_VISIBLE, &visible); if (! visible) { measuring = MEASURING_N_Hg; + SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Hg"); SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_2); SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime2); SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, DeltakHz_2); - SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Hg"); SetCtrlVal(CalcNPanel, CALCN_SLOPE, 0.0); SetCtrlVal(CalcNPanel, CALCN_N, 0.0); DisplayPanel(CalcNPanel); @@ -1688,10 +1652,10 @@ GetPanelAttribute(CalcNPanel, ATTR_VISIBLE, &visible); if (! visible) { measuring = MEASURING_N_Sr; + SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Sr"); SetCtrlVal(CalcNPanel, CALCN_INTEGRATIONTIME, DeltaT_3); SetCtrlVal(CalcNPanel, CALCN_SLOPETIME, SlopeTime3); SetCtrlVal(CalcNPanel, CALCN_DELTAFREQ, DeltakHz_3); - SetPanelAttribute(CalcNPanel, ATTR_TITLE, "Measure N_Sr"); SetCtrlVal(CalcNPanel, CALCN_SLOPE, 0.0); SetCtrlVal(CalcNPanel, CALCN_N, 0.0); DisplayPanel(CalcNPanel); @@ -1742,30 +1706,29 @@ switch (measuring) { case MEASURING_N_Lo: Measuring_1 = FALSE; - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); - SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); break; case MEASURING_N_Hg: Measuring_2 = FALSE; - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); - SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); - SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); break; case MEASURING_N_Sr: Measuring_3 = FALSE; - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); - DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, FrequDDS1, FREP_STEP_SIZE); - SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, FrequencyDDSBesInit); - SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); break; } + + // update DDS frequencies display + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); + SetCtrlVal(MainPanel, PANEL_DDS4, DDS4xAD9912.frequency[3]); + break; } return 0; @@ -1847,9 +1810,9 @@ { case EVENT_COMMIT: GetCtrlVal(MainPanel, PANEL_CHANGENDIV, &Ndiv); - FrequDDS1 = 880000000.0 / Ndiv; - SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1); - DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1); + f0_DDS1 = 880000000.0 / Ndiv; + SetCtrlVal(MainPanel, PANEL_DDS1, f0_DDS1); + DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); break; } return 0;