title: AtmelStudio ADC Output decimal value
body: <p>I have MCU ATMega16 and i doing digital voltmeter.
  I want to display decimal number on LCD display.
  This is my code:</p>
  
  <pre><code>#include &lt;avr/io.h&gt;
  #include &lt;util/delay.h&gt;
  #include "lcd.h"
  #include &lt;stdlib.h&gt;
  
      signed int temp = 0;
      double voltage = 0;
      char buffer[10];
  
  int main(void)
  {
      DDRD = 0b11111111;
      PORTD = 0b00000000;
      DDRB = 0b00001111;
      PORTB = 0b00000000;
  
      ADMUX = (0&lt;&lt;REFS1)|(1&lt;&lt;REFS0);
      ADCSRA |= (1&lt;&lt;ADEN)|(1&lt;&lt;ADATE)|(1&lt;&lt;ADIE)|(1&lt;&lt;ADPS2)|(1&lt;&lt;ADPS1)|(0&lt;&lt;ADPS0);  
  
      lcd_init(LCD_DISP_ON_CURSOR);
      _delay_ms(100);
      lcd_clrscr();
      lcd_home();
      lcd_puts("Voltage= ");
  
      while (1) 
      {   
          ADCSRA |= (1&lt;&lt;ADSC);
          while(ADCSRA &amp; (1&lt;&lt;ADSC));
          ADCSRA |= (1&lt;&lt;ADIF);
          temp = ADCW;
  
          if(temp &lt;= 0)
          {
              lcd_gotoxy(8, 0);
              lcd_puts("Null");
              _delay_ms(100);
          }
          else
          {
              voltage = (5.0 * temp * 5) / 1023;
  
              lcd_gotoxy(8, 0);
              sprintf(buffer, "%f", voltage);
              lcd_puts(buffer);
              _delay_ms(100);
          }
  }
  }
  </code></pre>
  
  <p>..and it works.
  if i measure the battery with 12.3 volts, then the programm will display on LCD value equals 12.31671. But, the programm displays decimal number because i changed project settings to works function "sprintf".
  How do i manually display decimal number on LCD display? Help please. I can't understand how to make it. If i return project settings to default and use "itoa" instead "sprintf", then programm will display a number 12. I need it, because i want to display value on 7 segment display in future.</p>