changeset 62:53dbce5f0745

Further simplification
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 29 Oct 2012 14:43:40 +0100
parents 37075b60408b
children 2320f5fc66aa
files FXAnalyse.c
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/FXAnalyse.c	Thu Oct 18 12:24:31 2012 +0200
+++ b/FXAnalyse.c	Mon Oct 29 14:43:40 2012 +0100
@@ -68,7 +68,7 @@
 int Measuring_2 = FALSE;											  
 int Measuring_3 = FALSE;
 
-double FrequDDS1=110000000.0, FrequDDS2=15300000.0, FrequDDS3=150400000.0, FrequDDS4=110000000.0;
+double FrequDDS1=110000000.0, FrequDDS4=110000000.0;
 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;
 
@@ -892,11 +892,13 @@
 							DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, FrequDDS1, fDDS1, Step2/Ndiv);
 							SetCtrlVal(MainPanel, PANEL_DDS1, fDDS1);
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, fDDS1);
+							
 							// adjust DDS3 to keep beatnote within the bandpass filter. prediction
-							DeltaDDS3 = -DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2);
+							double fDDS3 = FrequencyDDS3Init - DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1) - Beatslope_2*(utc-t1_2);
+							DeltaDDS3 = fDDS3 - DDS4xAD9912.Frequency3;
 							printf("deltaDDS3 = %g\n", DeltaDDS3);
-							SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init + DeltaDDS3);
-							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, FrequencyDDS3Init + DeltaDDS3);
+							SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3);
+							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
 						
 							// allow counter to settle
 							settling = 3;
@@ -952,10 +954,13 @@
 							n_2 = 0;
 
 							// negative frequency step
-							DDS4xAD9912_FrequencyRampe(&DDS4xAD9912,1, (FrequDDS1+DeltakHz_2*1000),(FrequDDS1-DeltakHz_2*1000), Step2/Ndiv);
-							SetCtrlVal(MainPanel, PANEL_DDS1, (FrequDDS1-DeltakHz_2*1000));
-							DDS4xAD9912_SetFrequency(&DDS4xAD9912,1, (FrequDDS1-DeltakHz_2*1000));
-							double fDDS3 = FrequencyDDS3Init+DeltakHz_2*1000*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1);
+							double fDDS1 = FrequDDS1 - DeltakHz_2 * 1000;
+							DDS4xAD9912_FrequencyRampe(&DDS4xAD9912, 1, DDS4xAD9912.Frequency1, fDDS1, Step2/Ndiv);
+							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*(-Signe1/Signe2)*Ndiv*(Nu2)/(Nu1);
 							DeltaDDS3 = fDDS3 - DDS4xAD9912.Frequency3;
 							SetCtrlVal(MainPanel, PANEL_DDS3, fDDS3);
 							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, fDDS3);
@@ -995,11 +1000,9 @@
 							// back to nominal frequency
 							DDS4xAD9912_FrequencyRampe (&DDS4xAD9912, 1, FrequDDS1-DeltakHz_2*1000,FrequDDS1, Step2/Ndiv );
 							SetCtrlVal(MainPanel, PANEL_DDS1, FrequDDS1);
-							DDS4xAD9912_SetFrequency(&DDS4xAD9912,1,FrequDDS1);
-							Delay(0.1); 
+							DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, FrequDDS1);
 							SetCtrlVal(MainPanel, PANEL_DDS2, FrequencyDDSBesInit);  
 							DDS4xAD9912_SetFrequency (&DDS4xAD9912, 2, FrequencyDDSBesInit );
-							Delay(0.1); 
 							SetCtrlVal(MainPanel, PANEL_DDS3, FrequencyDDS3Init-Beatslope_2*(utc-t1_2));
 							DDS4xAD9912_SetFrequency (&DDS4xAD9912, 3, FrequencyDDS3Init-Beatslope_2*(utc-t1_2) );