Hello !! Am facing a problem while reading temperature sensor(LM35) values from ADC, My issue is Am getting values like 32.90,25.49... etc.., and I need to display those values using two 7 segment display, how can I display those(4 digit) values on two 7 segment displays. my code is
while(1)
{
unsigned int i;
temp[temp_pos++]=adc_read(); // reading average of 8 values
/* Read from adc channel 0 */
if(temp_pos==8)
temp_pos=0;
temp_avg1=0;
for(i=0;i<8;i++)
temp_avg1+=temp[i];
temp_avg1>>=3;
// divide by 8 to get avg of 8 values
temp_avg=temp_avg1;
tempC = (3.3*temp_avg*100)/1024.0;
segment1(tempC/10); // display 1st digit on segment1
_delay_cycles(2500000);
// delay 0.25 sec
segment2(tempC%10); // display 2nd digit on segment2
_delay_cycles(2500000);
// delay 0.25 sec
}
what changes should I make to get only 2 digit number from ADC.