cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L001J3 TIMER2 does not operate.

Sang hyeon Jeong
Associate II

Hi.

I have a problem using STM8L001J3.

TIMER2 does not operate.

void main(void)

{

CLK->CKDIVR = 0x00;

GPIO_Init(GPIOB, GPIO_Pin_3, GPIO_Mode_Out_PP_High_Fast);

TIM2_DeInit();

TIM2->CR1 = 0x01; // Counter enabled

TIM2->ARRH = 0x00;

TIM2->ARRL = 0x9E;

TIM2->PSCR = 0x01; // prescaler 1:2

TIM2->IER = 0x01; // Update interrupt enabled

enableInterrupts();

while(1);

}

INTERRUPT_HANDLER(TIM2_UPD_OVF_TRG_BRK_IRQHandler, 19)

{

  TIM2->SR1 &= 0xFE;

GPIOB->ODR ^= 0x08;

}

​I used it like the above code, but it does not work.

Please help me..

I am using STVD and IAR for program development. Thanks in advance.

0 REPLIES 0