cancel
Showing results for 
Search instead for 
Did you mean: 

Timer 1 Channel 1 Output compare mode: pin out doesn't work!

matteo2399
Associate
Posted on May 17, 2012 at 15:16

Hi guys,

I'm using STM8S207S6 44 pin microcontroller.

I need to use TIMER 1Channel 1 in output compare mode with pin output enable but pin doesn't work.

Iinitialize pin in output mode and TIMER 1 Channel 1 with ST driver library:

-

TIM1_TimeBaseInit(39,TIM1_COUNTERMODE_UP,0xFFFF,0);

----> Set TIMER 1 base time

-

TIM1_Cmd(ENABLE);

----> TIMER 1 enable

During machine cycle:

-

TIM1_OC1Init(TIM1_OCMODE_TOGGLE, TIM1_OUTPUTSTATE_ENABLE,TIM1_OUTPUTNSTATE_DISABLE, (u16)(time),TIM1_OCPOLARITY_LOW,TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_SET );

----> Set Togglemode

-

TIM1_ITConfig(TIM1_IT_CC1, ENABLE);

----> Enable OC TIMER 1 channel 1interrupt.

OC interrupt works but pin out doesn't change.

What is the problem?Can you help me?

Note: I use this sequence in timer 3 channel 1 too and all works better.

Thank you very much.

#stm8s-output-compare
0 REPLIES 0