two adc_read problem

General discussion on mikroC.
Post Reply
Author
Message
thinkpositivex23
Posts: 8
Joined: 01 Mar 2010 09:24

two adc_read problem

#1 Post by thinkpositivex23 » 12 Oct 2010 17:59

hello....
sorry i'm beginner in make a coding
i want to make two adc read by follow this coding

int TGSsens; // set variable name 'TGSsens' as TGS2600 sensor value
int temp = 0; // set variable name 'temp' as temperature value

void main()
{
ADCON0 = 0xFF;
TRISA = 0b11111111; // initialize Port A as IRsens pins

while(1) // create infinite loop
{

temp = ADC_Read(0); // Read from pin RA0
if ( temp >= 32 && temp < 48)
{
PortB.F6=1; // then RB6 will turn On

}
else
{ PortB.F6=0;} // if not RB6 off



TGSsens = ADC_Read(1); // Read from pin RA1
if ( TGSsens >= 205 && TGSsens < 52)
{
PortB.F6=1; // then RB6 will turn On

}
else
{ PortB.F6=0;} // if not RB6 off

}

but....while adc read at RA1, its not happen as well..
can other solve it.......

Post Reply

Return to “mikroC General”