Pablo Andres Lencinas

how to use the adc interrupt - MC68HC908MR

Discussion created by Pablo Andres Lencinas on Jan 16, 2009
Latest reply on Jan 21, 2009 by Ake Webjorn
hello micromans i need to use the adc interrupt but  is no working
this code would be to turn on the pta01 way do not work???
 
void init_adc(void){
 
ADSCR_ADCO=1;/*CONVERSION continua*/
ADSCR_ADCH0=1;/*ELIJO ATD1 PIN 63*/
ADSCR_ADCH1=0;
ADSCR_ADCH2=0;
ADSCR_ADCH3=0;
ADSCR_ADCH4=0;
ADCLK_ADIV2=1;/*ELIJO EL PRESCALER EN 8 PARA TENER APROX 0,5MHZ DE CLOCK DE ADC*/
ADCLK_ADIV1=0;/*8,9MHZ CRISTAL*/
ADCLK_ADIV0=0;
ADCLK_MODE1=0;/*ELIJO TRUNCAR A 8 BIT*/
ADCLK_MODE0=0;
ADSCR_AIEN=1;
}

void init_output(void){
DDRA=0b00000010;
}
 

interrupt 17 void lecturaadc(void)
{
  #pragma TRAP_PROC SAVE_REGS 
 ADC=ADRL;
 PTA_PTA1=1;     
}
 
 
Added p/n to subject


Message Edited by NLFSJ on 2009-01-26 09:26 AM

Outcomes