C Serial.printing a long long

Status
Not open for further replies.

dr pepper

Well-Known Member
Most Helpful Member
I pinched this from somewhere:

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:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…