Chullaa
Advanced Member level 4
Hi guys
i am very much biggner! Well i've started working with 16F877 adc modules..
bt i am confused abt the programming. how to set range of input from 0 to +5V and setting resolution...bla bla
could anyone please send me some simple programes in C. I am using PICC complier and Proteus 7.4 for circuit operation.
my work is attached!
long value;
void main()
{
setup_adc(ADC_CLOCK_INTERNAL);
setup_adc_ports(1);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
TRISB=0x00;
adcon0=0x81;
adcon1=0xCE;
// TODO: USER CODE!!
while(1)
{
set_adc_channel(0);
delay_ms(100);
PORTB = read_adc();
}
}
i am very much biggner! Well i've started working with 16F877 adc modules..
bt i am confused abt the programming. how to set range of input from 0 to +5V and setting resolution...bla bla
could anyone please send me some simple programes in C. I am using PICC complier and Proteus 7.4 for circuit operation.
my work is attached!
long value;
void main()
{
setup_adc(ADC_CLOCK_INTERNAL);
setup_adc_ports(1);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
TRISB=0x00;
adcon0=0x81;
adcon1=0xCE;
// TODO: USER CODE!!
while(1)
{
set_adc_channel(0);
delay_ms(100);
PORTB = read_adc();
}
}