#include <stdio.h> void itoa_32bit(unsigned long value, char* str) { unsigned char i = 0; unsigned char j = 0; unsigned char temp; // Handle the case where the value is 0 if (value == 0) { str[0] = '0'; str[1] = '\0'; return; } // Convert the number to a string in reverse order while (value > 0) { str[i++] = (value % 10) + '0'; value /= 10; } // Null-terminate the string str[i] = '\0'; // Reverse the string to get the correct order for (j = 0; j < i / 2; j++) { temp = str[j]; str[j] = str[i - j - 1]; str[i - j - 1] = temp; } } int main() { char buffer[11]; // Buffer to hold the string (max 10 digits + null terminator) char buffer2[32]; char Output[32]; unsigned char Length = 0; unsigned long value = 700 * 15566; // Example 32-bit unsigned value itoa_32bit(value, buffer); Length = strlen(buffer); if ( Length == 5 ) { Output[0] = '0'; Output[1] = '0'; Output[2] = ','; Output[3] = '0'; Output[4] = buffer[0]; Output[5] = 0x0; } else if ( Length == 6 ) { Output[0] = '0'; Output[1] = '0'; Output[2] = ','; Output[3] = buffer[0]; Output[4] = buffer[1]; Output[5] = 0x0; } else if ( Length == 7 ) { Output[0] = '0'; Output[1] = buffer[0]; Output[2] = ','; Output[3] = buffer[1]; Output[4] = buffer[2]; Output[5] = 0x0; } else if ( Length == 8 ) { Output[0] = buffer[0]; Output[1] = buffer[1]; Output[2] = ','; Output[3] = buffer[2]; Output[4] = buffer[3]; Output[5] = 0x0; } printf("%s",Output); return 0; }