I'm writing code for a PIC18F46K22 using the C18 compiler. I want to write the value of an integer \$n\$ in ASCII over the USART to my PC.
For \$n<10\$, it's easy:
Write1USART(n + 0x30); // 0x30 = '0'
This would work for \$10\le{}n\le100\$:
Write1USART((n/10) + 0x30);
Write1USART((n%10) + 0x30);
But this isn't the fastest possible way, probably.
So is there a built-in function or a function somewhere out there that I could just use instead of rolling my own?