unsigned int read_a2d_dis(unsigned char channel)
{
unsigned int tempTab[5];
unsigned int i,j,temp;
temp = 0;
for(i = 0;i < 5;i ++)
{
tempTab[i] = Read_ADC_Temp(channel);
}
for(j=0;j<5;j++)
{
for (i=0;i<5-j;i++)
{
if (tempTab[i]>tempTab[i+1])
{
temp=tempTab[i];
tempTab[i]=tempTab[i+1];
tempTab[i+1]=temp;
}
}
}
return tempTab[2];
}
|