1024手机基地看电影,午夜福利视频导航,国产精品福利在线一区,亚洲欧美日韩另类成人,在线观看午夜日本理论片,成年超爽免费网站,国产精品成人免费,精品动作一级毛片,成人免费观看网站,97精品伊人久久大香蕉

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 3045|回復(fù): 2
收起左側(cè)

stm32超聲波測(cè)距離的源碼 實(shí)測(cè),能顯示測(cè)量值

[復(fù)制鏈接]
ID:347063 發(fā)表于 2018-6-7 17:26 | 顯示全部樓層 |閱讀模式
實(shí)測(cè),能顯示測(cè)量值。


單片機(jī)源程序如下:
  1. #include "led.h"
  2. #include "sys.h"
  3. #include "LCD1602.h"
  4. #include "delay.h"
  5. #include "sys.h"
  6. #include "key.h"
  7. #include "usart.h"
  8. #include "exti.h"
  9. #include "timer.h"
  10. #include "UltrasonicWave.h"
  11. #include "stm32f10x.h"

  12. /*
  13. 1602 rs rw en B3 B4 B5
  14.                           DB0-DB7 B8-B15
  15. TRIG_PIN       A8      
  16. ECHO_PIN       A7         

  17. */
  18. int main(void)
  19. {
  20.         char DIS[2]={'c','m'};
  21.         char juli[9]={'d','i','s','t','a','n','c','e'};
  22.         //char DISTANCE[1]={'c','m'};
  23. // SystemInit();
  24.         delay_init(72);                  //延時(shí)初始化
  25.         NVIC_Configuration();
  26.         uart_init(9600);         //串口初始化
  27.         LED_Init();                            //LED端口初始化
  28.         KEY_Init();               //按鍵端口初始化
  29.         Timerx_Init(5000,14399);   //10Khz的計(jì)數(shù)頻率,計(jì)數(shù)到5000為500ms
  30.         UltrasonicWave_Configuration();               //對(duì)超聲波模塊初始化
  31.          LCD1602_InitPort();
  32.          lcd1602_init();
  33.         lcd1602_pos(0x80,0x81);
  34.         strdis((u8 *)juli);
  35.         lcd1602_pos(0xcB,0xcC);
  36.         strdis((u8 *)DIS);
  37.         while(1)
  38.         {
  39.                 //LED0=!LED0;
  40.                 UltrasonicWave_StartMeasure();                //開(kāi)始測(cè)距,發(fā)送一個(gè)>10us的脈沖,然后測(cè)量返回的高電平時(shí)間       
  41.                 delay_ms(1000);               
  42.                
  43.         }
  44. }

復(fù)制代碼

所有資料51hei提供下載:
STM32超聲波測(cè)距yuanban.rar (395.29 KB, 下載次數(shù): 93)


回復(fù)

使用道具 舉報(bào)

ID:379630 發(fā)表于 2018-7-27 14:44 | 顯示全部樓層
是用了stm32f103c8t6和OLED液晶屏的嗎
回復(fù)

使用道具 舉報(bào)

ID:364826 發(fā)表于 2018-7-30 12:50 | 顯示全部樓層
謝了,參考一下學(xué)超聲波
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表