xairz
Newbie level 2
im having problem to light on led using irpd sensor . can anyone help how to make the led on . this is my coding . please . help me anyone :-(
your help means a lot to me
Code:
#include <16f877a.h>
#device adc=8
#use delay(clock=20000000)
#fuses hs,noprotect,nowdt,nolvp
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,parity=N)
#byte PORTa=5
#byte PORTb=6
#byte PORTC=7
#byte PORTd=8
#byte PORTe=9
void main()
{
int value1,value2;
//set_tris_b(0b00000000);
set_tris_d(0b00000000);
setup_port_a(ALL_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
do
{
set_adc_channel(0);
value1=read_adc();
//printf("read S %u",value1);
delay_ms(1000);
portd = value1;
set_adc_channel(1);
value2=read_adc();
//printf("read S %u",value2);
delay_ms(1000);
portd = value2;
if(value1 > 1)
{
output_high(pin_D7);
//delay_ms(1000);
}
else
{
output_low(pin_D6);
//delay_ms(1000);
//output_low(pin_D5);
}
}
while(1);
}
your help means a lot to me