I pinched this from somewhere:
I use it to print a 64 bit value to the serial port, it works on evry value I've tried except for 10,000,000
Maths obviously isnt my thing, why doest this work?
Edit: Oh wait I sussedit, this is a frequency word word for a Si5351, the chip accepts 100'ths of a hz integer values, I was passing the conversion function above the hundredths of hz value, I didvided it by 100 first now it works Ok.
Code:
void LL2Serial(long long ll)
{
uint64_t xx = ll/1000000000ULL;
if (xx >0) Serial.print((long)xx);
Serial.println((long)(ll-xx*1000000000));
}
I use it to print a 64 bit value to the serial port, it works on evry value I've tried except for 10,000,000
Maths obviously isnt my thing, why doest this work?
Edit: Oh wait I sussedit, this is a frequency word word for a Si5351, the chip accepts 100'ths of a hz integer values, I was passing the conversion function above the hundredths of hz value, I didvided it by 100 first now it works Ok.
Last edited: