for(i=0;i<10;i++)
{
if(AD_wData[i]>max)
max=AD_wData[i];
m=i;
}
switch(m)
{
case 0: PORTB=0xfe; break;
case 1: PORTB=0xfd; break;
case 2: PORTB=0xfb; break;
case 3: PORTB=0xf7; break;
case 4: PORTB=0xef; break;
case 5: PORTB=0xdf; break;
case 6: PORTB=0xbf; break;
case 7: PORTB=0x7f; break;
case 8: PORTB=0xf0; break;
case 9: PORTB=0x0f; break;
}