|
一個(gè)簡(jiǎn)單的超聲波程序,電平觸發(fā)式
單片機(jī)源程序如下:
- #include "led.h"
- #include "delay.h"
- #include "sys.h"
- #include "key.h"
- #include "usart.h"
- #include "exti.h"
- #include "timer.h"
- #include "UltrasonicWave.h"
- int main(void)
- {
- // SystemInit();
- delay_init(); //延時(shí)初始化
- NVIC_Configuration();
- uart_init(9600); //串口初始化
- LED_Init(); //LED端口初始化
- KEY_Init(); //按鍵端口初始化
- Timerx_Init(5000,7199); //10Khz的計(jì)數(shù)頻率,計(jì)數(shù)到5000為500ms
- UltrasonicWave_Configuration(); //對(duì)超聲波模塊初始化
- while(1)
- {
- ……………………
- …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
自行設(shè)計(jì)stm32超聲波.rar
(307.44 KB, 下載次數(shù): 35)
2017-5-14 16:33 上傳
點(diǎn)擊文件名下載附件
|
評(píng)分
-
查看全部評(píng)分
|