Bläddra i källkod

直流控制板电压采集换电阻

liyi 1 år sedan
förälder
incheckning
257eb6af2e
2 ändrade filer med 6 tillägg och 4 borttagningar
  1. 2 2
      F030/Core/Inc/main.h
  2. 4 2
      F030/Core/Src/main.c

+ 2 - 2
F030/Core/Inc/main.h

@@ -15,8 +15,8 @@ extern "C" {
 
 #define     COUNT_BASE												(4096)
 
-#define 		ALL_RES														(501000)
-#define 		GATHER_RES												(1000)
+#define 		ALL_RES														(505000)
+#define 		GATHER_RES												(5000)
 
 #include "stm32f0xx_hal.h"
 

+ 4 - 2
F030/Core/Src/main.c

@@ -64,8 +64,10 @@ static void get_adc_val()
 	temp *=	ALL_RES;
 	temp /=	GATHER_RES;
 	temp /= 10.0;
-  if(temp > 50)
-		temp+=(500);
+//  if(temp > 50)
+//		temp+=(500);
+	if(temp < 500)
+		temp = 0;
 	tx_voltage.f_data = temp;
 
 }