suvaraj
Member level 2
hi to all i,m using pic 16f873a and using ccs c compiler.in my project i am using AN0 pin for adc voltage measure.if 1v come means enable RBO,2v come means enable RB1.but i am not get the out put.
is this correct ?pls help me..
Code:
#include<pic.h>
#define led1 RB0
#define led2 RB1
void adc_init();
void adc_read();
void main()
{
TRISA=0xff;
TRISB=0x00;
adc_init();
while(1)
{
adc_read();
if(data>204)
{
RB0=1;
}
if(data>409)
{
RB1=1;
}
}//while
}//main
void adc_init()
{
ADCON0=0X01;
ADCON1=0X2F;
}
void adc_read()
{
GODONE=1;
data=ADRESH;
}
Use CODE tags when posting your code.
is this correct ?pls help me..
Last edited by a moderator: