diff DDS_Fox.c @ 45:b47b97cfd050

Fix output frequency read back in DDS Fox driver The FTW registry value was read back wrong due to an integer overflow in the conversion from bytes string to double. This should fix the "jumps" seen in the application of the frequency dedrifting.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Wed, 10 Oct 2012 12:14:01 +0200
parents e45d6e9544f5
children 7ab3fb870ef8
line wrap: on
line diff
--- a/DDS_Fox.c	Tue Oct 09 14:36:10 2012 +0200
+++ b/DDS_Fox.c	Wed Oct 10 12:14:01 2012 +0200
@@ -289,9 +289,8 @@
 	OctetD=atoi(Rd.value3); 
 	OctetE=atoi(Rd.value4); 
 	OctetF=atoi(Rd.value5);
-	FreqRead=(double)(1099511627776*OctetA +4294967296*OctetB +16777216*OctetC +65536*OctetD +256*OctetE +OctetF);    
-	FreqRead=(FreqRead*Param->Clock)/ pow(2,48);
-	//sprintf(parsebuf,"%fMHz",FreqRead/1000000);
+	FreqRead = 1099511627776.0 * OctetA + 4294967296.0 * OctetB + 16777216.0 * OctetC + 65536.0 * OctetD + 256.0 * OctetE + 1.0 * OctetF;
+	FreqRead = FreqRead * Param->Clock / pow(2,48);
 	return(FreqRead);
 }