Many common LCD displays support a mode which displays data in right-to-left order. This can be very useful when outputting numbers. To output a number, one can set the cursor position to the location of the last digit, select right-to-left mode, and do something like:
void out_number(unsigned int n, unsigned char digits, unsigned char pad)
lcd_dat(n % 10 + '0');
n /= 10;
} while(n && --digits);
This method will output a number using the specified number of digits and pad it with the indicated character. There's no need to pre-buffer the value as would be necessary using something like
printf; the digits are generated in the same order they are output.