Básicamente estoy haciendo un seguidor de linea, pero primero quise hacer una simulación en proteus para comprobar que sirviera, este es el codigo:
	
	
	
		
Pero cuando lo paso a proteus me aparece un error que dice [PIC18 ADC] PC=0x110A. ADC conversion started before \'wait\' time has expired following previous conversion or channel change. [U1]
Si alguno me pudiera ayudar a arreglar ese problema me ayudaría mucho ...
				
			
		Código:
	
	#include <18F47J53.h>
#device ADC=10
#FUSES NOWDT         //WDT disabled (enabled by SWDTEN bit)                    
#FUSES PLL3          //Divide by 3 (12 MHz oscillator input)            
#FUSES NOPLLEN       //PLL Disabled
#FUSES NOSTVREN      //stack overflow/underflow reset enabled                
#FUSES NOXINST       //Extended instruction set disabled            
#FUSES NOCPUDIV      //No CPU system clock divide         
#FUSES NOPROTECT     //Program memory is not code-protected          
#FUSES HSPLL         //HS oscillator, PLL enabled, HSPLL used by USB           
#FUSES SOSC_HIGH     //High Power T1OSC/SOSC circuit selected
#FUSES CLOCKOUT      //CLKO output enabled on the RA6 pin 
#FUSES NOFCMEN       //Fail-Safe Clock Monitor disabled
#FUSES NOIESO        //Two-Speed Start-up disabled
#FUSES WDT32768      //Watchdog Postscaler 1:32768
#FUSES DSWDTOSC_INT  //DSWDT uses INTOSC/INTRC as clock
#FUSES RTCOSC_INT    //RTCC uses INTRC as clock
#FUSES NODSBOR       //Zero-Power BOR disabled in Deep Sleep
#FUSES NODSWDT       //Deep Sleep Watchdog Timer Disabled
#FUSES DSWDT8192     //Deep Sleep Watchdog Postscaler: 1:8,192 (8.5 seconds)   
#FUSES NOIOL1WAY     //IOLOCK bit can be set and cleared
#FUSES ADC10         //ADC 10 or 12 Bit Select:12 - Bit ADC Enabed 
#FUSES MSSPMSK7      //MSSP 7 Bit address masking
#FUSES NOWPFP        //Write Protect Program Flash Page 0
#FUSES NOWPCFG       //Write/Erase last page protect Disabled
#FUSES WPDIS         //WPFP[5:0], WPEND, and WPCFG bits ignored 
#FUSES WPEND         //Start protection at page 0
#FUSES LS48MHZ       //Low Speed USB mode with 48 MHz System clock at 48 MHz USB CLKEN divide-by is set to 8 
#use delay(clock=48000000)
#pin_select U2TX=PIN_D2 //Selecciona hardware UART2
#pin_select U2RX=PIN_D3 //Selecciona hardware UART2
#define LOADER_END   0xFFF                        
#build(reset=LOADER_END+1, interrupt=LOADER_END+9)   //Protege posiciones de memoria desde la 0x0000 hasta la 0x1000   
#org 0, LOADER_END {}
#bit PLLEN = 0xf9b.6
#use  rs232(baud=9600,parity=N,UART1,bits=8,timeout=30)
/********************************************************/
/*------- Espacio para declaracion de constantes  ------*/
/********************************************************/
//!#define m_unoA  PIN_B4   // Pin controlador del motor 1
//!#define m_unoB  PIN_B5   // Pin controlador del motor 1
//!#define m_dosA  PIN_B6   // Pin controlador del motor 2
//!#define m_dosB  PIN_B7   // Pin controlador del motor 2
 
/********************************************************/
/*--- Espacio para declaracion de variables globales  --*/
/********************************************************/
unsigned int16 i,resolucion=100,SensorIzquierda,SensorDerecha;
/********************************************************/
/********************************************************/
/*-------------- Espacio para funciones  ---------------*/
/********************************************************/
#include <stdlib.h>
void sensores(void){
set_adc_channel(1);
delay_ms(2);
SensorDerecha=read_adc();
set_adc_channel(0);
delay_ms(2);
SensorIzquierda=read_adc();
}
/******************************************************************************/
/******************************************************************************/
/*--------------------- Espacio de codigo principal --------------------------*/
/******************************************************************************/ 
#zero_ram
void main(){
PLLEN = 1;          //Habilita PLL para generar 48MHz de oscilador*/\\ 
setup_adc_ports( sAN0 | sAN1,VSS_VDD );
 setup_adc(ADC_CLOCK_INTERNAL );
 setup_timer_2(T2_DIV_BY_16,149,1);
 setup_ccp4(CCP_PWM);
 setup_ccp5(CCP_PWM);
 setup_ccp6(CCP_PWM);
 setup_ccp7(CCP_PWM);
 for(;;){
 sensores();
 while(SensorIzquierda<resolucion && SensorDerecha<resolucion){
set_pwm4_duty(200);
set_pwm5_duty(0);
set_pwm6_duty(200);
set_pwm7_duty(0);
 sensores();
 }
   while(SensorIzquierda<resolucion && SensorDerecha>resolucion){
set_pwm4_duty(0);
set_pwm5_duty(0);
set_pwm6_duty(200);
set_pwm7_duty(0);
i=0;
sensores();
 }
 while(SensorIzquierda>resolucion && SensorDerecha<resolucion){
set_pwm4_duty(200);
set_pwm5_duty(0);
set_pwm6_duty(0);
set_pwm7_duty(0);
i=1;
sensores();
 }
 while(SensorIzquierda>resolucion && SensorDerecha>resolucion){
if(i==0){set_pwm4_duty(0);
set_pwm5_duty(0);
set_pwm6_duty(200);
set_pwm7_duty(0);
sensores();
 }
 if(i==1){
set_pwm4_duty(200);
set_pwm5_duty(0);
set_pwm6_duty(0);
set_pwm7_duty(0);
sensores();
 }
 }
//!set_pwm4_duty(1002);
//!set_pwm5_duty(0);
//!set_pwm6_duty(0);
//!set_pwm7_duty(0); 
//! 
 
 
}
}//end mainSi alguno me pudiera ayudar a arreglar ese problema me ayudaría mucho ...
 
   
				 
						 
 
		 
 
		 
			 
 
		 
 
		 
 
		 
 
		 
 
		