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

大型门户网站后端logo一键生成器免费版下载

大型门户网站后端,logo一键生成器免费版下载,欧盟理事会,清风网站建设00. 目录 文章目录 00. 目录01. 定时器中断相关API1.1 TIM_InternalClockConfig1.2 TIM_TimeBaseInit1.3 TIM_TimeBaseInitTypeDef1.4 TIM_ClearFlag1.5 TIM_ITConfig1.6 TIM_Cmd1.7 中断服务函数1.8 TIM_ETRClockMode2Config 02. 定时器定时中断接线图03. 定时器定时中断示例0…00. 目录 文章目录 00. 目录01. 定时器中断相关API1.1 TIM_InternalClockConfig1.2 TIM_TimeBaseInit1.3 TIM_TimeBaseInitTypeDef1.4 TIM_ClearFlag1.5 TIM_ITConfig1.6 TIM_Cmd1.7 中断服务函数1.8 TIM_ETRClockMode2Config 02. 定时器定时中断接线图03. 定时器定时中断示例04. 定时器外部时钟接线图05. 定时器外部时钟示例06. 程序下载07. 附录 01. 定时器中断相关API 1.1 TIM_InternalClockConfig /*** brief Configures the TIMx internal Clock* param TIMx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15* to select the TIM peripheral.* retval None*/ void TIM_InternalClockConfig(TIM_TypeDef* TIMx) 功能:设置 TIMx 内部时钟 参数:TIMxx 可以是 23 或者 4来选择 TIM 外设 返回值:无 1.2 TIM_TimeBaseInit /*** brief Initializes the TIMx Time Base Unit peripheral according to * the specified parameters in the TIM_TimeBaseInitStruct.* param TIMx: where x can be 1 to 17 to select the TIM peripheral.* param TIM_TimeBaseInitStruct: pointer to a TIM_TimeBaseInitTypeDef* structure that contains the configuration information for the * specified TIM peripheral.* retval None*/ void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct) 功能:根据 TIM_TimeBaseInitStruct 中指定的参数初始化 TIMx 的时间基数单位 参数:TIMxx 可以是 23 或者 4来选择 TIM 外设TIMTimeBase_InitStruct指向结构 TIM_TimeBaseInitTypeDef 的指针包含了TIMx 时间基数单位的配置信息 返回值:无 1.3 TIM_TimeBaseInitTypeDef /** * brief TIM Time Base Init structure definition* note This structure is used with all TIMx except for TIM6 and TIM7. */typedef struct {uint16_t TIM_Prescaler; uint16_t TIM_CounterMode; uint16_t TIM_Period; uint16_t TIM_ClockDivision; uint8_t TIM_RepetitionCounter; } TIM_TimeBaseInitTypeDef; TIM_PeriodTIM_Period 设置了在下一个更新事件装入活动的自动重装载寄存器周期的值。它的取值必须在0x0000和0xFFFF之间。 TIM_PrescalerTIM_Prescaler 设置了用来作为 TIMx 时钟频率除数的预分频值。它的取值必须在0x0000和0xFFFF之间。/** defgroup TIM_Counter_Mode * {*/ #define TIM_CounterMode_Up ((uint16_t)0x0000) #define TIM_CounterMode_Down ((uint16_t)0x0010) #define TIM_CounterMode_CenterAligned1 ((uint16_t)0x0020) #define TIM_CounterMode_CenterAligned2 ((uint16_t)0x0040) #define TIM_CounterMode_CenterAligned3 ((uint16_t)0x0060)/** defgroup TIM_Clock_Division_CKD * {*/ #define TIM_CKD_DIV1 ((uint16_t)0x0000) #define TIM_CKD_DIV2 ((uint16_t)0x0100) #define TIM_CKD_DIV4 ((uint16_t)0x0200)TIM_RepetitionCounter 只用在高级定时器中 1.4 TIM_ClearFlag /*** brief Clears the TIMxs pending flags.* param TIMx: where x can be 1 to 17 to select the TIM peripheral.* param TIM_FLAG: specifies the flag bit to clear.* This parameter can be any combination of the following values:* arg TIM_FLAG_Update: TIM update Flag* arg TIM_FLAG_CC1: TIM Capture Compare 1 Flag* arg TIM_FLAG_CC2: TIM Capture Compare 2 Flag* arg TIM_FLAG_CC3: TIM Capture Compare 3 Flag* arg TIM_FLAG_CC4: TIM Capture Compare 4 Flag* arg TIM_FLAG_COM: TIM Commutation Flag* arg TIM_FLAG_Trigger: TIM Trigger Flag* arg TIM_FLAG_Break: TIM Break Flag* arg TIM_FLAG_CC1OF: TIM Capture Compare 1 overcapture Flag* arg TIM_FLAG_CC2OF: TIM Capture Compare 2 overcapture Flag* arg TIM_FLAG_CC3OF: TIM Capture Compare 3 overcapture Flag* arg TIM_FLAG_CC4OF: TIM Capture Compare 4 overcapture Flag* note* - TIM6 and TIM7 can have only one update flag. * - TIM9, TIM12 and TIM15 can have only TIM_FLAG_Update, TIM_FLAG_CC1,* TIM_FLAG_CC2 or TIM_FLAG_Trigger. * - TIM10, TIM11, TIM13, TIM14, TIM16 and TIM17 can have TIM_FLAG_Update or TIM_FLAG_CC1. * - TIM_FLAG_Break is used only with TIM1, TIM8 and TIM15. * - TIM_FLAG_COM is used only with TIM1, TIM8, TIM15, TIM16 and TIM17. * retval None*/ void TIM_ClearFlag(TIM_TypeDef* TIMx, uint16_t TIM_FLAG) 功能:清除 TIMx 的待处理标志位 参数:TIMxx 可以是 23 或者 4来选择 TIM 外设TIM_FLAG待清除的 TIM 标志位 返回值:无 1.5 TIM_ITConfig /*** brief Enables or disables the specified TIM interrupts.* param TIMx: where x can be 1 to 17 to select the TIMx peripheral.* param TIM_IT: specifies the TIM interrupts sources to be enabled or disabled.* This parameter can be any combination of the following values:* arg TIM_IT_Update: TIM update Interrupt source* arg TIM_IT_CC1: TIM Capture Compare 1 Interrupt source* arg TIM_IT_CC2: TIM Capture Compare 2 Interrupt source* arg TIM_IT_CC3: TIM Capture Compare 3 Interrupt source* arg TIM_IT_CC4: TIM Capture Compare 4 Interrupt source* arg TIM_IT_COM: TIM Commutation Interrupt source* arg TIM_IT_Trigger: TIM Trigger Interrupt source* arg TIM_IT_Break: TIM Break Interrupt source* note * - TIM6 and TIM7 can only generate an update interrupt.* - TIM9, TIM12 and TIM15 can have only TIM_IT_Update, TIM_IT_CC1,* TIM_IT_CC2 or TIM_IT_Trigger. * - TIM10, TIM11, TIM13, TIM14, TIM16 and TIM17 can have TIM_IT_Update or TIM_IT_CC1. * - TIM_IT_Break is used only with TIM1, TIM8 and TIM15. * - TIM_IT_COM is used only with TIM1, TIM8, TIM15, TIM16 and TIM17. * param NewState: new state of the TIM interrupts.* This parameter can be: ENABLE or DISABLE.* retval None*/ void TIM_ITConfig(TIM_TypeDef* TIMx, uint16_t TIM_IT, FunctionalState NewState) 功能:使能或者失能指定的 TIM 中断 参数:TIMxx 可以是 23 或者 4来选择 TIM 外设TIM_IT待使能或者失能的 TIM 中断源NewStateTIMx 中断的新状态 返回值:无 1.6 TIM_Cmd /*** brief Enables or disables the specified TIM peripheral.* param TIMx: where x can be 1 to 17 to select the TIMx peripheral.* param NewState: new state of the TIMx peripheral.* This parameter can be: ENABLE or DISABLE.* retval None*/ void TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState) 功能:使能或者失能 TIMx 外设 参数:TIMxx 可以是 23 或者 4来选择 TIM 外设NewState: 外设 TIMx 的新状态 返回值:无 1.7 中断服务函数 参考程序 void TIM2_IRQHandler(void) {if (TIM_GetITStatus(TIM2, TIM_IT_Update) SET){Num ;TIM_ClearITPendingBit(TIM2, TIM_IT_Update);} }1.8 TIM_ETRClockMode2Config /*** brief Configures the External clock Mode2* param TIMx: where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral.* param TIM_ExtTRGPrescaler: The external Trigger Prescaler.* This parameter can be one of the following values:* arg TIM_ExtTRGPSC_OFF: ETRP Prescaler OFF.* arg TIM_ExtTRGPSC_DIV2: ETRP frequency divided by 2.* arg TIM_ExtTRGPSC_DIV4: ETRP frequency divided by 4.* arg TIM_ExtTRGPSC_DIV8: ETRP frequency divided by 8.* param TIM_ExtTRGPolarity: The external Trigger Polarity.* This parameter can be one of the following values:* arg TIM_ExtTRGPolarity_Inverted: active low or falling edge active.* arg TIM_ExtTRGPolarity_NonInverted: active high or rising edge active.* param ExtTRGFilter: External Trigger Filter.* This parameter must be a value between 0x00 and 0x0F* retval None*/ void TIM_ETRClockMode2Config(TIM_TypeDef* TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter) 功能:配置TIMx外部时钟模式2 参数:TIMxx可以是23或者4来选择TIM外设TIM_ExtTRGPrescaler外部触发预分频TIM_ExtTRGPolarity外部时钟极性 ExtTRGFilter外部触发滤波器。该参数取值在0x0和0xF之间。 返回值:无 02. 定时器定时中断接线图 03. 定时器定时中断示例 timer.h #ifndef __TIMER_H__ #define __TIMER_H__#include stm32f10x.h // Device headervoid timer_init(void);#endif timer.c #include timer.hvoid timer_init(void) {TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;NVIC_InitTypeDef NVIC_InitStruct;//1. 开启时钟RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);//2. 开启定时器2内部时钟TIM_InternalClockConfig(TIM2);//3. 初始化定时器TIM_TimeBaseInitStruct.TIM_Period 10000 - 1;TIM_TimeBaseInitStruct.TIM_Prescaler 7200 - 1;TIM_TimeBaseInitStruct.TIM_ClockDivision TIM_CKD_DIV1;TIM_TimeBaseInitStruct.TIM_CounterMode TIM_CounterMode_Up;TIM_TimeBaseInitStruct.TIM_RepetitionCounter 0; //高级定时器使用TIM_TimeBaseInit(TIM2, TIM_TimeBaseInitStruct);//4. 清除中断标志TIM_ClearFlag(TIM2, TIM_FLAG_Update);//5. 使能中断TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);//6. 设置NVICNVIC_InitStruct.NVIC_IRQChannel TIM2_IRQn;NVIC_InitStruct.NVIC_IRQChannelCmd ENABLE ;NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority 1;NVIC_InitStruct.NVIC_IRQChannelSubPriority 1;NVIC_Init(NVIC_InitStruct);//7. 使能定时器TIM_Cmd(TIM2, ENABLE); }main.c #include stm32f10x.h#include delay.h #include oled.h #include timer.hint16_t num;int main(void){ //初始化OLED_Init();NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);timer_init();OLED_ShowString(1, 1, num:);while (1){OLED_ShowNum(1, 5, num, 5);}return 0;}void TIM2_IRQHandler(void){if (TIM_GetITStatus(TIM2, TIM_IT_Update) SET){num ;TIM_ClearITPendingBit(TIM2, TIM_IT_Update);}}04. 定时器外部时钟接线图 05. 定时器外部时钟示例 timer.h #ifndef __TIMER_H__ #define __TIMER_H__#include stm32f10x.h // Device headervoid timer_init(void);#endif timer.c #include timer.hvoid timer_init(void) {GPIO_InitTypeDef GPIO_InitStructure;TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;NVIC_InitTypeDef NVIC_InitStruct;//1. 开启时钟RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);GPIO_InitStructure.GPIO_Mode GPIO_Mode_IPU;GPIO_InitStructure.GPIO_Pin GPIO_Pin_0;GPIO_InitStructure.GPIO_Speed GPIO_Speed_50MHz;GPIO_Init(GPIOA, GPIO_InitStructure);//2. 配置TIMx外部时钟模式2 TIM_ETRClockMode2Config(TIM2, TIM_ExtTRGPSC_OFF, TIM_ExtTRGPolarity_NonInverted, 0xf);//3. 初始化定时器TIM_TimeBaseInitStruct.TIM_Period 10 - 1;TIM_TimeBaseInitStruct.TIM_Prescaler 1 - 1;TIM_TimeBaseInitStruct.TIM_ClockDivision TIM_CKD_DIV1;TIM_TimeBaseInitStruct.TIM_CounterMode TIM_CounterMode_Up;TIM_TimeBaseInitStruct.TIM_RepetitionCounter 0; //高级定时器使用TIM_TimeBaseInit(TIM2, TIM_TimeBaseInitStruct);//4. 清除中断标志TIM_ClearFlag(TIM2, TIM_FLAG_Update);//5. 使能中断TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);//6. 设置NVICNVIC_InitStruct.NVIC_IRQChannel TIM2_IRQn;NVIC_InitStruct.NVIC_IRQChannelCmd ENABLE ;NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority 1;NVIC_InitStruct.NVIC_IRQChannelSubPriority 1;NVIC_Init(NVIC_InitStruct);//7. 使能定时器TIM_Cmd(TIM2, ENABLE); } main.c #include stm32f10x.h#include delay.h #include oled.h #include timer.hint16_t num;int main(void){ //初始化OLED_Init();NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);timer_init();OLED_ShowString(1, 1, num:);while (1){OLED_ShowNum(1, 5, num, 5);OLED_ShowNum(2, 5, TIM_GetCounter(TIM2), 5);}return 0;}void TIM2_IRQHandler(void){if (TIM_GetITStatus(TIM2, TIM_IT_Update) SET){num ;TIM_ClearITPendingBit(TIM2, TIM_IT_Update);}} 06. 程序下载 09-定时器定时中断.rar 10-定时器外部时钟.rar 07. 附录 参考: 【STM32】江科大STM32学习笔记汇总
http://www.zqtcl.cn/news/42695/

相关文章:

  • 做婚介打么网站好兼职网站项目建设报告(完整版)
  • 太原网站开发定制关于三亚的网页设计
  • 在做网站编代码网页导航条中的文字出现在导航条的下方怎莫解决长业建设集团有限公司网站
  • 内容管理系统做网站中国建设网建筑业信息服务平台
  • 商丘做网站的价格吉首网站建设
  • 设计网页制作策划路程哈尔滨百度seo代理
  • 潍坊网站收录seo公司 彼亿营销
  • 网站建设app开发学习安居客官网入口
  • 新乡手机网站建设外国男男做暧暧视频网站
  • 湛江企业网站建设有哪些做海岛的网站
  • 江苏省张家港保税区建设厅网站wordpress分销平台
  • 域名备案需要网站吗海外推广营销
  • shopnc本地生活o2o网站源码网站怎么建设可以发图评论
  • 腾讯的网站建设用了多少钱wordpress多用户商城系统
  • 自己建立网站怎么建淘宝客没网站怎么做
  • 网站建设纟金手指下拉壹陆企业开发网站用什么技术
  • 网站建设技术课程设计市场调研公司是做什么业务的
  • 做网站怎么查看来访ip如何通过外链提高网站权重
  • 网站免费正能量软件下载网站黄页推广软件
  • 网站开发得花多少钱商城小程序制作流程
  • 如何从网站获取图片做全景图asp网站后台管理系统下载
  • 官方网站怎么建设的wordpress密码进入网站
  • 湛江h5建站Apache 两个wordpress
  • 可以刮刮卡的网站短视频营销策划方案范文
  • 建手机网站教程找人开发一个网站多少钱
  • 网站套餐表格模板重庆 网站建设大全福利
  • 广州做网站哪家好开发公司总工岗位职责
  • 国外网站加速神器有阿里云服务器 怎么做网站
  • 重庆制作网站开发app开发公司保靖网站建设
  • 国内视频网站域名郑州全网营销