欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
STM32F4正交解碼編碼器源碼
[打印本頁(yè)]
作者:
jiangzecui
時(shí)間:
2018-10-8 12:49
標(biāo)題:
STM32F4正交解碼編碼器源碼
STM32F4 正交解碼編碼器
單片機(jī)源程序:
#include "sys.h"
#include "ENCODER.h"
//TIM5_CH1 ----- PA0
//TIM5_CH2 ----- PA1
void Encoder_Configuration(void)//編碼器模式
{
GPIO_InitTypeDef gpio;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOC,ENABLE);
RCC_APB1PeriphClockCmd( RCC_APB1Periph_TIM5|RCC_APB1Periph_TIM3 ,ENABLE);
gpio.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
gpio.GPIO_Mode = GPIO_Mode_AF;
gpio.GPIO_OType = GPIO_OType_PP;
gpio.GPIO_PuPd = GPIO_PuPd_NOPULL;
gpio.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(GPIOA,&gpio);
gpio.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_Init(GPIOC,&gpio);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource0, GPIO_AF_TIM5);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_TIM5);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource6, GPIO_AF_TIM3);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource7, GPIO_AF_TIM3);
TIM_EncoderInterfaceConfig(TIM5, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising);
TIM_EncoderInterfaceConfig(TIM3, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising);
TIM_Cmd(TIM5, ENABLE);
TIM_Cmd(TIM3, ENABLE);
}
復(fù)制代碼
所有資料51hei提供下載:
正交解碼編碼器.rar
(479.76 KB, 下載次數(shù): 124)
2018-10-8 13:16 上傳
點(diǎn)擊文件名下載附件
STM32F4 正交解碼編碼器
下載積分: 黑幣 -5
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1