当前位置: 首页 > news >正文

遂宁建设机械网站建设单位企业锁登陆网站

遂宁建设机械网站,建设单位企业锁登陆网站,创意设计网站,绵阳做最好优化网站的PWM 输入模式 此模式是输入捕获模式的一个特例。其实现步骤与输入捕获模式基本相同#xff0c;仅存在以下不同之处#xff1a; 例如#xff0c;可通过以下步骤对应用于 TI1① 的 PWM 的周期#xff08;位于 TIMx_CCR1⑨ 寄存器中#xff09;和占空 比#xff08;位于 … PWM 输入模式  此模式是输入捕获模式的一个特例。其实现步骤与输入捕获模式基本相同仅存在以下不同之处   例如可通过以下步骤对应用于 TI1① 的 PWM 的周期位于 TIMx_CCR1⑨ 寄存器中和占空 比位于 TIMx_CCR2⑮ 寄存器中进行测量取决于 CK_INT① 频率和预分频器的值  ● IC1⑦ 与 IC2⑬ 两个信号被映射至同一个 TI1① 输入。  ● IC1⑦ 与 IC2⑬ 这两个信号在边沿处有效但极性相反。  ● 选择TI1FP 与 TI2FP 中的 TI1FP④ 信号作为触发输入(也可选择TI2FP)并将从模式控制器配置为复位模式。  ● 向 TIMx_CCMR1 寄存器中的 CC1S② 位写入 01,选择 TIMx_CCR1 的有效输入 TI1①。  ● 向 CC1P 位和 CC1NP③ 位写入 “0” 上升沿有效。选择 TI1FP1④ 的有效极性 : 上升沿有效用于 TIMx_CCR1⑨ 中捕获上升沿时的计数值 和 TIMx_CNT⑯ 计数器清零  ● 向 TIMx_CCMR1 寄存器中的 CC2S⑪ 位写入 10,选择 TIMx_CCR2 的有效输入 TI1①。  ● 向 CC2P 位和 CC2NP⑫ 位写入 “1” 下降沿有效。选择 TI1FP2 的有效极性 : 下降沿有效用于 TIMx_CCR2⑮ 中捕获下降沿时的计数值。  ● 选择有效触发输入向 TIMx_SMCR 寄存器中的 TS⑤ 位写入 101选择 TI1FP1。  ● 向 TIMx_SMCR 寄存器中的 SMS⑥ 位写入 100 , 将从模式控制器配置为复位模式。  ● 向 TIMx_CCER 寄存器中的 CC1E⑧ 位和 CC2E⑭ 位写入“1” , 使能捕获。  根据F103的库函数TIM_PWMIConfig()微调了数据手册中框图的位置关系. TIM_PWMIConfig函数 /* stm32f10x_tim.h 中宏定义 */ #define TIM_ICPolarity_Rising ((uint16_t)0x0000) #define TIM_ICPolarity_Falling ((uint16_t)0x0002)#define TIM_ICSelection_DirectTI ((uint16_t)0x0001) /*! TIM Input 1, 2, 3 or 4 is selected to be connected to IC1, IC2, IC3 or IC4, respectively */ #define TIM_ICSelection_IndirectTI ((uint16_t)0x0002) /*! TIM Input 1, 2, 3 or 4 is selected to be connected to IC2, IC1, IC4 or IC3, respectively. *//* stm32f10x_tim.c 中PWMIConfig定义 */ /*** brief Configures the TIM peripheral according to the specified* parameters in the TIM_ICInitStruct to measure an external PWM signal.* param TIMx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TIM peripheral.* param TIM_ICInitStruct: pointer to a TIM_ICInitTypeDef structure* that contains the configuration information for the specified TIM peripheral.* retval None*/ void TIM_PWMIConfig(TIM_TypeDef *TIMx, TIM_ICInitTypeDef *TIM_ICInitStruct) {uint16_t icoppositepolarity TIM_ICPolarity_Rising;uint16_t icoppositeselection TIM_ICSelection_DirectTI;/* Check the parameters */assert_param(IS_TIM_LIST6_PERIPH(TIMx));/*互补极性设置*//* Select the Opposite Input Polarity */if (TIM_ICInitStruct-TIM_ICPolarity TIM_ICPolarity_Rising){icoppositepolarity TIM_ICPolarity_Falling;}else{icoppositepolarity TIM_ICPolarity_Rising;}/*交叉通道设置*//* Select the Opposite Input */if (TIM_ICInitStruct-TIM_ICSelection TIM_ICSelection_DirectTI){icoppositeselection TIM_ICSelection_IndirectTI;}else{icoppositeselection TIM_ICSelection_DirectTI;}/*分别配置IC1,IC2通道*/if (TIM_ICInitStruct-TIM_Channel TIM_Channel_1){/* TI1 Configuration */TI1_Config(TIMx, TIM_ICInitStruct-TIM_ICPolarity, TIM_ICInitStruct-TIM_ICSelection,TIM_ICInitStruct-TIM_ICFilter);/* Set the Input Capture Prescaler value */TIM_SetIC1Prescaler(TIMx, TIM_ICInitStruct-TIM_ICPrescaler);/* TI2 Configuration */TI2_Config(TIMx, icoppositepolarity, icoppositeselection, TIM_ICInitStruct-TIM_ICFilter);/* Set the Input Capture Prescaler value */TIM_SetIC2Prescaler(TIMx, TIM_ICInitStruct-TIM_ICPrescaler);}else{/* TI2 Configuration */TI2_Config(TIMx, TIM_ICInitStruct-TIM_ICPolarity, TIM_ICInitStruct-TIM_ICSelection,TIM_ICInitStruct-TIM_ICFilter);/* Set the Input Capture Prescaler value */TIM_SetIC2Prescaler(TIMx, TIM_ICInitStruct-TIM_ICPrescaler);/* TI1 Configuration */TI1_Config(TIMx, icoppositepolarity, icoppositeselection, TIM_ICInitStruct-TIM_ICFilter);/* Set the Input Capture Prescaler value */TIM_SetIC1Prescaler(TIMx, TIM_ICInitStruct-TIM_ICPrescaler);} } TI1_Config 函数 /* 通道 1 配置*/ /*** brief Configure the TI1 as Input.* param TIMx: where x can be 1 to 17 except 6 and 7 to select the TIM peripheral.* param TIM_ICPolarity : The Input Polarity.* This parameter can be one of the following values:* arg TIM_ICPolarity_Rising* arg TIM_ICPolarity_Falling* param TIM_ICSelection: specifies the input to be used.* This parameter can be one of the following values:* arg TIM_ICSelection_DirectTI: TIM Input 1 is selected to be connected to IC1.* arg TIM_ICSelection_IndirectTI: TIM Input 1 is selected to be connected to IC2.* arg TIM_ICSelection_TRC: TIM Input 1 is selected to be connected to TRC.* param TIM_ICFilter: Specifies the Input Capture Filter.* This parameter must be a value between 0x00 and 0x0F.* retval None*/ static void TI1_Config(TIM_TypeDef *TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,uint16_t TIM_ICFilter) {uint16_t tmpccmr1 0, tmpccer 0;/* Disable the Channel 1: Reset the CC1E Bit */TIMx-CCER (uint16_t) ~((uint16_t)TIM_CCER_CC1E);tmpccmr1 TIMx-CCMR1;tmpccer TIMx-CCER;/* Select the Input and set the filter */tmpccmr1 (uint16_t)(((uint16_t) ~((uint16_t)TIM_CCMR1_CC1S)) ((uint16_t) ~((uint16_t)TIM_CCMR1_IC1F)));tmpccmr1 | (uint16_t)(TIM_ICSelection | (uint16_t)(TIM_ICFilter (uint16_t)4));if ((TIMx TIM1) || (TIMx TIM8) || (TIMx TIM2) || (TIMx TIM3) ||(TIMx TIM4) || (TIMx TIM5)){/* Select the Polarity and set the CC1E Bit */tmpccer (uint16_t) ~((uint16_t)(TIM_CCER_CC1P));tmpccer | (uint16_t)(TIM_ICPolarity | (uint16_t)TIM_CCER_CC1E);}else{/* Select the Polarity and set the CC1E Bit */tmpccer (uint16_t) ~((uint16_t)(TIM_CCER_CC1P | TIM_CCER_CC1NP));tmpccer | (uint16_t)(TIM_ICPolarity | (uint16_t)TIM_CCER_CC1E);}/* Write to TIMx CCMR1 and CCER registers */TIMx-CCMR1 tmpccmr1;TIMx-CCER tmpccer; } TI2_Config 函数 /* 通道2配置*/ /*** brief Configure the TI2 as Input.* param TIMx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TIM peripheral.* param TIM_ICPolarity : The Input Polarity.* This parameter can be one of the following values:* arg TIM_ICPolarity_Rising* arg TIM_ICPolarity_Falling* param TIM_ICSelection: specifies the input to be used.* This parameter can be one of the following values:* arg TIM_ICSelection_DirectTI: TIM Input 2 is selected to be connected to IC2.* arg TIM_ICSelection_IndirectTI: TIM Input 2 is selected to be connected to IC1.* arg TIM_ICSelection_TRC: TIM Input 2 is selected to be connected to TRC.* param TIM_ICFilter: Specifies the Input Capture Filter.* This parameter must be a value between 0x00 and 0x0F.* retval None*/ static void TI2_Config(TIM_TypeDef *TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,uint16_t TIM_ICFilter) {uint16_t tmpccmr1 0, tmpccer 0, tmp 0;/* Disable the Channel 2: Reset the CC2E Bit */TIMx-CCER (uint16_t) ~((uint16_t)TIM_CCER_CC2E);tmpccmr1 TIMx-CCMR1;tmpccer TIMx-CCER;tmp (uint16_t)(TIM_ICPolarity 4);/* Select the Input and set the filter */tmpccmr1 (uint16_t)(((uint16_t) ~((uint16_t)TIM_CCMR1_CC2S)) ((uint16_t) ~((uint16_t)TIM_CCMR1_IC2F)));tmpccmr1 | (uint16_t)(TIM_ICFilter 12);tmpccmr1 | (uint16_t)(TIM_ICSelection 8);if ((TIMx TIM1) || (TIMx TIM8) || (TIMx TIM2) || (TIMx TIM3) ||(TIMx TIM4) || (TIMx TIM5)){/* Select the Polarity and set the CC2E Bit */tmpccer (uint16_t) ~((uint16_t)(TIM_CCER_CC2P));tmpccer | (uint16_t)(tmp | (uint16_t)TIM_CCER_CC2E);}else{/* Select the Polarity and set the CC2E Bit */tmpccer (uint16_t) ~((uint16_t)(TIM_CCER_CC2P | TIM_CCER_CC2NP));tmpccer | (uint16_t)(TIM_ICPolarity | (uint16_t)TIM_CCER_CC2E);}/* Write to TIMx CCMR1 and CCER registers */TIMx-CCMR1 tmpccmr1;TIMx-CCER tmpccer; }
http://www.zqtcl.cn/news/101056/

