中级会员
 
- 积分
- 253
- 金钱
- 253
- 注册时间
- 2013-9-23
- 在线时间
- 44 小时
|
5金钱
我有一个需求,STM32H750 定时器3 初始化后 定时器处于停止状态, 用软件实现 定时器 的停止 复位 启动定时器。
同时定时器中断响应后,定时器停止状态,待软件再次启动定时器工作。反复过程。
void TIM3_Int_Init(u16 arr,u16 psc)
{
RCC->APB1LENR|=1<<1;
while((RCC->APB1LENR&(1<<1))==0);
TIM3->ARR=arr;
TIM3->PSC=psc;
TIM3->SMCR=0;
TIM3->DIER|=1<<0;
TIM3->CR1&=~(3<<5);
TIM3->CR1&=~(1<<4);
TIM3->CR1|=0x01; // 使能定时器
MY_NVIC_Init(1,3,TIM3_IRQn,2);
}
这个似乎初始化就启动定时器了,我需要初始化停止
用软件启动 停止 复位再启动, 中断溢出停止。 请教各位。
|
|