#define MF 38.9Na = Freq + MF;
MFcorr = MF - 15258
hi,this is the code:Code: [Select] #define MF 38.9Na = Freq + MF;When i run the software in the Nano, I see that the decimal MF is 38.9000015258 and not 38.9.how can i decrease this "15258" to 38.9i have tried to:Code: [Select]MFcorr = MF - 15258but not work welli appreciate all the helped
Simple: don't use floats. Use integer maths instead.Instead of using the actual value, use the "milli" value. For instance, instead of volts (3.2V) use millivolts (3200mV). Instead of degrees C (25.6 DegC), use milliDegrees C (25600 mDegC). Instead of Hz (143.2Hz) use milliHertz (143200mHz)...
When i run the software in the Nano, I see that the decimal MF is 38.9000015258 and not 38.9.how can i decrease this "15258" to 38.9
If the errors occur at random, we might expect a cumulative error of sqrt(N) ?m. However, if we are not vigilant in designing our numerical algorithms, these errors can propagate in very unfavorable and non-intuitive ways, leading to cumulative errors of N ?m or worse.
float Na;float Freq; int Nb; int Nc; int msb; int lsb;Na =Freq+MF;Nb =Na*Xtal;Nc =((INT)(Nb/256)) * 256;lsb =Nb-Nc;msb =(INT)(Nb/256);
When i adjust the frequency in steps (MHz or KHz) the following code i have made to calculate the HEX adress MSB and LSB.
the selected frequency = 1 MHz (also with a strange number at the end "1192")1.0000001192 = Freq
#define LB 0xA1 // Low frequency band 46.25 - 170 MHz = 0xA1 #define MB 0x91 // Mid frequency band Mid 170 - 450 MHz = 0x91 #define HB 0x31 // High frequency band High 450 - 860 MHz = 0x31
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16