stm8L152c6 timer2_trigger如何使用?现在想用外部触发,来计量脉冲的个数。可就是不计数,很困惑! TIM2_DeInit();
/* Enable TIM2 clock */
//CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, ENABLE);
/* TIM2 counter enable */
TIM2_Cmd(ENABLE);
TIM2_TimeBaseInit(TIM2_Prescaler_1,TIM2_CounterMode_Up,TIM2_Period);
TIM2_SelectInputTrigger(TIM2_TRGSelection_ETRF);
TIM2_CounterModeConfig(TIM2_CounterMode_Up);
TIM2_ETRClockMode2Config(TIM2_ExtTRGPSC_DIV2,TIM2_ExtTRGPolarity_Inverted,2);
//TIM2_ETRConfig(TIM2_ExtTRGPSC_DIV2,TIM2_ExtTRGPolarity_Inverted,2); |