tamer1221
Newbie level 5
adc pic16f877a
im using mikroc to program
unsigned temp ;
void main() {
temp=0;
TRISB = 0x00;
ADCON1 = 0x8E;
TRISA = 0xFF;
while(1) {
PORTB = 0x00;
temp = ADC_read(0);
delay_ms(50);
if(temp>40)
{
PORTB=0x00;
DELAY_MS(50);
PORTB=0xff;
DELAY_MS(50) ;
}
}
}
the problem is the led keep blinking even when 0 volt is applied to an0
im using mikroc to program
unsigned temp ;
void main() {
temp=0;
TRISB = 0x00;
ADCON1 = 0x8E;
TRISA = 0xFF;
while(1) {
PORTB = 0x00;
temp = ADC_read(0);
delay_ms(50);
if(temp>40)
{
PORTB=0x00;
DELAY_MS(50);
PORTB=0xff;
DELAY_MS(50) ;
}
}
}
the problem is the led keep blinking even when 0 volt is applied to an0