Fernando Silva

CW8/DemoBoard56F8357/ProcessorExpert - ADC code problem

Discussion created by Fernando Silva on Oct 5, 2007
Latest reply on Nov 14, 2007 by Pascal Irrle
I am having one problem in my code for ADC. My Events.c
#pragma interrupt called /* Comment this line if the appropriate 'Interrupt preserve registers' property */                         /* is set to 'yes' (#pragma interrupt saveall is generated before the ISR)      */void BTB_OnInterrupt(void){   ADCA__Enable();   ADCA__EnableEvent();}

void ADCA__OnEnd(void){ byte store;   word valores[8];   word threshold = 16384; //32768/2 (Max_ADC_Resolution_divided_by_two)   //==============================    Frac16  canal0,     canal1,     canal2,     canal3;      store = ADCA__GetValue16(valores);      canal0 = (Frac16)((long)valores[0] - 32768);   canal1 = (Frac16)((long)valores[1] - 32768);   canal2 = (Frac16)((long)valores[2] - 32768);   canal3 = (Frac16)((long)valores[3] - 32768);   if(canal0 < threshold)   {    led3_NegVal();   }   else   {    led5_NegVal();   }}

Nothing occur in leds 3 or five, i used ADCA__Measure() in IRQB, debug stop in Measure and not read values.... What my code error??? Some example of how use adc?? Thank you!