标题: stm32HX711压力传感器程序 [打印本页]

作者: 3.355    时间: 2022-9-9 08:54
标题: 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();          //设置NVIC中断分组2:2位抢占优先级,2位响应优先级
  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. }
复制代码

Keil代码下载:
Keil代码.7z (187.57 KB, 下载次数: 43)





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1