2012-03-08 11:57 AM
Hello,
I trymeasure
frequency
50-500Hz. I use STM8S-DISCOVERY KIT with STM8S105C6T6 and FWLib. Howinitiate
the appropriate
timer and
which port
to use
?#include ''stm8s_conf.h''
#include ''stm8s.h''
#include ''stm8s_it.h''
#include ''stm8s_tim1.h''
#include ''stm8s_gpio.h''
void
init(
void
);
void
GPIO_app_init(
void
);
void
TIM1_app_init(
void
);
main()
{
init();
enableInterrupts();
while
(1)
{
TIM1_SetCounter(5);
tim1freq = TIM1_GetCounter();
}
}
void
init(
void
)
{
GPIO_app_init();
TIM1_app_init();
return
;
}
void
GPIO_app_init(
void
)
{
}
void
TIM1_app_init()
{
TIM1_DeInit();
TIM1_TimeBaseInit(31, TIM1_COUNTERMODE_UP, 65535, 0)
TIM1_CounterModeConfig (TIM1_COUNTERMODE_UP);
//TIM1_ICInit(TIM1_CHANNEL_1,TIM1_ICPOLARITY_RISING,TIM1_ICSELECTION_DIRECTTI,TIM1_
2012-03-13 05:24 AM
2012-03-13 11:29 AM
In this way?
what
to do next
,to measure
frequency (50Hz- 500kHz)
.
void GPIO_app_init(void)
{
GPIO_DeInit(GPIOC);
GPIO_Init(GPIOC, GPIO_PIN_
1
, GPIO_MODE_IN_FL_NO_IT);
}