comparison 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
comparison
equal deleted inserted replaced
44:2e37910b28bc 45:b47b97cfd050
287 OctetB=atoi(Rd.value1); 287 OctetB=atoi(Rd.value1);
288 OctetC=atoi(Rd.value2); 288 OctetC=atoi(Rd.value2);
289 OctetD=atoi(Rd.value3); 289 OctetD=atoi(Rd.value3);
290 OctetE=atoi(Rd.value4); 290 OctetE=atoi(Rd.value4);
291 OctetF=atoi(Rd.value5); 291 OctetF=atoi(Rd.value5);
292 FreqRead=(double)(1099511627776*OctetA +4294967296*OctetB +16777216*OctetC +65536*OctetD +256*OctetE +OctetF); 292 FreqRead = 1099511627776.0 * OctetA + 4294967296.0 * OctetB + 16777216.0 * OctetC + 65536.0 * OctetD + 256.0 * OctetE + 1.0 * OctetF;
293 FreqRead=(FreqRead*Param->Clock)/ pow(2,48); 293 FreqRead = FreqRead * Param->Clock / pow(2,48);
294 //sprintf(parsebuf,"%fMHz",FreqRead/1000000);
295 return(FreqRead); 294 return(FreqRead);
296 } 295 }
297 296
298 297
299 /************************ Fonction de communications TCP ******************/ 298 /************************ Fonction de communications TCP ******************/