標題: HX711壓力傳感器模塊驅動源碼(stm32f103ve) [打印本頁]

作者: lindq    時間: 2018-8-2 10:56
標題: HX711壓力傳感器模塊驅動源碼(stm32f103ve)
HX711 AD模塊

單片機源程序如下:

  1. #include "stm32f10x.h"         
  2. #include "./lcd/bsp_ili9341_lcd.h"
  3. #include <stdio.h>
  4. #include "delay.h"
  5. #include "usart.h"
  6. #include "hx711.h"
  7. #include "interface.h"



  8. ErrorStatus HSEStartUpStatus;

  9. /*******************************************************************************
  10. * Function Name  : main
  11. * Description    : Main program.
  12. * Input          : None
  13. * Output         : None
  14. * Return         : None
  15. *******************************************************************************/
  16. int main(void)
  17. {
  18.                 u32 weigh1;
  19.                 char disp_buff[200];
  20.                 float weigh2;
  21.                 #ifdef DEBUG
  22.                 debug();
  23.                 #endif

  24.         //液晶顯示初始化
  25.                 ILI9341_Init();
  26.                 ILI9341_GramScan (6);//顯示模式掃描
  27.                 LCD_SetFont(&Font8x16);//設置字體
  28.                 LCD_SetColors(RED,BLACK);//設置背景和字體顏色
  29.                 ILI9341_Clear(0,0,LCD_X_LENGTH,LCD_Y_LENGTH);        /* 清屏,顯示全黑 */
  30.         
  31.                 //------------???------------
  32.                 RCC_Configuration();
  33.                 GPIO_Configuration();
  34.                 USART_Configuration( );
  35.         
  36.     get_pizhong();
  37.                 while(1)
  38.                 {
  39.                         Delay_MS(1000);
  40.                         weigh2 = get_weight();
  41.                         weigh1 = weigh2/2;
  42.                         
  43.                         GPIO_SetBits(GPIOA,GPIO_Pin_11);               
  44.                         sprintf(disp_buff,"weight :%.10d",weigh1);
  45.                         ILI9341_DispString_EN( 20, 60, disp_buff );
  46.                 }
  47.                
  48. }


復制代碼

所有資料51hei提供下載:
壓力傳感器模塊.rar (319.85 KB, 下載次數(shù): 90)



作者: admin    時間: 2018-8-3 17:08
能補一下電路與說明嗎?
作者: lindq    時間: 2018-8-4 16:39
用的是壓力傳感器量程為5kg,測量精度為1g

QQ圖片20180804162721.png (14.07 KB, 下載次數(shù): 85)

QQ圖片20180804162721.png

作者: 深圳xyz1    時間: 2021-3-13 17:22
多謝分享!程序運行正常,可以顯示傳感器的數(shù)據(jù)。校準程序時要根據(jù)不同的傳感器修改K值!




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1