Skip to main content
Visitor II
August 8, 2009
Question

Help,can not enter into adc1 interrupt of stm8s105c4t6

  • August 8, 2009
  • 3 replies
  • 677 views
Posted on August 08, 2009 at 02:20

Help,can not enter into adc1 interrupt of stm8s105c4t6

    This topic has been closed for replies.

    3 replies

    cgha21Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:03

    Hello,Everyone:

    The ADC Init is like this:

    CLK_PCKENR2 |=0x08;

    ADC_CSR = 0x05; //ch0~ch5

    ADC_CR1 = 0x22; //f/4,CONT convertion

    ADC_CR2 = 0x08; //ALIGN right,scan mode

    //ADC_CR3 = 0x80; //enable data buff

    ADC_TDRL = 0xff; //disable the smitt of ch0~ch7

    ADC_CSR |= 0x20; //enable eoc int,

    ADC_CR1 |=0x01; //start convertion

    but the simulation using stlink can not enter into adc1 Interrupt handler,why? Can someone here help me, I'm using stvd4.12 and cosmic 16k verstion,thanks!

    chris

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:03

    Hi Chris,

    I think that you have missed to enable the general interrupt.

    Can you verify that this line exist in your code: _asm(''rim\n'');

    Regards

    mozra

    cgha21Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:04

    Thanks for your reply,but the reason is that i should set the adon bit twice,one for waking up,the other one for starting convertion.