|
@@ -28,7 +28,7 @@
|
|
#define ADC_BUFFER_ADDRESS ((uint16_t)(&ADC_Buffer))
|
|
#define ADC_BUFFER_ADDRESS ((uint16_t)(&ADC_Buffer))
|
|
|
|
|
|
// Suply voltage
|
|
// Suply voltage
|
|
-#define ADC_REF 3307
|
|
|
|
|
|
+#define ADC_REF 3306
|
|
// Normal K for current channel = 4095 * 10 (Ку ОУ) * 0.05 (Rш)
|
|
// Normal K for current channel = 4095 * 10 (Ку ОУ) * 0.05 (Rш)
|
|
#define ADC_DIV 2048
|
|
#define ADC_DIV 2048
|
|
#define ADC_DIV_H 1024
|
|
#define ADC_DIV_H 1024
|
|
@@ -37,6 +37,7 @@
|
|
#define ADC_ODIV_H 8190
|
|
#define ADC_ODIV_H 8190
|
|
// for shunt voltage calcuation
|
|
// for shunt voltage calcuation
|
|
#define ADC_ORES 32760
|
|
#define ADC_ORES 32760
|
|
|
|
+#define ADC_ORES_H 16380
|
|
#define ADC_OU_MUL 10
|
|
#define ADC_OU_MUL 10
|
|
#define ADC_OU_ZERO_DRIFT 41
|
|
#define ADC_OU_ZERO_DRIFT 41
|
|
// Input Voltage divider
|
|
// Input Voltage divider
|
|
@@ -236,8 +237,8 @@ uint16_t * ADC_GetValues(void) {
|
|
volt /= 8; // усредняем
|
|
volt /= 8; // усредняем
|
|
volt *= ADC_REF;
|
|
volt *= ADC_REF;
|
|
volt *= ADC_VOLT_K;
|
|
volt *= ADC_VOLT_K;
|
|
- volt += ADC_ODIV_H;
|
|
|
|
- volt /= ADC_ODIV;
|
|
|
|
|
|
+ volt += ADC_ORES_H;
|
|
|
|
+ volt /= ADC_ORES;
|
|
|
|
|
|
curr += 4;
|
|
curr += 4;
|
|
curr /= 8;
|
|
curr /= 8;
|
|
@@ -254,7 +255,7 @@ uint16_t * ADC_GetValues(void) {
|
|
компенсируем падение напряжения на нём. */
|
|
компенсируем падение напряжения на нём. */
|
|
shunt_volt += (ADC_OU_MUL/2);
|
|
shunt_volt += (ADC_OU_MUL/2);
|
|
shunt_volt /= ADC_OU_MUL;
|
|
shunt_volt /= ADC_OU_MUL;
|
|
- shunt_volt += (ADC_ORES/2);
|
|
|
|
|
|
+ shunt_volt += ADC_ORES_H;
|
|
shunt_volt /= ADC_ORES; // мВ на входе ОУ
|
|
shunt_volt /= ADC_ORES; // мВ на входе ОУ
|
|
volt -= shunt_volt; // получили напряжение на клемах
|
|
volt -= shunt_volt; // получили напряжение на клемах
|
|
} else {
|
|
} else {
|