stm32f10x_tim.h 函数库
void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct);
//时基单元配置
void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct);
void TIM_OC2Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct);
void TIM_OC3Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct);
void TIM_OC4Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct);
//PWM输出比较库函数,对应四个通道
void TIM_ICInit(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct);
//输入捕获通道初始化
void TIM_PWMIConfig(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct);
//PWMI模式配置,此模式可将在该函数中会快捷地将另一个通道初始化为“相反”的配置,如配置好了TI1FP1,会自动配置TI1FP2为相反的配置
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct);
//时基单元结构体配置
void TIM_OCStructInit(TIM_OCInitTypeDef* TIM_OCInitStruct);
//输出比较赋默认值
void TIM_ICStructInit(TIM_ICInitTypeDef* TIM_ICInitStruct);
//输入捕获赋默认值
void TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState);/
/开启定时器!
void TIM_ITConfig(TIM_TypeDef* TIMx, uint16_t TIM_IT, FunctionalState NewState);
//开启定时中断
void TIM_InternalClockConfig(TIM_TypeDef* TIMx);
//选择内部时钟源
void TIM_ITRxExternalClockConfig(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource);
//其他定时器作为时钟源,可用作级联
void TIM_TIxExternalClockConfig(TIM_TypeDef* TIMx, uint16_t TIM_TIxExternalCLKSource,
uint16_t TIM_ICPolarity, uint16_t ICFilter);
//TIx捕获通道作为时钟源
void TIM_ETRClockMode1Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity,
uint16_t ExtTRGFilter);
//外部时钟模式1
void TIM_ETRClockMode2Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler,
uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter);
//外部时钟模式2
void TIM_ETRConfig(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity,
uint16_t ExtTRGFilter);
//配置TIMx外部触发器(ETR)。
void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, uint16_t TIM_InputTriggerSource);
//选择输入触发器源
void TIM_EncoderInterfaceConfig(TIM_TypeDef* TIMx, uint16_t TIM_EncoderMode,
uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity);
//配置TIMx编码器接口。
void TIM_ARRPreloadConfig(TIM_TypeDef* TIMx, FunctionalState NewState);//自动重装器预装功能配置
void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, uint16_t TIM_SlaveMode);
//从模式执行命令选择
void TIM_SetCounter(TIM_TypeDef* TIMx, uint16_t Counter);
//设置TIMx计数器寄存器值(CNT)
void TIM_SetAutoreload(TIM_TypeDef* TIMx, uint16_t Autoreload);
//设置TIMx自动加载寄存器值(ARR)
void TIM_SetCompare1(TIM_TypeDef* TIMx, uint16_t Compare1);
void TIM_SetCompare2(TIM_TypeDef* TIMx, uint16_t Compare2);
void TIM_SetCompare3(TIM_TypeDef* TIMx, uint16_t Compare3);
void TIM_SetCompare4(TIM_TypeDef* TIMx, uint16_t Compare4);
//设置输出比较值函数,数字代表对应的通道(CCR)
uint16_t TIM_GetCapture1(TIM_TypeDef* TIMx);
uint16_t TIM_GetCapture2(TIM_TypeDef* TIMx);
uint16_t TIM_GetCapture3(TIM_TypeDef* TIMx);
uint16_t TIM_GetCapture4(TIM_TypeDef* TIMx);
//获取TIMx输入捕获值.数字代表对应的通道(CCR)
uint16_t TIM_GetCounter(TIM_TypeDef* TIMx);
//获取定时器计数值(CNT)
uint16_t TIM_GetPrescaler(TIM_TypeDef* TIMx);
//获取TIMx预分频器值(PSC)
ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, uint16_t TIM_IT);
//检查TIM中断是否发生,中断产生会更新中断标志位
void TIM_ClearITPendingBit(TIM_TypeDef* TIMx, uint16_t TIM_IT);
//清除更新中断标志位
高级控制定时器:
通用定时器:
基本定时器:
定时中断基本结构:
ps:以上均是引用江协stm32的学习资料