
char hex_digit_to_ascii( unsigned char hex_digit )
{
   if( hex_digit < 0x0A )
   {
      // It must be 0-9
      return hex_digit + '0';
   }
   else if( hex_digit < 0x10 )
   {
      // It must be A-F
      return hex_digit + 'A' - 0x0A; 
   }
   else
   {
      // It is not a valid value for a single Hex digit!
      // You decide what action to take here!
   }
}