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

QQ登錄

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

搜索
查看: 2909|回復(fù): 1
打印 上一主題 下一主題
收起左側(cè)

基于stm32f103超聲波測(cè)距模塊(LCD ili9341顯示)

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:378645 發(fā)表于 2018-7-24 19:35 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
基于stm32f103超聲波測(cè)距模塊(LCD顯示)

單片機(jī)源程序如下:
  1. #include "stm32f10x.h"
  2. #include "./usart/bsp_usart.h"       
  3. #include "./lcd/bsp_ili9341_lcd.h"
  4. #include "./flash/bsp_spi_flash.h"
  5. #include "interface.h"
  6. #include "UltrasonicCtrol.h"

  7. unsigned char tick_5ms = 0;//5ms計(jì)數(shù)器,作為主函數(shù)的基本周期
  8. char dispBuff[100];

  9. int main(void)
  10. {       
  11.         delay_init();       
  12.         GPIOCLKInit();
  13.         UltraSoundInit();
  14.        
  15.         //LCD 初始化
  16.         ILI9341_Init ();         

  17.         /* USART config */
  18.         USART_Config();  
  19.        
  20.        
  21.   ILI9341_GramScan ( 6 );
  22.         ILI9341_Clear(0,0,LCD_X_LENGTH,LCD_Y_LENGTH);        /* 清屏,顯示全黑 */
  23.        
  24.         while ( 1 )
  25.         {       
  26.                 tick_5ms++;
  27.                 if(tick_5ms >= 5)
  28.                 {
  29.                  GetDistanceDelay();
  30.                         tick_5ms = 0;       
  31.                 }
  32.                         /*使用c標(biāo)準(zhǔn)庫(kù)把變量轉(zhuǎn)化成字符串*/
  33.           sprintf(dispBuff,"juli : %.2d ",distance_cm);
  34.                 ILI9341_DispStringLine_EN(LINE(6),dispBuff);   //第六行顯示(dispBuff是字符串)
  35.                 Delayms(100);
  36.                
  37.         }
  38.                
  39. }

  40. /* ------------------------------------------end of file---------------------------------------- */

復(fù)制代碼

所有資料51hei提供下載:
基于stm32f103超聲波測(cè)距模塊(LCD顯示).rar (345.65 KB, 下載次數(shù): 107)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:572367 發(fā)表于 2019-6-27 16:05 | 只看該作者
請(qǐng)問(wèn)這個(gè)有電路連接圖嗎?
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

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

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

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