單片機源程序如下:
- /**
- ******************************************************************************
- * @file main.c
- * @author fire
- * @version V1.0
- * @date 2013-xx-xx
- * @brief 串口中斷接收測試
- ******************************************************************************
-
- ******************************************************************************
- */
-
-
- #include "stm32f10x.h"
- #include "bsp_usart1.h"
- #include "stdio.h"
- #include "timer4_cap.h"
- #include "UltrasonicWave.h"
- #include "delay.h"
- /**
- * @brief 主函數
- * @param 無
- * @retval 無
- */
- int main(void)
- {
- unsigned char count=0;
- delay_init();
- /* USART1 配置模式為 115200 8-N-1,中斷接收 */
- USART1_Config();
-
- NVIC_Configuration();
-
- TIM4_Cap_Init(0xffff,72-1); //以1Mhz的頻率計數
- UltrasonicWave_Configuration();
-
- while(1)
- {
- switch(count)
- {case 0:UltrasonicWave_StartMeasure();
- count=1;
- break;
- case 1:UltrasonicWave_StartMeasure2();
- count=2;
- break;
- case 2:UltrasonicWave_StartMeasure3();
- count=0;
- break;
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
Avatar_UltrasonicWave.rar
(303.38 KB, 下載次數: 32)
2018-1-12 16:21 上傳
點擊文件名下載附件
|