|
基于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
|
評(píng)分
-
查看全部評(píng)分
|