標(biāo)題:
STM32增量式編碼器例程
[打印本頁(yè)]
作者:
liyan1111
時(shí)間:
2018-6-22 16:59
標(biāo)題:
STM32增量式編碼器例程
基于STM32增量式編碼器程序
單片機(jī)源程序如下:
/**
******************************************************************************
* @file main.c
* @author hb.wang
* @version V1.0
* @date 2015-02-xx
* @brief 用3.5.0版本庫(kù)建的工程模板
*/
#include <stm32f10x.h>
#include <string.h>
#include "my_usart.h"
#include "pc_cmd.h"
#include "enc.h"
#include "timer.h"
#include "iwdg.h"
extern pc_cmd_t pc_cmd;
__IO u8 XXX[4] ;
/**
* @brief 主函數(shù)
* @param 無(wú)
* @retval 無(wú)
*/
int main(void)
{
// RCC_ClocksTypeDef RCC_CLKS_Structure;
// RCC_GetClocksFreq(RCC_ClocksTypeDef* );
// USART1_Config(19200);
// USART2_Config(19200);
// USART3_Config(19200);
// IWDG_Init(4,625); //與分頻數(shù)為64,重載值為625,溢出時(shí)間為1s
ENCODER_GPIO_Config();/** encoder GPIO_Config ???GPIO?? **/
TIM3_Init(); //0.1Sec ??????????????
Encoder_Init();
while(1)
{
IWDG_Feed();
Get_Encoder_Distance();
/* add your code here ^_^. */
}
}
/*********************************************END OF FILE**********************/
復(fù)制代碼
所有資料51hei提供下載:
STM32增量式編碼器.rar
(338.82 KB, 下載次數(shù): 55)
2018-6-22 17:00 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
wangcongliang
時(shí)間:
2019-1-17 20:33
請(qǐng)問(wèn)有具體的程序思路和仿真提供嗎?感覺(jué)光看程序有點(diǎn)難以消化啊,
謝謝!
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1