[TAG added] On May 31, 2011, at 12:42 AM, William Chops Westfield wrote: > > On May 31, 2011, at 12:17 AM, IV3YNB op. Matteo wrote: > >> the trouble now comes when I have to manage frequency value >> and get it in 32bit. >> >> The formula is M =3D (f0 * 2^32)/fc > > You'll have to re-arrange that formula to get this to work in most C > compilers (or most other languages), since most values of f0*2^32 will > exceed 32 bits... > > If Fc is 50MHz, you can do (f0 * (2^32/128) / (Fc/128) > (128 is the greatest common factor of 2^32 and 50e6) > More math tricks may be needed depending on the range and required > accuracy of f0, but the general principle is DON'T LET INTERMEDIATE > RESULTS EXCEED THE VARIABLE SIZE. > > BillW --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .