while(1)
{
a0 = adc_read(0); // read adc value at PA0
a1 = adc_read(1); // read adc value at PA1
a2 = adc_read(2);
a3 = adc_read(3);
a4 = adc_read(4);
// now display on lcd
itoa(a0, int_buffer, 10);
lcd_gotoxy(6,0);
lcd_puts(int_buffer);
itoa(a1, int_buffer, 10);
lcd_gotoxy(6,1);
lcd_puts(int_buffer);
_delay_ms(5);
/*itoa(a2, int_buffer, 10);
lcd_gotoxy(6,0);
lcd_puts(int_buffer);
_delay_ms(5);
itoa(a3, int_buffer, 10);
lcd_gotoxy(6,1);
lcd_puts(int_buffer);
_delay_ms(5);
itoa(a4, int_buffer, 10);
lcd_gotoxy(6,0);
lcd_puts(int_buffer);
_delay_ms(5);*/
if(a1 > 500 & a2 > 500 & a3 > 500)
{
PORTC|=(1<<PINC1);PORTC&=~(1<<PINC0);
PORTC|=(1<<PINC3);PORTC&=~(1<<PINC2);
_delay_ms(2);
break;
}else if(a0 > 500 & a1 > 500 & a2 > 500)
{
PORTC|=(1<<PINC0);PORTC&=~(1<<PINC1);
PORTC&=~(1<<PINC2);PORTC&=~(1<<PINC3);
_delay_ms(2);
break;
}
}
}