AnsweredAssumed Answered

ADC interrupt in cosmic

Question asked by nik.navid on Nov 16, 2016
Latest reply on Nov 24, 2016 by John7
Dear all
I tried to read  ADC1 channels in stm8 in cosmic compiler, but still I could not. as far as the main program start to config the ADC1 initialization nothing happen. I do not know what the problem is with interrupts. there is no error in builder. hex files came out.
void ADC_CONFIG(void)
{
    ADC1_DeInit();
    ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS, ADC1_CHANNEL_9,ADC1_PRESSEL_FCPU_D2, ADC1_EXTTRIG_GPIO, DISABLE,
    ADC1_ALIGN_RIGHT,
    ADC1_SCHMITTTRIG_CHANNEL9,DISABLE);
    ADC1_Cmd(ENABLE);
    ADC1_ITConfig(ADC1_IT_EOC, ENABLE);
    ADC1_StartConversion();
    enableInterrupts();
}
here is the configuration codes for ADC1. but unfortunately I can not see any result in interrupt function. the program has stopped here,


@interrupt void handleADCInt(void)
{
    GPIO_WriteHigh(GPIOD, GPIO_PIN_0);
    if(ADC1_GetFlagStatus(ADC1_FLAG_EOC) == SET)
    {
        prsc=ADC1_GetConversionValue();

        }
    ADC1_ClearFlag(ADC1_FLAG_EOC);
}
I have defined the interrupt function in vector file.
many thanks for your help

Outcomes