相关文章:

  • 做设计常用的素材网站外贸平台销售
  • 建网站一般最低多少钱地方门户模板
  • 网站开发虚拟主机管理系统星巴克网络营销方式
  • phpnow 搭建网站网站建设一般怎么付款
  • 网站开发三剑客湖州市南浔区建设局网站
  • 江西专业的企业网站建设公司长沙做网站找哪家好
  • 国外互联网资讯网站南宁专业网站建设公司
  • 苏州新区做网站公司pc网站建设费用
  • 做影视网站需要多少钱2003网站建设
  • 河南智能网站建设哪家好重庆在建工程项目
  • 爱站网站长工具网站查看空间商
  • 网站营销活动页面制作wordpress 只显示一个主题
  • 电子网站建设怎么做秦皇岛网站制作公司
  • 网站建站模板样例平台推广怎么做
  • 网站建设首选亿企联盟做网站宣传有用吗
  • 网站建设公司行业苏州高端网站建设咨询
  • 电商平台网站开发过程江苏省建设科技发展中心网站简介
  • 空间租用 网站开发重庆手机网站推广资料
  • 新余 网站建设网站建设行业新闻
  • 做301网站打不开网上智慧团建网站
  • 四川省住房与城乡建设厅官方网站免费域名解析ip
  • 芜湖网站建设价格这么做网站原型图
  • 做传奇网站怎么弄的南京微网站开发
  • 网站建设基础教程人教版网站域名选择的原则
  • u盘做网站网站建设公司公司介绍
  • 嘉兴网站排名优化报windows wordpress 轻量级
  • html5网站开发方案海珠网站建设公
  • 津做网站建筑网课平台
  • 佛山制作手机网站汕头网站定制
  • 网站域名解释怎么做济南集团网站建设