Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
起床就犯困 | ea6d12ca11 | |
起床就犯困 | c5ed140daf | |
起床就犯困 | c14165f58d | |
起床就犯困 | a418010b91 |
|
@ -69,8 +69,9 @@
|
|||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Peripheral/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/mppt_Nos_V0.4/App/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/mppt_Nos_V0.4/Hardware/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/mppt_Nos_V0.4/Drivers/RingQueue}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/mppt_Nos_V0.4/Drivers/TimeSliceOffset}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/mppt_Nos_V0.4/Drivers/RingQueue}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/mppt_Nos_V0.4/Drivers/RingQueue2}""/>
|
||||
</option>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.177116515" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"/>
|
||||
|
@ -123,9 +124,10 @@
|
|||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="Startup|Peripheral|Ld|Debug|Core" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="Drivers|Startup|Peripheral|Ld|Debug|Core" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Debug"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="Drivers"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Ld"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Peripheral"/>
|
||||
<entry excluding="startup_ch32v20x_D8.S|startup_ch32v20x_D8W.S" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
|
||||
|
@ -150,4 +152,5 @@
|
|||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
</cproject>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-156117377827207421" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1033085767641952736" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
float get_CHG_CURR(void);
|
||||
float get_PV_VOLT_OUT(void);
|
||||
float get_DSG_CURR(void);
|
||||
float get_PV1_VOLT_IN(void);
|
||||
float get_PV_VOLT_IN1(void);
|
||||
float get_PV_VOLT_IN(void);
|
||||
float get_SYS_VOLT_IN(void);
|
||||
float get_MOSFET_Temper(void);
|
||||
float get_PV2_VOLT_IN(void);
|
||||
//float get_PV2_VOLT_IN(void);
|
||||
|
||||
#endif /* APP_INC_COLLECT_CONVERSION_H_ */
|
||||
|
|
|
@ -15,13 +15,20 @@
|
|||
#include "uart_dev.h"
|
||||
#include <string.h>
|
||||
|
||||
#define ONLYPOWER 1
|
||||
//#define ONLYPOWER 1
|
||||
//#define CHG_CURR ADC_Channel_1
|
||||
//#define PV_VOLT_OUT ADC_Channel_2
|
||||
//#define DSG_CURR ADC_Channel_3
|
||||
//#define PV1_VOLT_IN ADC_Channel_4
|
||||
//#define PV_VOLT_IN1 ADC_Channel_5
|
||||
//#define MOSFET_Temper ADC_Channel_6
|
||||
//#define PV2_VOLT_IN ADC_Channel_7
|
||||
|
||||
#define CHG_CURR ADC_Channel_1
|
||||
#define PV_VOLT_OUT ADC_Channel_2
|
||||
#define DSG_CURR ADC_Channel_3
|
||||
#define PV1_VOLT_IN ADC_Channel_4
|
||||
#define PV_VOLT_IN1 ADC_Channel_5
|
||||
#define PV_VOLT_IN ADC_Channel_4
|
||||
#define SYS_VOLT_IN ADC_Channel_5
|
||||
#define MOSFET_Temper ADC_Channel_6
|
||||
#define PV2_VOLT_IN ADC_Channel_7
|
||||
|
||||
|
@ -29,24 +36,24 @@
|
|||
|
||||
#ifdef ONLYPOWER
|
||||
/* 光伏充电输出电流比例,放大倍数*电阻 */
|
||||
const float P_CHG_CURR = (1.0 / (50 * 0.005 / 2));
|
||||
const float P_CHG_CURR = ((1.0 / (50 * 0.005 / 2)) / 4095 * 2.5);
|
||||
/* 光伏充电输出电压比例,分压系数(放电时采集不准) */
|
||||
//const float P_PV_VOLT_OUT = (47.0 + 10.0) / 10.0;
|
||||
//const float P_PV_VOLT_OUT = (47.0 + 4.7) / 4.7;
|
||||
const float P_PV_VOLT_OUT = (56.0 + 10.0) / 10.0;
|
||||
//const float P_PV_VOLT_OUT = ((47.0 + 4.7) / 4.7 / 4095 * 2.5);
|
||||
const float P_PV_VOLT_OUT = ((56.0 + 10.0) / 10.0 / 4095 * 2.5);
|
||||
/* 放电电流采集电流倍数 */
|
||||
const float P_DSG_CURR = (1.0 / (50 * 0.005 / 2));
|
||||
const float P_DSG_CURR = ((1.0 / (50 * 0.005 / 2)) / 4095 * 2.5);
|
||||
///* 光伏1开路输出电压比例 */
|
||||
const float P_PV1_VOLT_IN = (100 + 4.7) / 4.7;
|
||||
const float P_PV1_VOLT_IN = ((100 + 4.7) / 4.7 / 4095 * 2.5);
|
||||
//const float P_PV1_VOLT_IN = (47.0 + 4.7) / 4.7;
|
||||
/* 光伏1开路输出电压比例 */
|
||||
//const float P_PV1_VOLT_IN = (47 + 4.7) / 4.7;
|
||||
/* 系统电源电压比例 */
|
||||
const float P_PV_VOLT_IN1 = (47 + 4.7) / 4.7;
|
||||
const float P_PV_VOLT_IN1 = ((47 + 4.7) / 4.7 / 4095 * 2.5);
|
||||
/* 温度采集比例 */
|
||||
//const float P_MOSFET_TEMPER = 0;
|
||||
/* 光伏2开路输出电压比例 */
|
||||
const float P_PV2_VOLT_IN = (100.0 + 4.7) / 4.7;
|
||||
const float P_PV2_VOLT_IN = ((100.0 + 4.7) / 4.7 / 4095 * 2.5);
|
||||
#endif
|
||||
|
||||
#ifndef ONLYPOWER
|
||||
|
@ -133,6 +140,8 @@ const uint16_t mosTemperADC[mosTemperADCLen] = {
|
|||
static uint16_t get_adc(uint8_t ADC_Channel);
|
||||
static uint16_t get_aftercalculationAdc(uint8_t ADC_Channel);
|
||||
static uint16_t middleAverageFilter(uint8_t ADC_Channel);
|
||||
static uint16_t get_adcDmaTim_middleAverageFilter(uint8_t ADC_Channel);
|
||||
static uint16_t Get_ConversionVal(int16_t val);
|
||||
|
||||
/**
|
||||
* @brief 获取计算后的adc的值
|
||||
|
@ -140,10 +149,92 @@ static uint16_t middleAverageFilter(uint8_t ADC_Channel);
|
|||
* @retval None
|
||||
*/
|
||||
uint16_t get_aftercalculationAdc(uint8_t ADC_Channel)
|
||||
{
|
||||
return get_adcDmaTim_middleAverageFilter(ADC_Channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 获取计算后的adc的值
|
||||
* @param ADC_Channel ADC通道
|
||||
* @retval None
|
||||
*/
|
||||
uint16_t get_aftercalculationAdc1(uint8_t ADC_Channel)
|
||||
{
|
||||
return middleAverageFilter(ADC_Channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 中位值平均滤波
|
||||
* @param ADC_Channel ADC通道
|
||||
* @retval None
|
||||
*/
|
||||
uint16_t get_adcDmaTim_middleAverageFilter(uint8_t ADC_Channel)
|
||||
{
|
||||
if (ADC_Channel == CHG_CURR) {
|
||||
return Get_ConversionVal(g_adcData.total_CHG_CURR / adcBuffSize);
|
||||
}
|
||||
|
||||
if (ADC_Channel == DSG_CURR) {
|
||||
return Get_ConversionVal(g_adcData.total_DSG_CURR / adcBuffSize);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
// uint16_t i,j,k;
|
||||
// uint16_t temp,sum = 0;
|
||||
// uint16_t value_buf[g_adcData.num];
|
||||
//
|
||||
// if (ADC_Channel == CHG_CURR) {
|
||||
// for(i = 0; i < g_adcData.num; ++i) {
|
||||
// value_buf[i] = g_adcData.CHG_CURR_array[i];
|
||||
// }
|
||||
//// } else if (ADC_Channel == PV_VOLT_OUT) {
|
||||
//// for(i = 0; i < g_adcData.num; ++i) {
|
||||
//// value_buf[i] = g_adcData.PV_VOLT_OUT_array[i];
|
||||
//// }
|
||||
// } else if (ADC_Channel == DSG_CURR) {
|
||||
// for(i = 0; i < g_adcData.num; ++i) {
|
||||
// value_buf[i] = g_adcData.DSG_CURR_array[i];
|
||||
// }
|
||||
//// } else if (ADC_Channel == PV_VOLT_IN) {
|
||||
//// for(i = 0; i < g_adcData.num; ++i) {
|
||||
//// value_buf[i] = g_adcData.PV_VOLT_IN_array[i];
|
||||
//// }
|
||||
//// } else if (ADC_Channel == SYS_VOLT_IN) {
|
||||
//// for(i = 0; i < g_adcData.num; ++i) {
|
||||
//// value_buf[i] = g_adcData.SYS_VOLT_IN_array[i];
|
||||
//// }
|
||||
//// } else if (ADC_Channel == MOSFET_Temper) {
|
||||
//// for(i = 0; i < g_adcData.num; ++i) {
|
||||
//// value_buf[i] = g_adcData.MOSFET_Temper_array[i];
|
||||
//// }
|
||||
// } else {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// /*从小到大冒泡排序*/
|
||||
// for(j = 0; j < g_adcData.num-1; ++j)
|
||||
// {
|
||||
// for(k = 0; k < g_adcData.num-j-1; ++k)
|
||||
// {
|
||||
// if(value_buf[k] > value_buf[k+1])
|
||||
// {
|
||||
// temp = value_buf[k];
|
||||
// value_buf[k] = value_buf[k+1];
|
||||
// value_buf[k+1] = temp;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for(i = 2; i < g_adcData.num - 2; ++i)
|
||||
// {
|
||||
// sum += value_buf[i];
|
||||
// }
|
||||
//
|
||||
// return sum / (g_adcData.num - 4);
|
||||
}
|
||||
|
||||
|
||||
#define N 6
|
||||
/**
|
||||
* @brief 中位值平均滤波
|
||||
|
@ -222,10 +313,12 @@ float get_CHG_CURR(void)
|
|||
|
||||
// I_ADC = Get_ConversionVal(get_adc(CHG_CURR));
|
||||
I_ADC = get_aftercalculationAdc(CHG_CURR);
|
||||
|
||||
// I_ADC = g_adcData.total_CHG_CURR / g_adcData.num;
|
||||
// I_ADC = get_adc(CHG_CURR);
|
||||
|
||||
// I = (float)(I_ADC) / 4095 * 3.3 * P_CHG_CURR * 2;
|
||||
I = (float)(I_ADC) / 4095 * 2.5 * P_CHG_CURR;
|
||||
I = (float)(I_ADC) * P_CHG_CURR;
|
||||
|
||||
// printf(" CHG_CURR I : %d /10000 \n", (int)(I * 10000));
|
||||
#ifdef enable_Printf_VI
|
||||
|
@ -247,10 +340,12 @@ float get_PV_VOLT_OUT(void)
|
|||
uint16_t V_ADC;
|
||||
|
||||
// V_ADC = Get_ConversionVal(get_adc(PV_VOLT_OUT));
|
||||
V_ADC = get_aftercalculationAdc(PV_VOLT_OUT);
|
||||
V_ADC = get_aftercalculationAdc1(PV_VOLT_OUT);
|
||||
// V_ADC = get_aftercalculationAdc(PV_VOLT_OUT);
|
||||
// V_ADC = g_adcData.total_PV_VOLT_OUT / g_adcData.num;
|
||||
// V_ADC = get_adc(PV_VOLT_OUT);
|
||||
|
||||
V = (float)(V_ADC) / 4095 * 2.5 * P_PV_VOLT_OUT;
|
||||
V = (float)(V_ADC) * P_PV_VOLT_OUT;
|
||||
//
|
||||
// char buffer[30];
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
|
@ -277,10 +372,12 @@ float get_DSG_CURR(void)
|
|||
|
||||
// I_ADC = Get_ConversionVal(get_adc(DSG_CURR));
|
||||
I_ADC = get_aftercalculationAdc(DSG_CURR);
|
||||
// I_ADC = g_adcData.total_DSG_CURR / g_adcData.num;
|
||||
// I_ADC = get_adc(DSG_CURR);
|
||||
|
||||
|
||||
// I = (float)(I_ADC) / 4095 * 3.3 * P_DSG_CURR * 2;
|
||||
I = (float)(I_ADC) / 4095 * 2.5 * P_DSG_CURR;
|
||||
I = (float)(I_ADC) * P_DSG_CURR;
|
||||
|
||||
#ifdef enable_Printf_VI
|
||||
printf("\n DSG_CURR ADC : %d \n", I_ADC);
|
||||
|
@ -295,19 +392,20 @@ float get_DSG_CURR(void)
|
|||
* @param
|
||||
* @retval V 电压值
|
||||
*/
|
||||
float get_PV1_VOLT_IN(void)
|
||||
float get_PV_VOLT_IN(void)
|
||||
{
|
||||
float V;
|
||||
uint16_t V_ADC;
|
||||
|
||||
// GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, SET);
|
||||
// V_ADC = Get_ConversionVal(get_adc(PV1_VOLT_IN));
|
||||
V_ADC = get_aftercalculationAdc(PV1_VOLT_IN);
|
||||
V_ADC = get_aftercalculationAdc1(PV_VOLT_IN);
|
||||
// V_ADC = g_adcData.total_PV1_VOLT_IN / g_adcData.num;
|
||||
|
||||
// V_ADC = get_adc(PV1_VOLT_IN);
|
||||
// GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, RESET);
|
||||
|
||||
V = (float)(V_ADC) / 4095 * 2.5 * P_PV1_VOLT_IN;
|
||||
V = (float)(V_ADC) * P_PV1_VOLT_IN;
|
||||
|
||||
#ifdef enable_Printf_VI
|
||||
printf("\n PV1_VOLT_IN ADC : %d \n", V_ADC);
|
||||
|
@ -322,16 +420,17 @@ float get_PV1_VOLT_IN(void)
|
|||
* @param
|
||||
* @retval V 电压值
|
||||
*/
|
||||
float get_PV_VOLT_IN1(void)
|
||||
float get_SYS_VOLT_IN(void)
|
||||
{
|
||||
float V;
|
||||
uint16_t V_ADC;
|
||||
|
||||
// V_ADC = Get_ConversionVal(get_adc(PV_VOLT_IN1));
|
||||
V_ADC = get_aftercalculationAdc(PV_VOLT_IN1);
|
||||
V_ADC = get_aftercalculationAdc1(SYS_VOLT_IN);
|
||||
// V_ADC = g_adcData.total_PV_VOLT_IN1 / g_adcData.num;
|
||||
// V_ADC = get_adc(PV_VOLT_IN1);
|
||||
|
||||
V = (float)(V_ADC) / 4095 * 2.5 * P_PV_VOLT_IN1;
|
||||
V = (float)(V_ADC) * P_PV_VOLT_IN1;
|
||||
|
||||
#ifdef enable_Printf_VI
|
||||
printf("\n PV_VOLT_IN1 ADC : %d \n", V_ADC);
|
||||
|
@ -358,7 +457,8 @@ float get_MOSFET_Temper(void)
|
|||
uint16_t T_ADC;
|
||||
|
||||
// T_ADC = Get_ConversionVal(get_adc(MOSFET_Temper));
|
||||
T_ADC = get_aftercalculationAdc(MOSFET_Temper);
|
||||
T_ADC = get_aftercalculationAdc1(MOSFET_Temper);
|
||||
// T_ADC = g_adcData.total_MOSFET_Temper / g_adcData.num;
|
||||
|
||||
// char buffer[30];
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
|
@ -389,31 +489,31 @@ float get_MOSFET_Temper(void)
|
|||
return T;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 得到光伏2开路电压
|
||||
* @param
|
||||
* @retval V 电压值
|
||||
*/
|
||||
float get_PV2_VOLT_IN(void)
|
||||
{
|
||||
float V;
|
||||
uint16_t V_ADC;
|
||||
|
||||
// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
|
||||
// V_ADC = Get_ConversionVal(get_adc(PV2_VOLT_IN));
|
||||
V_ADC = get_aftercalculationAdc(PV2_VOLT_IN);
|
||||
// V_ADC = get_adc(PV2_VOLT_IN);
|
||||
// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, RESET);
|
||||
|
||||
V = (float)(V_ADC) / 4095 * 2.5 * P_PV2_VOLT_IN;
|
||||
|
||||
#ifdef enable_Printf_VI
|
||||
printf("\n PV2_VOLT_IN ADC : %d \n", V_ADC);
|
||||
printf(" PV2_VOLT_IN V : %d /100 \n", (int)(V * 100));
|
||||
#endif
|
||||
|
||||
return V;
|
||||
}
|
||||
///**
|
||||
// * @brief 得到光伏2开路电压
|
||||
// * @param
|
||||
// * @retval V 电压值
|
||||
// */
|
||||
//float get_PV2_VOLT_IN(void)
|
||||
//{
|
||||
// float V;
|
||||
// uint16_t V_ADC;
|
||||
//
|
||||
//// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
|
||||
//// V_ADC = Get_ConversionVal(get_adc(PV2_VOLT_IN));
|
||||
//// V_ADC = get_aftercalculationAdc(PV2_VOLT_IN);
|
||||
//// V_ADC = get_adc(PV2_VOLT_IN);
|
||||
//// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, RESET);
|
||||
//
|
||||
// V = (float)(V_ADC) * P_PV2_VOLT_IN;
|
||||
//
|
||||
//#ifdef enable_Printf_VI
|
||||
// printf("\n PV2_VOLT_IN ADC : %d \n", V_ADC);
|
||||
// printf(" PV2_VOLT_IN V : %d /100 \n", (int)(V * 100));
|
||||
//#endif
|
||||
//
|
||||
// return V;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "gpio.h"
|
||||
#include "sl_protocol.h"
|
||||
#include "task.h"
|
||||
#include "adc.h"
|
||||
|
||||
#include "uart_dev.h"
|
||||
|
||||
|
@ -807,119 +808,144 @@ void findMiNDutyRatio(void)
|
|||
|
||||
void test(void)
|
||||
{
|
||||
// mppt_readjust();
|
||||
// Get_OutputPower();
|
||||
|
||||
// mppt_constantVoltage(18);
|
||||
|
||||
// findMiNDutyRatio();
|
||||
// MpptContorl();
|
||||
|
||||
// printf_data();
|
||||
// void MpptContorl();
|
||||
|
||||
// mppt_constantVoltageO(12);
|
||||
|
||||
// FloatingCharge();
|
||||
// mppt_readJust();
|
||||
|
||||
// mppt_constantCurrentO(1);
|
||||
|
||||
|
||||
// if (g_interruptNum < 5) {
|
||||
// g_interruptNum++;
|
||||
// return;
|
||||
// }
|
||||
// g_Mppt_Para.Charg_Current = get_capturedata(get_CHG_CURR);
|
||||
// g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
|
||||
// g_Mppt_Para.Output_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
||||
// g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage;
|
||||
g_Mppt_Para.Charg_Current = get_CHG_CURR();
|
||||
g_Mppt_Para.Discharg_Current = get_DSG_CURR();
|
||||
g_Mppt_Para.Output_Voltage = get_PV_VOLT_OUT();
|
||||
g_Mppt_Para.Input_Voltage = get_PV1_VOLT_IN();
|
||||
// g_Mppt_Para.Input_Voltage = get_SYS_VOLT_IN();
|
||||
// g_Mppt_Para.HighSideMos_Temperature = get_MOSFET_Temper();
|
||||
// g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV_VOLT_IN();
|
||||
|
||||
// mppt_constantVoltage(18);
|
||||
// return;
|
||||
// printf("\n\n\n");
|
||||
// printf("num = %d \n", g_adcData.num);
|
||||
// printf("Charg_Current = %d/1000 \n", (int)(g_Mppt_Para.Charg_Current * 1000));
|
||||
// printf("Output_Voltage = %d/1000 \n", (int)(g_Mppt_Para.Output_Voltage * 1000));
|
||||
// printf("Discharg_Current = %d/1000 \n", (int)(g_Mppt_Para.Discharg_Current * 1000));
|
||||
// printf("\n\n\n");
|
||||
|
||||
// printf("%d\n", g_adcData.num);
|
||||
printf("%d\n", (int)(g_Mppt_Para.Charg_Current * 1000));
|
||||
printf("%d\n", (int)(g_Mppt_Para.Output_Voltage * 1000));
|
||||
printf("%d\r\n", (int)(g_Mppt_Para.Discharg_Current * 1000));
|
||||
|
||||
if (g_Mppt_Para.Discharg_Current == 0 && g_Mppt_Para.Charg_Current == 0) {
|
||||
return;
|
||||
}
|
||||
// g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage;
|
||||
// printf("Input_Voltage = %d/1000 \n", (int)(g_Mppt_Para.Input_Voltage * 1000));
|
||||
// printf("get_PV_VOLT_IN1 = %d/1000 \n", (int)(get_PV_VOLT_IN1() * 1000));
|
||||
// printf("HighSideMos_Temperature = %d/1000 \n", (int)(g_Mppt_Para.HighSideMos_Temperature * 1000));
|
||||
|
||||
// static float_t Volt = 0.7;
|
||||
// static float_t Curr = 5.5;
|
||||
// static float_t loopImpedance;
|
||||
// static uint8_t onlyone = 1;
|
||||
// if (onlyone) {
|
||||
// loopImpedance = (float_t)g_slConfigInfo.loopImpedance / 100;
|
||||
// }
|
||||
// g_adcData.num = 0;
|
||||
|
||||
|
||||
static float_t inBatteryCurr;
|
||||
static float_t outBatteryCurr;
|
||||
inBatteryCurr = g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current;
|
||||
outBatteryCurr = g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current;
|
||||
if (inBatteryCurr > 0.1) {
|
||||
g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage - inBatteryCurr * g_impedance;
|
||||
} else {
|
||||
g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage;
|
||||
}
|
||||
|
||||
if (g_batteryState == 0 && (inBatteryCurr > 0.1 || outBatteryCurr > 0.1) && g_Mppt_Para.Output_Voltage < 14.2) {
|
||||
// printf("int g_batteryState : %d\n", g_batteryState);
|
||||
g_batteryState = 1;
|
||||
// TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
|
||||
// , impedanceCalculation_reloadVal, impedanceCalculation_reloadVal);
|
||||
}
|
||||
|
||||
// mppt_constantVoltage(18);
|
||||
|
||||
// if (g_Mppt_Para.MPPT_Mode == CONSTANTCURRENT
|
||||
// || g_Mppt_Para.MPPT_Mode == CONSTANTVOLTAGE) {
|
||||
//// mppt_readjust();
|
||||
//// Get_OutputPower();
|
||||
//
|
||||
// g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT)
|
||||
// - g_impedance * (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current);
|
||||
//// mppt_constantVoltage(18);
|
||||
//
|
||||
//// findMiNDutyRatio();
|
||||
//// MpptContorl();
|
||||
//
|
||||
//// printf_data();
|
||||
//// void MpptContorl();
|
||||
//
|
||||
//// mppt_constantVoltageO(12);
|
||||
//
|
||||
//// FloatingCharge();
|
||||
//// mppt_readJust();
|
||||
//
|
||||
//// mppt_constantCurrentO(1);
|
||||
//
|
||||
//
|
||||
//// if (g_interruptNum < 5) {
|
||||
//// g_interruptNum++;
|
||||
//// return;
|
||||
//// }
|
||||
//// g_Mppt_Para.Charg_Current = get_capturedata(get_CHG_CURR);
|
||||
//// g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
|
||||
//// g_Mppt_Para.Output_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
||||
//// g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage;
|
||||
// g_Mppt_Para.Charg_Current = get_CHG_CURR();
|
||||
// g_Mppt_Para.Discharg_Current = get_DSG_CURR();
|
||||
// g_Mppt_Para.Output_Voltage = get_PV_VOLT_OUT();
|
||||
// g_Mppt_Para.Input_Voltage = get_PV1_VOLT_IN();
|
||||
//
|
||||
//// mppt_constantVoltage(18);
|
||||
//// return;
|
||||
//
|
||||
//
|
||||
// if (g_Mppt_Para.Discharg_Current == 0 && g_Mppt_Para.Charg_Current == 0) {
|
||||
// return;
|
||||
// }
|
||||
//// g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage;
|
||||
//
|
||||
//// static float_t Volt = 0.7;
|
||||
//// static float_t Curr = 5.5;
|
||||
//// static float_t loopImpedance;
|
||||
//// static uint8_t onlyone = 1;
|
||||
//// if (onlyone) {
|
||||
//// loopImpedance = (float_t)g_slConfigInfo.loopImpedance / 100;
|
||||
//// }
|
||||
//
|
||||
//
|
||||
// static float_t inBatteryCurr;
|
||||
// static float_t outBatteryCurr;
|
||||
// inBatteryCurr = g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current;
|
||||
// outBatteryCurr = g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current;
|
||||
// if (inBatteryCurr > 0.1) {
|
||||
// g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage - inBatteryCurr * g_impedance;
|
||||
// } else {
|
||||
// g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
||||
// g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage;
|
||||
// }
|
||||
|
||||
// voltOut = get_capturedata(get_PV_VOLT_OUT);
|
||||
// g_Mppt_Para.Battery_Voltage = voltOut - g_impedance * (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current);
|
||||
|
||||
|
||||
// ConstantVoltageCharge();
|
||||
// return;
|
||||
|
||||
if (!overTemperature) {
|
||||
MpptMode();
|
||||
MpptContorl();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// if (g_batteryState == 0 && (inBatteryCurr > 0.1 || outBatteryCurr > 0.1) && g_Mppt_Para.Output_Voltage < 14.2) {
|
||||
//// printf("int g_batteryState : %d\n", g_batteryState);
|
||||
// g_batteryState = 1;
|
||||
//// TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
|
||||
//// , impedanceCalculation_reloadVal, impedanceCalculation_reloadVal);
|
||||
// }
|
||||
//
|
||||
//// mppt_constantVoltage(18);
|
||||
//
|
||||
//// if (g_Mppt_Para.MPPT_Mode == CONSTANTCURRENT
|
||||
//// || g_Mppt_Para.MPPT_Mode == CONSTANTVOLTAGE) {
|
||||
////
|
||||
//// g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT)
|
||||
//// - g_impedance * (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current);
|
||||
//// } else {
|
||||
//// g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
||||
//// }
|
||||
//
|
||||
//// voltOut = get_capturedata(get_PV_VOLT_OUT);
|
||||
//// g_Mppt_Para.Battery_Voltage = voltOut - g_impedance * (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current);
|
||||
//
|
||||
//
|
||||
//// ConstantVoltageCharge();
|
||||
//// return;
|
||||
//
|
||||
// if (!overTemperature) {
|
||||
// MpptMode();
|
||||
// MpptContorl();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// mppt_constantVoltageO(12);
|
||||
|
||||
// static uint32_t run_num = 0;
|
||||
// if (1000 < run_num++) {
|
||||
// FloatingCharge();
|
||||
// run_num = 1200;
|
||||
// printf("in floatcharge \n");
|
||||
// return;
|
||||
// }
|
||||
// mppt_readJust();
|
||||
// mppt_constantCurrentO(1.2);
|
||||
|
||||
|
||||
// int16_t var = 0;
|
||||
// char buff[4];
|
||||
// for (var = 0; var < 100; ++var) {
|
||||
// sprintf(buff, "%3d:", var);
|
||||
// uart_dev_write(g_gw485_uart4_handle, buff, sizeof(buff));
|
||||
// uart_dev_write(g_gw485_uart4_handle, "1234567890\n", sizeof("1234567890\n"));
|
||||
// Delay_Ms(1);
|
||||
// }
|
||||
// uart_dev_write(g_gw485_uart4_handle, "\n\n\n\n\n\n", sizeof("\n\n\n\n\n\n"));
|
||||
//
|
||||
//// static uint32_t run_num = 0;
|
||||
//// if (1000 < run_num++) {
|
||||
//// FloatingCharge();
|
||||
//// run_num = 1200;
|
||||
//// printf("in floatcharge \n");
|
||||
//// return;
|
||||
//// }
|
||||
//// mppt_readJust();
|
||||
//// mppt_constantCurrentO(1.2);
|
||||
//
|
||||
//
|
||||
//// int16_t var = 0;
|
||||
//// char buff[4];
|
||||
//// for (var = 0; var < 100; ++var) {
|
||||
//// sprintf(buff, "%3d:", var);
|
||||
//// uart_dev_write(g_gw485_uart4_handle, buff, sizeof(buff));
|
||||
//// uart_dev_write(g_gw485_uart4_handle, "1234567890\n", sizeof("1234567890\n"));
|
||||
//// Delay_Ms(1);
|
||||
//// }
|
||||
//// uart_dev_write(g_gw485_uart4_handle, "\n\n\n\n\n\n", sizeof("\n\n\n\n\n\n"));
|
||||
}
|
||||
|
||||
|
||||
|
|
174
App/src/task.c
174
App/src/task.c
|
@ -78,66 +78,66 @@ void Task_RunLED(void)
|
|||
// printf(" \n");
|
||||
// uart_sendstr(g_bat485_uart3_handle, " \n");
|
||||
|
||||
uart_dev_write(g_bat485_uart3_handle, " \n", sizeof(" \n"));
|
||||
|
||||
char buffer[80];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " duty_ratio : %d/1000 \n", (int)(g_duty_ratio * 1000));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " Input_Voltage : %d/100 \n", (int)(g_Mppt_Para.Input_Voltage * 100));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " vout : %d/100 \n", (int)(g_Mppt_Para.Output_Voltage * 100));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " vBattery : %d/100 \n", (int)(g_Mppt_Para.Battery_Voltage * 100));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " Iout : %d/100 \n", (int)(g_Mppt_Para.Charg_Current * 100));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " Idisout : %d/100 \n", (int)(g_Mppt_Para.Discharg_Current * 100));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " mosT : %d/10 \n", (int)(g_Mppt_Para.HighSideMos_Temperature * 10));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " impedance : %d/1000 \n", (int)(g_impedance * 1000));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " g_impedanceStart : %d \n", g_impedanceStart);
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " mosState : %d \n", (int)(g_Mppt_Para.DischargMos_State));
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " batteryState : %d \n", g_batteryState);
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " outputAgainFlag : %d \n", outputAgainFlag);
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " excessiveLoadFlag : %d \n", excessiveLoadFlag);
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
sprintf(buffer, " 0.没有工作; 1.涓流模式; 2.恒流模式; 3.恒压模式; 4.浮充模式; 5.没有电池 : %d \n", g_Mppt_Para.MPPT_Mode);
|
||||
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
|
||||
uart_dev_write(g_bat485_uart3_handle, " \n", sizeof(" \n"));
|
||||
// uart_dev_write(g_bat485_uart3_handle, " \n", sizeof(" \n"));
|
||||
//
|
||||
// char buffer[80];
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " duty_ratio : %d/1000 \n", (int)(g_duty_ratio * 1000));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " Input_Voltage : %d/100 \n", (int)(g_Mppt_Para.Input_Voltage * 100));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " vout : %d/100 \n", (int)(g_Mppt_Para.Output_Voltage * 100));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " vBattery : %d/100 \n", (int)(g_Mppt_Para.Battery_Voltage * 100));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " Iout : %d/100 \n", (int)(g_Mppt_Para.Charg_Current * 100));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " Idisout : %d/100 \n", (int)(g_Mppt_Para.Discharg_Current * 100));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " mosT : %d/10 \n", (int)(g_Mppt_Para.HighSideMos_Temperature * 10));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " impedance : %d/1000 \n", (int)(g_impedance * 1000));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " g_impedanceStart : %d \n", g_impedanceStart);
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " mosState : %d \n", (int)(g_Mppt_Para.DischargMos_State));
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " batteryState : %d \n", g_batteryState);
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " outputAgainFlag : %d \n", outputAgainFlag);
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " excessiveLoadFlag : %d \n", excessiveLoadFlag);
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// memset(buffer, 0, sizeof(buffer));
|
||||
// sprintf(buffer, " 0.没有工作; 1.涓流模式; 2.恒流模式; 3.恒压模式; 4.浮充模式; 5.没有电池 : %d \n", g_Mppt_Para.MPPT_Mode);
|
||||
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||
//
|
||||
// uart_dev_write(g_bat485_uart3_handle, " \n", sizeof(" \n"));
|
||||
|
||||
|
||||
|
||||
|
@ -145,6 +145,24 @@ void Task_RunLED(void)
|
|||
|
||||
// get_CHG_CURR();
|
||||
|
||||
// printf("\n\n\n");
|
||||
// printf("num = %d \n", g_adcData.num);
|
||||
// printf("Charg_Current = %d/1000 \n", (int)(g_Mppt_Para.Charg_Current * 1000));
|
||||
// printf("Output_Voltage = %d/1000 \n", (int)(g_Mppt_Para.Output_Voltage * 1000));
|
||||
// printf("Discharg_Current = %d/1000 \n", (int)(g_Mppt_Para.Discharg_Current * 1000));
|
||||
// printf("Input_Voltage = %d/1000 \n", (int)(g_Mppt_Para.Input_Voltage * 1000));
|
||||
// printf("get_PV_VOLT_IN1 = %d/1000 \n", (int)(get_PV_VOLT_IN1() * 1000));
|
||||
// printf("HighSideMos_Temperature = %d/1000 \n", (int)(g_Mppt_Para.HighSideMos_Temperature * 1000));
|
||||
// printf("\n\n\n");
|
||||
|
||||
// printf("%d\n", g_adcData.num);
|
||||
// printf("%d\n", (int)(g_Mppt_Para.Charg_Current * 1000));
|
||||
// printf("%d\n", (int)(g_Mppt_Para.Output_Voltage * 1000));
|
||||
// printf("%d\n", (int)(g_Mppt_Para.Discharg_Current * 1000));
|
||||
// printf("%d\n", (int)(g_Mppt_Para.Input_Voltage * 1000));
|
||||
// printf("%d\n", (int)(g_Mppt_Para.Solar_Open_Circuit_Voltage * 1000));
|
||||
// printf("%d\r\n", (int)(g_Mppt_Para.HighSideMos_Temperature * 1000));
|
||||
|
||||
static uint8_t flag = RESET;
|
||||
flag = !flag;
|
||||
GPIO_WriteBit(RUN_LED_GPIO, RUN_LED_PIN, flag);
|
||||
|
@ -176,7 +194,7 @@ void Task_startMpptControl(void)
|
|||
|
||||
if (g_slConfigInfo.checkSolarOpenCircuitVTime == ++checkSolarOpenCircuitVTimeFlag) {
|
||||
checkSolarOpenCircuitVTimeFlag = 0;
|
||||
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV1_VOLT_IN();
|
||||
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV_VOLT_IN();
|
||||
// printf("volt in : %d/100 \n", (int)(g_Mppt_Para.Solar_Open_Circuit_Voltage * 100));
|
||||
// char buff[50];
|
||||
// memset(buff, 0, sizeof(buff));
|
||||
|
@ -318,10 +336,10 @@ void Task_refreshRegister(void)
|
|||
// g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
|
||||
// g_Mppt_Para.HighSideMos_Temperature = get_capturedata(get_MOSFET_Temper);
|
||||
// g_Mppt_Para.Battery_Voltage = get_PV_VOLT_OUT();
|
||||
g_Mppt_Para.Output_Voltage = get_PV_VOLT_OUT();
|
||||
g_Mppt_Para.Charg_Current = get_CHG_CURR();
|
||||
g_Mppt_Para.Discharg_Current = get_DSG_CURR();
|
||||
g_Mppt_Para.HighSideMos_Temperature = get_MOSFET_Temper();
|
||||
// g_Mppt_Para.Output_Voltage = get_PV_VOLT_OUT();
|
||||
// g_Mppt_Para.Charg_Current = get_CHG_CURR();
|
||||
// g_Mppt_Para.Discharg_Current = get_DSG_CURR();
|
||||
// g_Mppt_Para.HighSideMos_Temperature = get_MOSFET_Temper();
|
||||
g_Mppt_Para.DischargMos_State = GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN)
|
||||
&& GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN);
|
||||
|
||||
|
@ -344,7 +362,7 @@ void Task_refreshRegister(void)
|
|||
|
||||
// g_Mppt_Para.DischargMos_State = GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN);
|
||||
// g_Mppt_Para.Solar_Open_Circuit_Voltage = get_capturedata(get_PV1_VOLT_IN);
|
||||
g_Mppt_Para.Input_Voltage = get_PV1_VOLT_IN();
|
||||
g_Mppt_Para.Input_Voltage = get_PV_VOLT_IN();
|
||||
|
||||
if (g_Mppt_Para.HighSideMos_Temperature < g_slConfigInfo.HighSideMosTemperature_start + 3) {
|
||||
if (overTemperature == 2) {
|
||||
|
@ -752,7 +770,7 @@ void g_Mppt_Para_Init(void)
|
|||
g_Mppt_Para.Discharg_Current = get_DSG_CURR();
|
||||
g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage
|
||||
- (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current) * g_impedance;
|
||||
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV1_VOLT_IN();
|
||||
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV_VOLT_IN();
|
||||
g_Mppt_Para.HighSideMos_Temperature = get_MOSFET_Temper();
|
||||
|
||||
if (g_Mppt_Para.Battery_Voltage < 15 || g_Mppt_Para.Battery_Voltage > 11) {
|
||||
|
@ -785,18 +803,18 @@ void task_Init(void)
|
|||
|
||||
TimeSliceOffset_Register(&m_runled, Task_RunLED, runled_reloadVal, runled_offset);
|
||||
|
||||
TimeSliceOffset_Register(&m_usart, Task_usart, usart_reloadVal, usart_offset);
|
||||
// TimeSliceOffset_Register(&m_usart, Task_usart, usart_reloadVal, usart_offset);
|
||||
|
||||
TimeSliceOffset_Register(&m_wdi, Task_wdi, wdi_reloadVal, wdi_offset);
|
||||
|
||||
// TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
|
||||
// , impedanceCalculation_reloadVal, impedanceCalculation_reloadVal);
|
||||
|
||||
TimeSliceOffset_Register(&m_refreshRegister, Task_refreshRegister
|
||||
, refreshRegister_reloadVal, refreshRegister_reloadVal);
|
||||
|
||||
TimeSliceOffset_Register(&m_startMpptControl, Task_startMpptControl
|
||||
, startMpptControl_reloadVal, startMpptControl_offset);
|
||||
//
|
||||
// TimeSliceOffset_Register(&m_refreshRegister, Task_refreshRegister
|
||||
// , refreshRegister_reloadVal, refreshRegister_reloadVal);
|
||||
//
|
||||
// TimeSliceOffset_Register(&m_startMpptControl, Task_startMpptControl
|
||||
// , startMpptControl_reloadVal, startMpptControl_offset);
|
||||
|
||||
TimeSliceOffset_Start(); /* Æô¶¯Ê±¼äƬÂÖѯ */
|
||||
}
|
||||
|
@ -820,13 +838,17 @@ void hardware_Init(void)
|
|||
POW_OUT_CON_Init();
|
||||
DSG_PROT_Init();
|
||||
WORK_VOLT_INT_Init();
|
||||
ADC_TIM_DMA_Init();
|
||||
// EnPowerSupply_Init();
|
||||
|
||||
// Set_duty_ratio(&g_duty_ratio);
|
||||
|
||||
// uart_dev_write(g_bat485_uart3_handle, " hello world \n", sizeof(" hello world \n"));
|
||||
|
||||
TIM3_Init(10);
|
||||
// TIM_Cmd(TIM3, ENABLE); //TIM3使能
|
||||
TIM3_Init(300);
|
||||
TIM_Cmd(TIM3, ENABLE); //TIM3使能
|
||||
|
||||
g_duty_ratio = 0.8;
|
||||
Set_duty_ratio(&g_duty_ratio);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
//void rq_debug(const char *fmt, ...){};
|
||||
//#endif
|
||||
|
||||
#define RQ_OK 1
|
||||
#define RQ_ERROR 0
|
||||
#define RQ_OVERFLOW -2
|
||||
|
||||
//³õʼ»¯¶ÓÁÐ
|
||||
int InitRingQueue(RingQueue *q, RQ_ElementType *buff, int size)
|
||||
{
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
|
||||
//#define RING_QUEUE_DEBUG //定义本宏会打印RingQueue的调试信息
|
||||
|
||||
#define RQ_OK 1
|
||||
#define RQ_ERROR 0
|
||||
#define RQ_OVERFLOW -2
|
||||
typedef unsigned char RQ_ElementType;//元素类型
|
||||
|
||||
typedef struct _ring_queue
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* ring_queue.c
|
||||
*
|
||||
* Created on: 2024年6月21日
|
||||
* Author: psx
|
||||
*/
|
||||
|
||||
|
||||
//循环队列
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "ring_queue2.h"
|
||||
|
||||
|
||||
#define RQ_OK 1
|
||||
#define RQ_ERROR 0
|
||||
#define RQ_OVERFLOW -2
|
||||
//#define RING_QUEUE_DEBUG
|
||||
|
||||
//#ifdef RING_QUEUE_DEBUG
|
||||
//#define //rq_debug term_printf
|
||||
//#else
|
||||
//void rq_debug(const char *fmt, ...){};
|
||||
//#endif
|
||||
|
||||
//初始化队列
|
||||
int InitRingQueue2(RingQueue2 *q, RQ_ElementType2 *buff, int size)
|
||||
{
|
||||
q->elems = buff;
|
||||
q->size = size;
|
||||
q->front=q->rear=0;
|
||||
return RQ_OK;
|
||||
}
|
||||
|
||||
//遍历队列,
|
||||
//消费者使用,故对生产者可能修改的rear先读取缓存
|
||||
int ShowRingQueue2(RingQueue2 *q)
|
||||
{
|
||||
//int i;
|
||||
int rear = q->rear;
|
||||
|
||||
if(q->front == rear)
|
||||
{
|
||||
//rq_debug("队列为空\n");
|
||||
return RQ_ERROR;
|
||||
}
|
||||
//rq_debug("队列中的元素为:\n");
|
||||
//for(i=((q->front)%q->size); i != rear; i=((i+1)%q->size))
|
||||
//rq_debug(" %c\n",q->elems[i]);
|
||||
|
||||
//rq_debug("\n");
|
||||
//rq_debug("队首元素为%c\n",q->elems[q->front]);
|
||||
//rq_debug("队尾元素为%c\n",q->elems[rear - 1]);
|
||||
return RQ_OK;
|
||||
}
|
||||
|
||||
//向队尾插入元素e
|
||||
int InRingQueue2(RingQueue2 *q,RQ_ElementType2 e)
|
||||
{
|
||||
if(RingQueueFull2(q))
|
||||
{
|
||||
//rq_debug("空间不足\n");
|
||||
return(RQ_OVERFLOW);
|
||||
}
|
||||
q->elems[q->rear] = e;
|
||||
q->rear = (q->rear+1) % q->size;
|
||||
//rq_debug("rear = %d\n",q->rear);
|
||||
return RQ_OK;
|
||||
}
|
||||
|
||||
//从队首取回并删除元素
|
||||
int OutRingQueue2(RingQueue2 *q, RQ_ElementType2 *e)
|
||||
{
|
||||
if(RingQueueEmpty2(q))
|
||||
{
|
||||
//rq_debug("队列为空\n");
|
||||
return RQ_ERROR;
|
||||
}
|
||||
*e = q->elems[q->front];
|
||||
//rq_debug("被删除的队首元素为%c\n",q->elems[q->front]);
|
||||
q->front = (q->front+1) % q->size;
|
||||
return RQ_OK;
|
||||
}
|
||||
|
||||
//队列中的元素个数
|
||||
int RingQueueLength2(RingQueue2 *q)
|
||||
{
|
||||
return ((q->rear - q->front) + q->size) % q->size;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* ring_queue.h
|
||||
*
|
||||
* Created on: 2024年6月21日
|
||||
* Author: psx
|
||||
*/
|
||||
|
||||
#ifndef DRIVERS_RINGQUEUE_RING_QUEUE2_H_
|
||||
#define DRIVERS_RINGQUEUE_RING_QUEUE2_H_
|
||||
|
||||
|
||||
//#define RING_QUEUE_DEBUG //定义本宏会打印RingQueue的调试信息
|
||||
|
||||
typedef uint16_t RQ_ElementType2;//元素类型
|
||||
|
||||
typedef struct _ring_queue2
|
||||
{
|
||||
RQ_ElementType2 *elems;
|
||||
int size;
|
||||
volatile int front, rear;
|
||||
}RingQueue2;
|
||||
|
||||
//初始化队列,需传入保存队列状态的结构q,队列使用的buffer和buffer大小
|
||||
int InitRingQueue2(RingQueue2 *q, RQ_ElementType2 *buff, int size);
|
||||
|
||||
#define RingQueueFull2(q) (((q)->rear+1) % (q)->size == (q)->front)
|
||||
#define RingQueueEmpty2(q) ((q)->front == (q)->rear)
|
||||
|
||||
//遍历队列,
|
||||
//消费者使用,故对生产者可能修改的rear先读取缓存
|
||||
int ShowRingQueue2(RingQueue2 *q);
|
||||
|
||||
//向队尾插入元素e
|
||||
int InRingQueue2(RingQueue2 *q,RQ_ElementType2 e);
|
||||
|
||||
//从队首删除元素
|
||||
int OutRingQueue2(RingQueue2 *q, RQ_ElementType2 *e);
|
||||
|
||||
//队列中的元素个数
|
||||
int RingQueueLength2(RingQueue2 *q);
|
||||
|
||||
|
||||
#endif /* DRIVERS_RINGQUEUE_RING_QUEUE_H_ */
|
|
@ -2,9 +2,47 @@
|
|||
#define __ADC_H
|
||||
|
||||
#include "ch32l103.h"
|
||||
#include "ring_queue2.h"
|
||||
|
||||
//typedef struct _ADC_DATA {
|
||||
// uint16_t total_CHG_CURR; /* 一个控制周期中,adc采集的值之和 充电电流 */
|
||||
// uint16_t num_CHG_CURR; /* 一个控制周期中,adc采集次数之和 */
|
||||
// uint16_t total_PV_VOLT_OUT; /* 输出电压 */
|
||||
// uint16_t num_PV_VOLT_OUT;
|
||||
// uint16_t total_DSG_CURR; /* 放电电流 */
|
||||
// uint16_t num_DSG_CURR;
|
||||
// uint16_t total_PV1_VOLT_IN; /* 系统输入电压 */
|
||||
// uint16_t num_PV1_VOLT_IN;
|
||||
// uint16_t total_PV_VOLT_IN1; /* 太阳能板输出电压 */
|
||||
// uint16_t num_PV_VOLT_IN1;
|
||||
// uint16_t total_MOSFET_Temper; /* mos管温度 */
|
||||
// uint16_t num_MOSFET_Temper;
|
||||
//}ADC_DATA;
|
||||
|
||||
//#define data_len 50
|
||||
//typedef struct _ADC_DATA {
|
||||
// uint16_t num; /* 一个控制周期中,adc采集次数 */
|
||||
// uint16_t CHG_CURR_array[data_len]; /* 充电电流 */
|
||||
// uint16_t PV_VOLT_OUT_array[data_len]; /* 输出电压 */
|
||||
// uint16_t DSG_CURR_array[data_len]; /* 放电电流 */
|
||||
// uint16_t PV_VOLT_IN_array[data_len]; /* 太阳能板输出电压 */
|
||||
// uint16_t SYS_VOLT_IN_array[data_len]; /* 系统输入电压 */
|
||||
// uint16_t MOSFET_Temper_array[data_len]; /* mos管温度 */
|
||||
//}ADC_DATA;
|
||||
|
||||
#define adcBuffSize 100
|
||||
|
||||
typedef struct _ADC_DATA {
|
||||
RingQueue2 RQCHG_CURR;
|
||||
uint32_t total_CHG_CURR; /* 充电电流一段时间中adc值的和 */
|
||||
RingQueue2 RQDSG_CURR;
|
||||
uint32_t total_DSG_CURR; /* 放电电流一段时间中adc值的和 */
|
||||
}ADC_DATA;
|
||||
|
||||
extern ADC_DATA g_adcData;
|
||||
extern int16_t Calibrattion_Val;
|
||||
|
||||
void ADC_all_Init(void);
|
||||
void ADC_TIM_DMA_Init(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
void G_FFMOS_CON_Init(void);
|
||||
|
||||
/* 运行指示灯 */
|
||||
/* RUN_LED --> PA8 */
|
||||
///* RUN_LED --> PA8 */
|
||||
/* RUN_LED --> PB7 */
|
||||
#define RUN_LED_GPIO GPIOA
|
||||
#define RUN_LED_PIN GPIO_Pin_8
|
||||
void RUN_LED_Init(void);
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
#define Prescaler 0
|
||||
/* 输出频率为240k */
|
||||
//#define Period 200 - 1
|
||||
/* 输出频率为100k */
|
||||
#define Period 480 - 1
|
||||
/* 输出频率为10k */
|
||||
//#define Period 4800 - 1
|
||||
|
||||
void PWM_TIM_Configuration(void);
|
||||
void Set_duty_ratio(float *duty_ratio);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <adc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int16_t Calibrattion_Val = 0;
|
||||
ADC_DATA g_adcData;
|
||||
|
||||
//ADC对应GPIO初始化配置以及ADC初始化配置
|
||||
void ADC_all_Init(void)
|
||||
|
@ -13,7 +14,8 @@ void ADC_all_Init(void)
|
|||
RCC_PB2PeriphClockCmd(RCC_PB2Periph_ADC1, ENABLE);
|
||||
RCC_ADCCLKConfig(RCC_PCLK2_Div2);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; //PA1~7对应ADC通道1~7
|
||||
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; //PA1~7对应ADC通道1~7
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; //PA1~7对应ADC通道1~7
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
|
@ -43,3 +45,291 @@ void ADC_all_Init(void)
|
|||
ADC_Sample_ModeConfig(ADC1,ADC_Sample_Over_1M_Mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void DMA1_Channel1_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
|
||||
|
||||
/*
|
||||
* 初始化ADC的DMA
|
||||
*
|
||||
*
|
||||
*/
|
||||
void DMA_Tx_Init(u32 memadr, u16 bufsize)
|
||||
{
|
||||
DMA_InitTypeDef DMA_InitStructure = {0};
|
||||
NVIC_InitTypeDef NVIC_InitStructure = {0};
|
||||
|
||||
RCC_HBPeriphClockCmd(RCC_HBPeriph_DMA1, ENABLE);
|
||||
|
||||
DMA_DeInit(DMA1_Channel1);
|
||||
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&ADC1->RDATAR; //ADC1地址
|
||||
DMA_InitStructure.DMA_MemoryBaseAddr = memadr; //内存地址
|
||||
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; //方向(从外设到内存)
|
||||
DMA_InitStructure.DMA_BufferSize = bufsize; //传输内容的大小
|
||||
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //外设地址固定
|
||||
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; //内存地址递增
|
||||
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; //外设数据单位
|
||||
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; //内存数据单位
|
||||
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; //DMA模式:循环传输
|
||||
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh; //优先级:高
|
||||
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; //禁止内存到内存的传输
|
||||
DMA_Init(DMA1_Channel1, &DMA_InitStructure);
|
||||
|
||||
DMA_ITConfig(DMA1_Channel1, DMA_IT_TC, ENABLE); //使能传输完成中断
|
||||
|
||||
//初始化TIM NVIC,设置中断优先级分组
|
||||
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel1_IRQn; //
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //设置抢占优先级0
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //设置响应优先级3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道中断
|
||||
NVIC_Init(&NVIC_InitStructure); //初始化NVIC
|
||||
|
||||
DMA_Cmd(DMA1_Channel1,ENABLE);
|
||||
|
||||
}
|
||||
|
||||
void TIM1_Init1(u16 arr,u16 psc)
|
||||
{
|
||||
// /* 初始化PA8为模拟通道输入引脚 */
|
||||
// GPIO_InitTypeDef GPIO_InitStructure={0};
|
||||
// RCC_PB2PeriphClockCmd(RCC_PB2Periph_GPIOA, ENABLE);
|
||||
//// RCC_APB2PeriphClockCmd(RCC_PB2Periph_AFIO, ENABLE); //打开管脚复用AFIO时钟
|
||||
//// GPIO_PinRemapConfig(GPIO_FullRemap_TIM1, ENABLE);
|
||||
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
|
||||
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
|
||||
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
// GPIO_Init( GPIOA, &GPIO_InitStructure );
|
||||
|
||||
TIM_OCInitTypeDef TIM_OCInitStructure={0};
|
||||
TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure={0};
|
||||
|
||||
RCC_PB2PeriphClockCmd(RCC_PB2Periph_TIM1, ENABLE);
|
||||
|
||||
// TIM_TimeBaseInitStructure.TIM_Period = 30000 - 1;
|
||||
// TIM_TimeBaseInitStructure.TIM_Prescaler = 48000 - 1;
|
||||
TIM_TimeBaseInitStructure.TIM_Period = arr - 1;
|
||||
TIM_TimeBaseInitStructure.TIM_Prescaler = psc - 1;
|
||||
TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
|
||||
TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||
TIM_TimeBaseInit(TIM1, &TIM_TimeBaseInitStructure);
|
||||
|
||||
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
|
||||
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
|
||||
TIM_OCInitStructure.TIM_Pulse = 10;
|
||||
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
|
||||
TIM_OC1Init(TIM1, &TIM_OCInitStructure);
|
||||
|
||||
TIM_CtrlPWMOutputs(TIM1, ENABLE);
|
||||
TIM_OC1PreloadConfig(TIM1, TIM_OCPreload_Disable);
|
||||
TIM_ARRPreloadConfig(TIM1, ENABLE);
|
||||
TIM_Cmd(TIM1, ENABLE);
|
||||
}
|
||||
|
||||
#define CHG_CURR ADC_Channel_1
|
||||
#define PV_VOLT_OUT ADC_Channel_2
|
||||
#define DSG_CURR ADC_Channel_3
|
||||
#define PV_VOLT_IN ADC_Channel_4
|
||||
#define SYS_VOLT_IN ADC_Channel_5
|
||||
#define MOSFET_Temper ADC_Channel_6
|
||||
#define PV2_VOLT_IN ADC_Channel_7
|
||||
|
||||
static uint16_t CHG_CURR_buff[adcBuffSize];
|
||||
static uint16_t DSG_CURR_buff[adcBuffSize];
|
||||
|
||||
/*
|
||||
* 通过定时器和DMA完成adc的采集
|
||||
* 定时器采用定时器1的cc1完成ADC的外部触发 PA8 --> TIM1_CH1
|
||||
* ADC通过DMA的通道1完成数据的传输
|
||||
*
|
||||
* */
|
||||
volatile uint16_t ADC_ConvertedValue[2]; //ADC采样的数据
|
||||
void ADC_TIM_DMA_Init(void)
|
||||
{
|
||||
InitRingQueue2(&g_adcData.RQCHG_CURR, CHG_CURR_buff, adcBuffSize);
|
||||
InitRingQueue2(&g_adcData.RQDSG_CURR, DSG_CURR_buff, adcBuffSize);
|
||||
for (int var = 0; var < adcBuffSize; ++var) {
|
||||
InRingQueue2(&g_adcData.RQCHG_CURR, 0);
|
||||
InRingQueue2(&g_adcData.RQDSG_CURR, 0);
|
||||
}
|
||||
// while (RingQueueLength2(&g_adcData.RQCHG_CURR) != adcBuffSize) {
|
||||
// InRingQueue2(&g_adcData.RQCHG_CURR, 0);
|
||||
// };
|
||||
g_adcData.total_CHG_CURR = 0;
|
||||
|
||||
// while (RingQueueLength2(&g_adcData.RQDSG_CURR) != adcBuffSize) {
|
||||
// InRingQueue2(&g_adcData.RQDSG_CURR, 0);
|
||||
// };
|
||||
g_adcData.total_DSG_CURR = 0;
|
||||
|
||||
|
||||
ADC_InitTypeDef ADC_InitStructure = {0};
|
||||
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||
|
||||
RCC_PB2PeriphClockCmd(RCC_PB2Periph_GPIOA, ENABLE);
|
||||
RCC_PB2PeriphClockCmd(RCC_PB2Periph_ADC1, ENABLE);
|
||||
RCC_ADCCLKConfig(RCC_PCLK2_Div2);
|
||||
|
||||
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6; //PA1~7对应ADC通道1~7
|
||||
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
|
||||
// GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_3; //PA1~7对应ADC通道1~7
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
ADC_DeInit(ADC1);
|
||||
Calibrattion_Val=Get_CalibrationValue(ADC1);
|
||||
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
|
||||
ADC_InitStructure.ADC_ScanConvMode = ENABLE;
|
||||
// ADC_InitStructure.ADC_ScanConvMode = DISABLE;
|
||||
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
|
||||
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
|
||||
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
|
||||
// ADC_InitStructure.ADC_NbrOfChannel = 1;
|
||||
ADC_InitStructure.ADC_NbrOfChannel = 2;
|
||||
ADC_Init(ADC1, &ADC_InitStructure);
|
||||
|
||||
//使能ADC、DMA
|
||||
ADC_DMACmd(ADC1,ENABLE);
|
||||
ADC_Cmd(ADC1, ENABLE);
|
||||
|
||||
// ADC_InjectedSequencerLengthConfig(ADC1, 1);
|
||||
// ADC_InjectedChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_CyclesMode5);
|
||||
// ADC_ExternalTrigInjectedConvCmd(ADC1, ENABLE);
|
||||
|
||||
ADC_FIFO_Cmd(ADC1, ENABLE);
|
||||
ADC_BufferCmd(ADC1, DISABLE); //disable buffer
|
||||
ADC_ResetCalibration(ADC1);
|
||||
while(ADC_GetResetCalibrationStatus(ADC1));
|
||||
ADC_StartCalibration(ADC1);
|
||||
while(ADC_GetCalibrationStatus(ADC1));
|
||||
|
||||
// ADC_RegularChannelConfig(ADC1, CHG_CURR, 1, ADC_SampleTime_CyclesMode5);
|
||||
// ADC_RegularChannelConfig(ADC1, PV_VOLT_OUT, 2, ADC_SampleTime_CyclesMode5);
|
||||
// ADC_RegularChannelConfig(ADC1, DSG_CURR, 3, ADC_SampleTime_CyclesMode5);
|
||||
// ADC_RegularChannelConfig(ADC1, PV_VOLT_IN, 4, ADC_SampleTime_CyclesMode5);
|
||||
// ADC_RegularChannelConfig(ADC1, SYS_VOLT_IN, 5, ADC_SampleTime_CyclesMode5);
|
||||
// ADC_RegularChannelConfig(ADC1, MOSFET_Temper, 6, ADC_SampleTime_CyclesMode5);
|
||||
|
||||
ADC_RegularChannelConfig(ADC1, CHG_CURR, 1, ADC_SampleTime_CyclesMode5);
|
||||
ADC_RegularChannelConfig(ADC1, DSG_CURR, 2, ADC_SampleTime_CyclesMode5);
|
||||
|
||||
// /* 设置定时器输出的周期为1S */
|
||||
// TIM1_Init1(1000, 48000);
|
||||
/* 设置定时器输出的周期为30mS */
|
||||
// TIM1_Init1(30, 48000);
|
||||
/* 设置定时器输出的周期为100uS */
|
||||
TIM1_Init1(10, 48000);
|
||||
DMA_Tx_Init((u32)&ADC_ConvertedValue, 2);
|
||||
|
||||
|
||||
|
||||
// ADC_DeInit(ADC1);
|
||||
// Calibrattion_Val = Get_CalibrationValue(ADC1);
|
||||
// printf("Calibrattion_Val : %d\n", Calibrattion_Val);
|
||||
// ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
|
||||
// ADC_InitStructure.ADC_ScanConvMode = DISABLE;
|
||||
// ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
|
||||
// ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
|
||||
// ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
|
||||
// ADC_InitStructure.ADC_NbrOfChannel = 1;
|
||||
// ADC_Init(ADC1, &ADC_InitStructure);
|
||||
//
|
||||
// ADC_Cmd(ADC1, ENABLE);
|
||||
//
|
||||
// ADC_FIFO_Cmd(ADC1, ENABLE);
|
||||
// ADC_BufferCmd(ADC1, DISABLE); //disable buffer
|
||||
//
|
||||
// ADC_ResetCalibration(ADC1);
|
||||
// while(ADC_GetResetCalibrationStatus(ADC1));
|
||||
// ADC_StartCalibration(ADC1);
|
||||
// while(ADC_GetCalibrationStatus(ADC1));
|
||||
//
|
||||
// RCC_ADCCLKConfig(RCC_HCLK_ADC);
|
||||
// ADC_DutyDelayCmd(ADC1,ENABLE);
|
||||
// ADC_Sample_ModeConfig(ADC1,ADC_Sample_Over_1M_Mode);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 将采集的adc进行校准
|
||||
* @param val 采集的adc数据
|
||||
* @retval 校准后的adc数据
|
||||
*/
|
||||
uint16_t Get_ConversionVal1(int16_t val)
|
||||
{
|
||||
if((val + Calibrattion_Val) < 0 || val == 0)
|
||||
return 0;
|
||||
if((Calibrattion_Val + val) > 4095 || val == 4095)
|
||||
return 4095;
|
||||
return (val + Calibrattion_Val);
|
||||
}
|
||||
|
||||
void DMA1_Channel1_IRQHandler(void)
|
||||
{
|
||||
// printf("\r\nEnter DMA interrupt\r\n");
|
||||
if(DMA_GetITStatus(DMA1_IT_TC1)!=RESET)
|
||||
{
|
||||
//中断处理代码
|
||||
static uint16_t temp;
|
||||
|
||||
OutRingQueue2(&g_adcData.RQCHG_CURR, &temp);
|
||||
g_adcData.total_CHG_CURR -= temp;
|
||||
OutRingQueue2(&g_adcData.RQDSG_CURR, &temp);
|
||||
g_adcData.total_DSG_CURR -= temp;
|
||||
|
||||
g_adcData.total_CHG_CURR += ADC_ConvertedValue[0];
|
||||
g_adcData.total_DSG_CURR += ADC_ConvertedValue[1];
|
||||
InRingQueue2(&g_adcData.RQCHG_CURR, ADC_ConvertedValue[0]);
|
||||
InRingQueue2(&g_adcData.RQDSG_CURR, ADC_ConvertedValue[1]);
|
||||
|
||||
DMA_ClearITPendingBit(DMA1_IT_TC1);
|
||||
// g_adcData.CHG_CURR_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[0]);
|
||||
// g_adcData.PV_VOLT_OUT_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[1]);
|
||||
// g_adcData.DSG_CURR_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[2]);
|
||||
// g_adcData.PV_VOLT_IN_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[3]);
|
||||
// g_adcData.SYS_VOLT_IN_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[4]);
|
||||
// g_adcData.MOSFET_Temper_array[g_adcData.num] = Get_ConversionVal1(ADC_ConvertedValue[5]);
|
||||
// g_adcData.num++;
|
||||
|
||||
|
||||
// g_adcData.CHG_CURR_array[g_adcData.num] = ADC_ConvertedValue[0];
|
||||
// g_adcData.DSG_CURR_array[g_adcData.num] = ADC_ConvertedValue[1];
|
||||
// g_adcData.PV_VOLT_OUT_array[g_adcData.num] = ADC_ConvertedValue[2];
|
||||
// g_adcData.num++;
|
||||
|
||||
// g_adcData.num++;
|
||||
|
||||
// g_adcData.total_CHG_CURR += Get_ConversionVal1(ADC_ConvertedValue[0]);
|
||||
|
||||
// printf("%d\n", ADC_ConvertedValue[0]);
|
||||
// printf("%d\n", ADC_ConvertedValue[1]);
|
||||
|
||||
// printf("%d\n", ADC_ConvertedValue[3]);
|
||||
// printf("%d\n", ADC_ConvertedValue[4]);
|
||||
// printf("%d\r\n", ADC_ConvertedValue[5]);
|
||||
|
||||
// g_adcData.total_PV_VOLT_OUT += Get_ConversionVal1(ADC_ConvertedValue[1]);
|
||||
// g_adcData.total_DSG_CURR += Get_ConversionVal1(ADC_ConvertedValue[2]);
|
||||
// g_adcData.total_PV1_VOLT_IN += Get_ConversionVal1(ADC_ConvertedValue[3]);
|
||||
// g_adcData.total_PV_VOLT_IN1 += Get_ConversionVal1(ADC_ConvertedValue[4]);
|
||||
// g_adcData.total_MOSFET_Temper += Get_ConversionVal1(ADC_ConvertedValue[5]);
|
||||
|
||||
// printf("\r\n The current ADCH1 value = %d \r\n", ADC_ConvertedValue[0]);
|
||||
// printf("\r\n The current ADCH2 value = %d \r\n", ADC_ConvertedValue[1]);
|
||||
// printf("\r\n The current ADCH3 value = %d \r\n", ADC_ConvertedValue[2]);
|
||||
// printf("\r\n The current ADCH4 value = %d \r\n", ADC_ConvertedValue[3]);
|
||||
// printf("\r\n The current ADCH5 value = %d \r\n", ADC_ConvertedValue[4]);
|
||||
// printf("\r\n The current ADCH5 value = %d \r\n", ADC_ConvertedValue[5]);
|
||||
// ADC_ConvertedValue[0] = 0;
|
||||
// ADC_ConvertedValue[1] = 0;
|
||||
// ADC_ConvertedValue[2] = 0;
|
||||
// ADC_ConvertedValue[3] = 0;
|
||||
// ADC_ConvertedValue[4] = 0;
|
||||
// ADC_ConvertedValue[5] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ void G_FFMOS_CON_Init(void)
|
|||
void RUN_LED_Init(void)
|
||||
{
|
||||
RCC_PB2PeriphClockCmd(RCC_PB2Periph_GPIOA, ENABLE);
|
||||
RCC_PB2PeriphClockCmd(RCC_PB2Periph_GPIOB, ENABLE);
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = RUN_LED_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出
|
||||
|
|
|
@ -23,7 +23,7 @@ void TIM3_Init(uint16_t delay_ms)
|
|||
/* 分频系数 */
|
||||
uint16_t psc = (SystemCoreClock / 10000) - 1;
|
||||
/* 周期数 */
|
||||
uint16_t arr = delay_ms * 1 - 1;
|
||||
uint16_t arr = delay_ms * 10 - 1;
|
||||
|
||||
TIM3_Int_Init(arr, psc);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void TIM3_Int_Init(uint16_t arr, uint16_t psc)
|
|||
//初始化TIM NVIC,设置中断优先级分组
|
||||
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; //TIM3中断
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //设置抢占优先级0
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; //ÉèÖÃÏìÓ¦ÓÅÏȼ¶3
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //ÉèÖÃÏìÓ¦ÓÅÏȼ¶3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道1中断
|
||||
NVIC_Init(&NVIC_InitStructure); //初始化NVIC
|
||||
|
||||
|
@ -91,7 +91,7 @@ void TIM2_Int_Init(uint16_t arr, uint16_t psc)
|
|||
//初始化TIM NVIC,设置中断优先级分组
|
||||
NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; //TIM2中断
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //设置抢占优先级0
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //ÉèÖÃÏìÓ¦ÓÅÏȼ¶3
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2; //ÉèÖÃÏìÓ¦ÓÅÏȼ¶3
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道1中断
|
||||
NVIC_Init(&NVIC_InitStructure); //初始化NVIC
|
||||
|
||||
|
@ -135,7 +135,7 @@ void SysTick_Handler(void)
|
|||
void TIM1_Init(uint16_t delay_ms)
|
||||
{
|
||||
/* 分频系数 */
|
||||
uint16_t psc = (SystemCoreClock / 10000) - 1;
|
||||
uint16_t psc = (SystemCoreClock / 10) - 1;
|
||||
/* */
|
||||
uint16_t arr = delay_ms * 10 - 1;
|
||||
// uint16_t arr = 10 - 1;
|
||||
|
|
|
@ -26,8 +26,9 @@ App/src/collect_Conversion.o: ../App/src/collect_Conversion.c \
|
|||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h \
|
||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
|
||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/gpio.h \
|
||||
D:\psx\MPPT\git\App\inc/uart_dev.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h \
|
||||
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/gpio.h D:\psx\MPPT\git\App\inc/uart_dev.h \
|
||||
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/rs485.h
|
||||
|
||||
|
@ -91,6 +92,8 @@ D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h:
|
|||
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h:
|
||||
|
||||
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
|
||||
|
||||
D:\psx\MPPT\git\Hardware\inc/gpio.h:
|
||||
|
||||
D:\psx\MPPT\git\App\inc/uart_dev.h:
|
||||
|
|
Binary file not shown.
|
@ -27,8 +27,10 @@ App/src/mppt_control.o: ../App/src/mppt_control.c \
|
|||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
|
||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
|
||||
D:\psx\MPPT\git\App\inc/collect_Conversion.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/pwm.h \
|
||||
D:\psx\MPPT\git\App\inc/inflash.h D:\psx\MPPT\git\Hardware\inc/gpio.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h \
|
||||
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/pwm.h D:\psx\MPPT\git\App\inc/inflash.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/gpio.h \
|
||||
D:\psx\MPPT\git\App\inc/sl_protocol.h D:\psx\MPPT\git\App\inc/uart_dev.h \
|
||||
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/rs485.h D:\psx\MPPT\git\App\inc/task.h \
|
||||
|
@ -97,6 +99,8 @@ D:\psx\MPPT\git\App\inc/collect_Conversion.h:
|
|||
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h:
|
||||
|
||||
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
|
||||
|
||||
D:\psx\MPPT\git\Hardware\inc/pwm.h:
|
||||
|
||||
D:\psx\MPPT\git\App\inc/inflash.h:
|
||||
|
|
Binary file not shown.
|
@ -31,6 +31,6 @@ C_DEPS += \
|
|||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
App/src/%.o: ../App/src/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
||||
|
|
|
@ -30,8 +30,9 @@ App/src/task.o: ../App/src/task.c D:\psx\MPPT\git\App\inc/task.h \
|
|||
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/rs485.h D:\psx\MPPT\git\App\inc/uart_dev.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/tim.h D:\psx\MPPT\git\Hardware\inc/pwm.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/gpio.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/flash.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h \
|
||||
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
|
||||
D:\psx\MPPT\git\Hardware\inc/gpio.h D:\psx\MPPT\git\Hardware\inc/flash.h \
|
||||
D:\psx\MPPT\git\App\inc/sl_protocol.h \
|
||||
D:\psx\MPPT\git\App\inc/mppt_control.h D:\psx\MPPT\git\App\inc/inflash.h \
|
||||
D:\psx\MPPT\git\App\inc/collect_Conversion.h
|
||||
|
@ -110,6 +111,8 @@ D:\psx\MPPT\git\Hardware\inc/pwm.h:
|
|||
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h:
|
||||
|
||||
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
|
||||
|
||||
D:\psx\MPPT\git\Hardware\inc/gpio.h:
|
||||
|
||||
D:\psx\MPPT\git\Hardware\inc/flash.h:
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -16,6 +16,6 @@ C_DEPS += \
|
|||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
Core/%.o: ../Core/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ C_DEPS += \
|
|||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
Debug/%.o: ../Debug/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
||||
|
|
Binary file not shown.
|
@ -16,6 +16,6 @@ C_DEPS += \
|
|||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
Drivers/RingQueue/%.o: ../Drivers/RingQueue/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Drivers/RingQueue2/ring_queue2.o: ../Drivers/RingQueue2/ring_queue2.c \
|
||||
../Drivers/RingQueue2/ring_queue2.h
|
||||
|
||||
../Drivers/RingQueue2/ring_queue2.h:
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
################################################################################
|
||||
# MRS Version: 1.9.0
|
||||
# 自动生成的文件。不要编辑!
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../Drivers/RingQueue2/ring_queue2.c
|
||||
|
||||
OBJS += \
|
||||
./Drivers/RingQueue2/ring_queue2.o
|
||||
|
||||
C_DEPS += \
|
||||
./Drivers/RingQueue2/ring_queue2.d
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
Drivers/RingQueue2/%.o: ../Drivers/RingQueue2/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
|
@ -16,6 +16,6 @@ C_DEPS += \
|
|||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
Drivers/TimeSliceOffset/%.o: ../Drivers/TimeSliceOffset/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ Hardware/src/adc.o: ../Hardware/src/adc.c \
|
|||
D:\psx\MPPT\git\User/ch32l103_it.h D:\psx\MPPT\git\Debug/debug.h \
|
||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h \
|
||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
|
||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h
|
||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
|
||||
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h
|
||||
|
||||
D:\psx\MPPT\git\Hardware\inc/adc.h:
|
||||
|
||||
|
@ -84,3 +85,5 @@ D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h:
|
|||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h:
|
||||
|
||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h:
|
||||
|
||||
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -31,6 +31,6 @@ C_DEPS += \
|
|||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
Hardware/src/%.o: ../Hardware/src/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
||||
|
|
Binary file not shown.
|
@ -76,6 +76,6 @@ C_DEPS += \
|
|||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
Peripheral/src/%.o: ../Peripheral/src/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
||||
|
|
|
@ -22,6 +22,6 @@ C_DEPS += \
|
|||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
User/%.o: ../User/%.c
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
|
||||
@ @
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ RM := rm -rf
|
|||
-include Peripheral/src/subdir.mk
|
||||
-include Hardware/src/subdir.mk
|
||||
-include Drivers/TimeSliceOffset/subdir.mk
|
||||
-include Drivers/RingQueue2/subdir.mk
|
||||
-include Drivers/RingQueue/subdir.mk
|
||||
-include Debug/subdir.mk
|
||||
-include Core/subdir.mk
|
||||
|
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
20308
obj/mppt_Nos_V0.4.lst
20308
obj/mppt_Nos_V0.4.lst
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -27,6 +27,7 @@ App/src \
|
|||
Core \
|
||||
Debug \
|
||||
Drivers/RingQueue \
|
||||
Drivers/RingQueue2 \
|
||||
Drivers/TimeSliceOffset \
|
||||
Hardware/src \
|
||||
Peripheral/src \
|
||||
|
|
Loading…
Reference in New Issue