your functions inttostring() and senddata() look OK
could your initalisation of the UART be incorrect? e.g. wrong baud rate?
try sending a string, e.g.
The routines may be ok.
But i'd avoid divisions in controllers, because they are slow.
I'd rather subtract 100 as long as value >= 100, count the loops for hundreds
Then subtract 10 as long as value >= 10, count the loops for tens,
Rest is ones
Convert integer to string (non-standard function)
Converts an integer value to a null-terminated string using the specified base and stores the result in the array given by str parameter.
- - - Updated - - -
I have never had problems using functions from <stdio.h> such as sprintf() with modern microcontrollers such as PIC24, dsPIC, PIC32, ARM7, ARM9, etc. It is often cheaper to move to a microcontroller with more program memory than paying an expensive programmer to write project specific code where a solution already exists.
Your code has a bug when number is 0. Will not return "0" but an empty string.
Of course this is not your problem. You have uart init error or hardware error and uart does not communicate properly.
The code you wrote do too many divisions, I suggest using this function in stead: