亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码

標題: STM32F4正交解碼編碼器源碼 [打印本頁]

作者: jiangzecui    時間: 2018-10-8 12:49
標題: STM32F4正交解碼編碼器源碼
STM32F4  正交解碼編碼器

單片機源程序:
  1. #include "sys.h"
  2. #include "ENCODER.h"



  3. //TIM5_CH1 ----- PA0
  4. //TIM5_CH2 ----- PA1

  5. void Encoder_Configuration(void)//編碼器模式
  6. {
  7.     GPIO_InitTypeDef gpio;
  8.    
  9.     RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOC,ENABLE);
  10.     RCC_APB1PeriphClockCmd( RCC_APB1Periph_TIM5|RCC_APB1Periph_TIM3 ,ENABLE);
  11.    
  12.     gpio.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
  13.     gpio.GPIO_Mode = GPIO_Mode_AF;
  14.     gpio.GPIO_OType = GPIO_OType_PP;
  15.     gpio.GPIO_PuPd = GPIO_PuPd_NOPULL;
  16.     gpio.GPIO_Speed = GPIO_Speed_100MHz;
  17.    
  18.      GPIO_Init(GPIOA,&gpio);
  19.     gpio.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;       
  20.         GPIO_Init(GPIOC,&gpio);

  21.     GPIO_PinAFConfig(GPIOA, GPIO_PinSource0,  GPIO_AF_TIM5);
  22.     GPIO_PinAFConfig(GPIOA, GPIO_PinSource1,  GPIO_AF_TIM5);
  23.    
  24.         GPIO_PinAFConfig(GPIOC, GPIO_PinSource6,  GPIO_AF_TIM3);
  25.     GPIO_PinAFConfig(GPIOC, GPIO_PinSource7,  GPIO_AF_TIM3);
  26.        
  27.     TIM_EncoderInterfaceConfig(TIM5, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising);
  28.         TIM_EncoderInterfaceConfig(TIM3, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising);
  29.     TIM_Cmd(TIM5, ENABLE);
  30.                     TIM_Cmd(TIM3, ENABLE);
  31. }
復制代碼

所有資料51hei提供下載:
正交解碼編碼器.rar (479.76 KB, 下載次數: 124)







歡迎光臨 (http://www.denmoz.com/bbs/) Powered by Discuz! X3.1