2012-02-13 07:01 AM
Hi! I have a probem with a simple software that I've wrote to learn to use timers.
This is the code that I've used.&sharpinclude ''stm8l15x.h''main(){ TIM4_DeInit(); TIM4_TimeBaseInit(TIM4_Prescaler_2048, 200); TIM4_Cmd(ENABLE); GPIO_DeInit(GPIOC); GPIO_DeInit(GPIOE); GPIO_Init(GPIOC, GPIO_Pin_7,GPIO_Mode_Out_PP_High_Fast); GPIO_Init(GPIOE, GPIO_Pin_7,GPIO_Mode_Out_PP_High_Fast); while(1) { if (TIM4_GetCounter() == 0) GPIO_SetBits(GPIOC, GPIO_Pin_7); else GPIO_ResetBits(GPIOC, GPIO_Pin_7); if (TIM4_GetCounter() > 0) GPIO_SetBits(GPIOE, GPIO_Pin_7); else GPIO_ResetBits(GPIOE, GPIO_Pin_7); }}Practically the counter do not start, his value is stoped at 0x00.Can you help me? :)P.S.= Sorry for my bad english.... #timers-tim42012-02-16 08:47 AM
2012-02-16 03:10 PM
Now it works!! Thanks for your suggestion!!!! ;)