標(biāo)題: stm32HX711壓力傳感器程序 [打印本頁]

作者: 3.355    時間: 2022-9-9 08:54
標(biāo)題: stm32HX711壓力傳感器程序
基于stm32f103的hx711的稱重程序

單片機源程序如下:
  1. /************************************************************************************
  2.                                                 
  3. *************************************************************************************/
  4. #include "stm32f10x.h"
  5. #include "delay.h"
  6. #include "HX711.h"
  7. #include "usart.h"



  8. int main(void)
  9. {               
  10.         Init_HX711pin();
  11.         delay_init();
  12.         
  13.         NVIC_Configuration();          //設(shè)置NVIC中斷分組2:2位搶占優(yōu)先級,2位響應(yīng)優(yōu)先級
  14.         uart_init(9600);         //串口初始化為9600
  15.         
  16.         Get_Maopi();                                //稱毛皮重量
  17.         delay_ms(1000);
  18.         delay_ms(1000);
  19.         Get_Maopi();                                //重新獲取毛皮重量
  20.         
  21.         while(1)
  22.         {
  23.                 Get_Weight();

  24.                 printf("凈重量 = %d g\r\n",Weight_Shiwu); //打印
  25.                 delay_ms(1000);


  26.         }
  27. }
復(fù)制代碼

Keil代碼下載:
Keil代碼.7z (187.57 KB, 下載次數(shù): 43)





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