基于stm32f103的hx711的稱重程序
單片機源程序如下:
- /************************************************************************************
-
- *************************************************************************************/
- #include "stm32f10x.h"
- #include "delay.h"
- #include "HX711.h"
- #include "usart.h"
- int main(void)
- {
- Init_HX711pin();
- delay_init();
-
- NVIC_Configuration(); //設置NVIC中斷分組2:2位搶占優先級,2位響應優先級
- uart_init(9600); //串口初始化為9600
-
- Get_Maopi(); //稱毛皮重量
- delay_ms(1000);
- delay_ms(1000);
- Get_Maopi(); //重新獲取毛皮重量
-
- while(1)
- {
- Get_Weight();
- printf("凈重量 = %d g\r\n",Weight_Shiwu); //打印
- delay_ms(1000);
- }
- }
復制代碼
Keil代碼下載:
Keil代碼.7z
(187.57 KB, 下載次數: 43)
2022-9-9 14:07 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|