	if(!CONDVOL_Time_Flag)

void Test (void)
{
//...some codes here
	{	
		CONDVOL=1;		//start 10s timing + turn on 10VDC
		CONDVOL_Time_Flag=1;	//start 10s timer
		printf("Time start nown"); 
	}
	if(CONDVOL_Time>=400 && CONDVOL_Time_Flag)//10s due since voltage is on, read ADC now	
	{
		Head1_ADC=ADC_read(1);
		Head2_ADC=ADC_read(2);
		Head3_ADC=ADC_read(3);
		Head4_ADC=ADC_read(4);
		Head5_ADC=ADC_read(5);
		Head6_ADC=ADC_read(6);
		Head7_ADC=ADC_read(7);
		Head8_ADC=ADC_read(8);
		Head9_ADC=ADC_read(9);
		Head10_ADC=ADC_read(10);

		printf("Head #1&2: %u, %u n", Head1_ADC,Head2_ADC)  ;
		CONDVOL=0;		//10s timing expired, turn OFF 10VDC
		CycOut=1;		//turn off cylinder		
		CONDVOL_Time_Flag=0;	//reset timer flag	
	   	CONDVOL_Time=0;		//reset timer
		Start_Flag=0;		//READY for the next cycle
	}
}

int ADC_read(unsigned char ch)
{
	int ADC_result;
	if(ch==1) 
		ADC0CON2 = 0x40;	//Refin+/-, Ain1->AINCOM			   1000000
	else if(ch==2)	
		ADC0CON2 = 0x41;	//Refin+/-, Ain2->AINCOM			   1000001
	else if(ch==3)	
		ADC0CON2 = 0x42;	//Refin+/-, Ain3->AINCOM			   1000010
	else if(ch==4)	
		ADC0CON2 = 0x43;	//Refin+/-, Ain4->AINCOM			   1000011
	else if(ch==5)	
		ADC0CON2 = 0x44;	//Refin+/-, Ain5->AINCOM			   1000100
	else if(ch==6)	
		ADC0CON2 = 0x45;	//Refin+/-, Ain6->AINCOM			   1000101
	else if(ch==7)	
		ADC0CON2 = 0x46;	//Refin+/-, Ain7->AINCOM			   1000110
	else if(ch==8)	
		ADC0CON2 = 0x47;	//Refin+/-, Ain8->AINCOM			   1000111
	else if(ch==9)	
		ADC0CON2 = 0x48;	//Refin+/-, Ain9->AINCOM			   1001000
	else if(ch==10)	
		ADC0CON2 = 0x49;	//Refin+/-, Ain10->AINCOM			   1001001

	ADCMODE = 0x23;		// continuous conversion on Main channel on main channel

	while (! RDY0) {}

	ADCIN =   ADC0H*0x100 + ADC0M;    //Combine ADC data registers into one.
													  
	ADC_result=	ADCIN;

	RDY0 =0;                                          //Clear the ADC interrupt
 	return ADC_result;
}
