Mercurial > hg > fxanalyse
changeset 179:75e37ba8c417
Fix real DDS frequency display
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Fri, 21 Feb 2014 18:38:45 +0100 |
parents | 03dcca7e5ba4 |
children | 8faada7e4faf |
files | FXAnalyse.c |
diffstat | 1 files changed, 38 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/FXAnalyse.c Fri Feb 21 18:38:45 2014 +0100 +++ b/FXAnalyse.c Fri Feb 21 18:38:45 2014 +0100 @@ -690,6 +690,7 @@ // set DDS1 to nominal frequency DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // record current DDS frequencies f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); @@ -714,6 +715,7 @@ // frep positive step DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_1, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // allow counter to settle settling = 3; @@ -732,6 +734,7 @@ double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2 + 275000 - Ch4); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); // allow counter to settle settling = 3; @@ -758,6 +761,7 @@ // frep negative step DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_1, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // allow counter to settle settling = 3; @@ -791,6 +795,8 @@ // back to nominal frep DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); // done Measuring_1 = N_MEASUREMENT_NONE; @@ -809,6 +815,7 @@ // set DDS1 to nominal frequency DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // record current DDS frequencies f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); @@ -838,12 +845,14 @@ // frep positive step double fDDS1 = f0_DDS1 + delta_f_lock_2; - DDS4xAD9912_RampFrequency(&DDS4xAD9912,1, fDDS1, FREP_STEP_SIZE); + DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, fDDS1, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // adjust DDS3 to keep beatnote within the bandpass filter. prediction double fDDS3 = f0_DDS3 + Sign1 * Sign2 * N2/N1 * Ndiv * delta_f_lock_2; df_DDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); // allow counter to settle settling = 3; @@ -862,10 +871,12 @@ double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); double fDDS3 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3) + 10000 - Ch2; df_DDS3 = df_DDS3 + 10000 - Ch2; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); // allow counter to settle settling = 3; @@ -895,11 +906,13 @@ // negative frequency step double fDDS1 = f0_DDS1 - delta_f_lock_2; DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, fDDS1, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // adjust DDS3 to keep beatnote within the bandpass filter. prediction double fDDS3 = f0_DDS3 - Sign1 * Sign2 * N2/N1 * Ndiv * delta_f_lock_2; df_DDS3 = fDDS3 - DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); // allow counter to settle settling = 3; @@ -941,6 +954,9 @@ DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); // done Measuring_2 = N_MEASUREMENT_NONE; @@ -959,6 +975,7 @@ // set DDS1 to nominal frequency DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // record current DDS frequencies f0_DDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2); @@ -995,10 +1012,12 @@ // frep positive step DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 + delta_f_lock_3, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // adjust DDS3 to keep beatnote within the bandpass filter double fDDS3 = f0_DDS3 + Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); // allow counter to settle settling = 3; @@ -1018,6 +1037,7 @@ // adjust DDS frequency to keep 55 MHz tracker oscillator locked double fDDS2 = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, fDDS2); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); // allow counter to settle settling = 3; @@ -1046,10 +1066,12 @@ // frep negative step DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1 - delta_f_lock_3, FREP_STEP_SIZE); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); // adjust DDS3 to keep beatnote within the bandpass filter double fDDS3 = f0_DDS3 - Sign1 * Sign3 * N3/N1 * Ndiv * delta_f_lock_3; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); // allow counter to settle settling = 3; @@ -1103,6 +1125,9 @@ DDS4xAD9912_RampFrequency(&DDS4xAD9912, 1, f0_DDS1, FREP_STEP_SIZE); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, f0_DDS2); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, f0_DDS3); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); // done Measuring_3 = N_MEASUREMENT_NONE; @@ -1231,6 +1256,7 @@ double adj = 275000.0 - rollmean_ch4.mean; freq = freq + adj; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, freq); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); logmsg("recenter ch4 to 275 kHz: DDS2 adjustment=%+3e", adj); } @@ -1240,6 +1266,7 @@ double adj = 10000 - rollmean_ch2.mean; freq = freq + adj; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); logmsg("recenter Hg beatnote (ch2) to 10 kHz: DDS3 adjustment=%+3e", adj); } @@ -1249,6 +1276,7 @@ double adj = 10000 - rollmean_ch3.mean; freq = freq + adj; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, freq); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); logmsg("recenter Sr beatnote (ch3) to 10 kHz: DDS3 adjustment=%+3e", adj); } @@ -1259,12 +1287,6 @@ } } - // 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); // round to milliseconds @@ -1335,15 +1357,19 @@ switch (control) { case PANEL_DDS1: DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); break; case PANEL_DDS2: DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); break; case PANEL_DDS3: DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); break; case PANEL_DDS4: DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); + SetCtrlVal(MainPanel, PANEL_DDS4, DDS4xAD9912.frequency[3]); break; } break; @@ -1723,17 +1749,14 @@ switch (control) { case PANEL_FIND275K2: - GetCtrlVal(MainPanel, PANEL_DDS2, &frequency); - frequency = frequency + 275000 - Ch4; - SetCtrlVal(MainPanel, PANEL_DDS2, frequency) ; + frequency = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 2) + 275000 - Ch4; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency); + SetCtrlVal(MainPanel, PANEL_DDS2, DDS4xAD9912.frequency[1]); break; - case PANEL_FIND10K3: - GetCtrlVal(MainPanel, PANEL_DDS3, &frequency); - frequency = frequency + 10000 - Ch2; - SetCtrlVal(MainPanel, PANEL_DDS3, frequency); + frequency = DDS4xAD9912_GetFrequency(&DDS4xAD9912, 3) + 10000 - Ch2; DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); + SetCtrlVal(MainPanel, PANEL_DDS3, DDS4xAD9912.frequency[2]); break; } break; @@ -1749,8 +1772,8 @@ case EVENT_COMMIT: GetCtrlVal(MainPanel, PANEL_CHANGENDIV, &Ndiv); f0_DDS1 = 880000000.0 / Ndiv; - SetCtrlVal(MainPanel, PANEL_DDS1, f0_DDS1); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, f0_DDS1); + SetCtrlVal(MainPanel, PANEL_DDS1, DDS4xAD9912.frequency[0]); break; } return 0;