# HG changeset patch # User Daniele Nicolodi # Date 1349864041 -7200 # Node ID b47b97cfd050f3f97e127dec3d8d28cb2f2d66ed # Parent 2e37910b28bca305dbc3c4a4d2bf0066550e6ba3 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. diff -r 2e37910b28bc -r b47b97cfd050 DDS_Fox.c --- 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); }