Compare commits
7 Commits
228f632d95
...
c6668e7f9a
Author | SHA1 | Date |
---|---|---|
起床就犯困 | c6668e7f9a | |
起床就犯困 | ff0ffbae91 | |
起床就犯困 | ca4948aa4e | |
起床就犯困 | 480aed0364 | |
起床就犯困 | 16e9dbf3a0 | |
起床就犯困 | fbc0117da7 | |
起床就犯困 | b85fbca8e0 |
|
@ -17,7 +17,7 @@
|
||||||
</extensions>
|
</extensions>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074" name="obj" parent="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release">
|
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074" name="obj" parent="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release" postbuildStep="riscv-none-embed-objcopy -O binary "${ProjName}.elf" "${ProjName}.bin"">
|
||||||
<folderInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074." name="/" resourcePath="">
|
<folderInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074." name="/" resourcePath="">
|
||||||
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release.231146001" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release">
|
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release.231146001" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release">
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1311852988" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1311852988" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon.2003631682" name="No common unitialized (-fno-common)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon" useByScannerDiscovery="true" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon.2003631682" name="No common unitialized (-fno-common)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon" useByScannerDiscovery="true" value="true" valueType="boolean"/>
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.xw.1819910041" name="Extra Compressed extension (RVXW)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.xw" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.xw.1819910041" name="Extra Compressed extension (RVXW)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.xw" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.saverestore.1179366128" name="Small prologue/epilogue (-msave-restore)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.saverestore" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.saverestore.1179366128" name="Small prologue/epilogue (-msave-restore)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.saverestore" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.rvGcc.536610708" name="RISC-V Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.rvGcc" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.base.target.rvGcc.8" valueType="enumerated"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.rvGcc.536610708" name="RISC-V Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.rvGcc" useByScannerDiscovery="false" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.base.target.rvGcc.8" valueType="enumerated"/>
|
||||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.1944008784" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.1944008784" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>
|
||||||
<builder buildPath="${workspace_loc:/mppt_Nos_V0.4}/obj" id="ilg.gnumcueclipse.managedbuild.cross.riscv.builder.1421508906" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="GNU Make 构建器" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.builder"/>
|
<builder buildPath="${workspace_loc:/mppt_Nos_V0.4}/obj" id="ilg.gnumcueclipse.managedbuild.cross.riscv.builder.1421508906" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="GNU Make 构建器" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.builder"/>
|
||||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1244756189" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler">
|
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1244756189" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler">
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.usenewlibnosys.351964161" name="Do not use syscalls (--specs=nosys.specs)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.usenewlibnosys" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.usenewlibnosys.351964161" name="Do not use syscalls (--specs=nosys.specs)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.usenewlibnosys" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.otherobjs.16994550" name="Other objects" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.otherobjs" useByScannerDiscovery="false" valueType="userObjs"/>
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.otherobjs.16994550" name="Other objects" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.otherobjs" useByScannerDiscovery="false" valueType="userObjs"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.flags.1125808200" name="Linker flags (-Xlinker [option])" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.flags" useByScannerDiscovery="false" valueType="stringList"/>
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.flags.1125808200" name="Linker flags (-Xlinker [option])" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.flags" useByScannerDiscovery="false" valueType="stringList"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs.1448587709" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs" useByScannerDiscovery="false" valueType="libs">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs.1448587709" name="Libraries (-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs" useByScannerDiscovery="false" valueType="libs">
|
||||||
<listOptionValue builtIn="false" value="m"/>
|
<listOptionValue builtIn="false" value="m"/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input.1859223768" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input">
|
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input.1859223768" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input">
|
||||||
|
@ -150,5 +150,4 @@
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||||
|
|
||||||
</cproject>
|
</cproject>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<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.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" 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="998107432084761222" 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.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
|
|
@ -50,15 +50,21 @@ typedef struct _config_info{
|
||||||
uint16_t floatI; /* 电压高于该(ConstantVoltageV / 100)且电流低于(FloatI / 100)进行浮充充电 */
|
uint16_t floatI; /* 电压高于该(ConstantVoltageV / 100)且电流低于(FloatI / 100)进行浮充充电 */
|
||||||
uint16_t startSolarOpenCircuitV; /* 太阳能板开路电压高于该(电压 / 100)开始充电 */
|
uint16_t startSolarOpenCircuitV; /* 太阳能板开路电压高于该(电压 / 100)开始充电 */
|
||||||
uint16_t stopSolarOpenCircuitV; /* 太阳能板开路电压高于该(电压 / 100)停止充电 */
|
uint16_t stopSolarOpenCircuitV; /* 太阳能板开路电压高于该(电压 / 100)停止充电 */
|
||||||
uint16_t noBatteryChargeV; /* 没有电池时的输出电压 */
|
uint16_t constantVoltageChargeV; /* 恒压充电时的输出电压 */
|
||||||
uint16_t FloatTime; /* 浮充时间(秒) */
|
uint16_t trickleChargeC; /* 涓流充电电流 */
|
||||||
|
// uint16_t FloatTime; /* 浮充时间(秒) */
|
||||||
|
uint16_t FloatV; /* 浮充电压 */
|
||||||
uint16_t checkSolarOpenCircuitVTime; /* 启动任务中太阳能板开路电压检测时间 */
|
uint16_t checkSolarOpenCircuitVTime; /* 启动任务中太阳能板开路电压检测时间 */
|
||||||
uint16_t registerRefreshTime; /* 寄存器数据刷新时间 */
|
uint16_t registerRefreshTime; /* 寄存器数据刷新时间 */
|
||||||
uint16_t resRefreshTime; /* 线阻计算间隔时长 */
|
uint16_t loopImpedance; /* 回路阻抗大小 */
|
||||||
|
// uint16_t resRefreshTime; /* 回路阻抗计算间隔时长 */
|
||||||
uint16_t sensorEnableBroadcastTime; /* 传感器运行再次注册的间隔 */
|
uint16_t sensorEnableBroadcastTime; /* 传感器运行再次注册的间隔 */
|
||||||
uint16_t HighSideMosTemperature_stop; /* 当上桥温度达到该值时,停止输出 */
|
uint16_t HighSideMosTemperature_stop; /* 当上桥温度达到该值时,停止输出 */
|
||||||
uint16_t HighSideMosTemperature_end; /* 当上桥温度上升到该值时,输出稳定在12V,降低功率运行 */
|
uint16_t HighSideMosTemperature_end; /* 当上桥温度上升到该值时,降低功率运行 */
|
||||||
uint16_t HighSideMosTemperature_start; /* 当上桥温度降低到该值时,按照正常情况输出 */
|
uint16_t HighSideMosTemperature_start; /* 当上桥温度降低到该值时,按照正常情况输出 */
|
||||||
|
uint16_t outputAgainFlagTime; /* 出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出 */
|
||||||
|
uint16_t excessiveLoadFlagTime; /* 出现过载后,在该段时间中再次出现过载,则关闭输出 */
|
||||||
|
uint16_t eLAgainTime; /* 出现过载过载保护后,该段时间后,再次尝试输出 */
|
||||||
uint8_t end_Flag; /* 结束标志 */
|
uint8_t end_Flag; /* 结束标志 */
|
||||||
}config_info;
|
}config_info;
|
||||||
#define CONFIG_INFO_SIZE (sizeof(config_info))
|
#define CONFIG_INFO_SIZE (sizeof(config_info))
|
||||||
|
@ -69,8 +75,8 @@ extern config_info g_slConfigInfo;
|
||||||
#define FLASH_SAVE_ADDR_BEGIN (0x00)
|
#define FLASH_SAVE_ADDR_BEGIN (0x00)
|
||||||
#define FLASH_SAVE_ADDR_END (0x00 + CONFIG_INFO_SIZE)
|
#define FLASH_SAVE_ADDR_END (0x00 + CONFIG_INFO_SIZE)
|
||||||
|
|
||||||
void save_config_info(config_info save_config_info);
|
void save_config_info(config_info *save_config_info);
|
||||||
uint8_t read_config_info(void);
|
uint8_t read_config_info(void);
|
||||||
|
uint8_t read_config_info1(config_info *in_config_info);
|
||||||
|
|
||||||
#endif /* APP_INC_INFLASH_H_ */
|
#endif /* APP_INC_INFLASH_H_ */
|
||||||
|
|
|
@ -18,7 +18,7 @@ void MpptMode(void);
|
||||||
void mppt_constantVoltage(float InVoltage);
|
void mppt_constantVoltage(float InVoltage);
|
||||||
void test(void);
|
void test(void);
|
||||||
void printf_data(void);
|
void printf_data(void);
|
||||||
float_t get_capturedata(float_t (*fun)(void));
|
//float_t get_capturedata(float_t (*fun)(void));
|
||||||
uint16_t get_mpptMode(void);
|
uint16_t get_mpptMode(void);
|
||||||
|
|
||||||
#endif /* APP_INC_MPPT_CONTROL_H_ */
|
#endif /* APP_INC_MPPT_CONTROL_H_ */
|
||||||
|
|
|
@ -30,13 +30,14 @@ typedef enum
|
||||||
SL_Register_address = 0x0001, /* 地址 */
|
SL_Register_address = 0x0001, /* 地址 */
|
||||||
SL_Register_Access_Node_Type = 0x0002, /* 接入节点类型 */
|
SL_Register_Access_Node_Type = 0x0002, /* 接入节点类型 */
|
||||||
SL_Register_Communication_Methods = 0x0003, /* 通信方式 */
|
SL_Register_Communication_Methods = 0x0003, /* 通信方式 */
|
||||||
SL_Register_Battery_Voltage = 0x0100, /* 电池电压 */
|
SL_Register_Output_Voltage = 0x0100, /* 输出电压 */
|
||||||
SL_Register_Charg_Current = 0x0101, /* 充电电流(流向电池+负载) */
|
SL_Register_Battery_Voltage = 0x0101, /* 电池电压 */
|
||||||
SL_Register_Discharg_Current = 0x0102, /* 放电电流(流向负载) */
|
SL_Register_Charg_Current = 0x0102, /* 充电电流(流向电池+负载) */
|
||||||
SL_Register_Solar_Open_Circuit_Voltage = 0x0103, /* 太阳能开路电压 */
|
SL_Register_Discharg_Current = 0x0103, /* 放电电流(流向负载) */
|
||||||
SL_Register_HighSideMos_Temperature = 0x0104, /* 高端mos的温度 */
|
SL_Register_Solar_Open_Circuit_Voltage = 0x0104, /* 太阳能开路电压 */
|
||||||
SL_Register_DischargMos_State = 0x0105, /* 放电mos的状态 */
|
SL_Register_HighSideMos_Temperature = 0x0105, /* 高端mos的温度 */
|
||||||
SL_Register_MPPT_Mode = 0x0106, /* 工作模式 */
|
SL_Register_DischargMos_State = 0x0106, /* 放电mos的状态 */
|
||||||
|
SL_Register_MPPT_Mode = 0x0107, /* 工作模式 */
|
||||||
}SL_Mppt_MsgRegister;
|
}SL_Mppt_MsgRegister;
|
||||||
|
|
||||||
/* 注册状态 */
|
/* 注册状态 */
|
||||||
|
@ -223,10 +224,12 @@ typedef struct _SL_Mppt_para{
|
||||||
uint8_t address[7]; /* 地址 */
|
uint8_t address[7]; /* 地址 */
|
||||||
uint16_t Access_Node_Type; /* 接入节点类型 */
|
uint16_t Access_Node_Type; /* 接入节点类型 */
|
||||||
uint16_t Communication_Methods; /* 通信方式 */
|
uint16_t Communication_Methods; /* 通信方式 */
|
||||||
|
float_t Output_Voltage; /* 输出电压 */
|
||||||
float_t Battery_Voltage; /* 电池电压 */
|
float_t Battery_Voltage; /* 电池电压 */
|
||||||
float_t Charg_Current; /* 充电电流(流向电池+负载) */
|
float_t Charg_Current; /* 充电电流(流向电池+负载) */
|
||||||
float_t Discharg_Current; /* 放电电流(流向负载) */
|
float_t Discharg_Current; /* 放电电流(流向负载) */
|
||||||
float_t Solar_Open_Circuit_Voltage; /* 太阳能开路电压 */
|
float_t Input_Voltage; /* 太阳能板输出电压 */
|
||||||
|
float_t Solar_Open_Circuit_Voltage; /* 太阳能板开路电压 */
|
||||||
float_t HighSideMos_Temperature; /* 高端mos的温度 */
|
float_t HighSideMos_Temperature; /* 高端mos的温度 */
|
||||||
uint16_t DischargMos_State; /* 放电mos的状态 */
|
uint16_t DischargMos_State; /* 放电mos的状态 */
|
||||||
uint16_t MPPT_Mode; /* 工作模式 */
|
uint16_t MPPT_Mode; /* 工作模式 */
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "uart_dev.h"
|
#include "uart_dev.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
|
//extern uint8_t g_interruptNum;
|
||||||
void stop_mpptWork(void);
|
void stop_mpptWork(void);
|
||||||
void start_mpptWork(void);
|
void start_mpptWork(void);
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ extern STR_TimeSliceOffset m_wdi;
|
||||||
extern void Task_wdi(void);
|
extern void Task_wdi(void);
|
||||||
|
|
||||||
#define refreshRegister_reloadVal 1000 /* 任务执行间隔 */
|
#define refreshRegister_reloadVal 1000 /* 任务执行间隔 */
|
||||||
#define refreshRegister_offset 0 /* 任务执行偏移量 */
|
#define refreshRegister_offset 100 /* 任务执行偏移量 */
|
||||||
extern STR_TimeSliceOffset m_refreshRegister;
|
extern STR_TimeSliceOffset m_refreshRegister;
|
||||||
extern uint8_t overTemperature;
|
extern uint8_t overTemperature;
|
||||||
extern void Task_refreshRegister(void);
|
extern void Task_refreshRegister(void);
|
||||||
|
@ -57,19 +58,26 @@ extern uint8_t g_recvBroadcastRegisterNumber; /*
|
||||||
extern STR_TimeSliceOffset m_recvbroadcast;
|
extern STR_TimeSliceOffset m_recvbroadcast;
|
||||||
extern void Task_recvbroadcast(void);
|
extern void Task_recvbroadcast(void);
|
||||||
|
|
||||||
#define impedanceCalculation_reloadVal 1000 /* 任务执行间隔 */
|
#define impedanceCalculation_reloadVal 200 /* 任务执行间隔 */
|
||||||
#define impedanceCalculation_offset 0 /* 任务执行偏移量 */
|
#define impedanceCalculation_offset 0 /* 任务执行偏移量 */
|
||||||
extern float_t g_impedance;
|
extern float_t g_impedance;
|
||||||
extern float_t voltOut;
|
extern uint8_t g_batteryState;
|
||||||
|
extern uint8_t g_impedanceStart;
|
||||||
extern STR_TimeSliceOffset m_impedanceCalculation;
|
extern STR_TimeSliceOffset m_impedanceCalculation;
|
||||||
extern void Task_impedanceCalculation(void);
|
extern void Task_impedanceCalculation(void);
|
||||||
|
|
||||||
#define outputAgain_reloadVal 2 /* 任务执行间隔 */
|
#define outputAgain_reloadVal 1000 /* 任务执行间隔 */
|
||||||
#define outputAgain_offset 0 /* 任务执行偏移量 */
|
#define outputAgain_offset 0 /* 任务执行偏移量 */
|
||||||
extern uint8_t outputAgainFlag;
|
extern uint8_t outputAgainFlag;
|
||||||
extern STR_TimeSliceOffset m_outputAgain;
|
extern STR_TimeSliceOffset m_outputAgain;
|
||||||
extern void Task_outputAgain(void);
|
extern void Task_outputAgain(void);
|
||||||
|
|
||||||
|
#define excessiveLoad_reloadVal 1000 /* 任务执行间隔 */
|
||||||
|
#define excessiveLoad_offset 0 /* 任务执行偏移量 */
|
||||||
|
extern uint8_t excessiveLoadFlag;
|
||||||
|
extern STR_TimeSliceOffset m_excessiveLoad;
|
||||||
|
extern void Task_excessiveLoad(void);
|
||||||
|
|
||||||
#define sensorEnableBroadcast_reloadVal 1000 /* 任务执行间隔 */
|
#define sensorEnableBroadcast_reloadVal 1000 /* 任务执行间隔 */
|
||||||
#define sensorEnableBroadcast_offset 0 /* 任务执行偏移量 */
|
#define sensorEnableBroadcast_offset 0 /* 任务执行偏移量 */
|
||||||
extern STR_TimeSliceOffset m_sensorEnableBroadcast;
|
extern STR_TimeSliceOffset m_sensorEnableBroadcast;
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include "uart_dev.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define ONLYPOWER 1
|
||||||
|
|
||||||
#define CHG_CURR ADC_Channel_1
|
#define CHG_CURR ADC_Channel_1
|
||||||
#define PV_VOLT_OUT ADC_Channel_2
|
#define PV_VOLT_OUT ADC_Channel_2
|
||||||
|
@ -23,14 +27,39 @@
|
||||||
|
|
||||||
//#define enable_Printf_VI
|
//#define enable_Printf_VI
|
||||||
|
|
||||||
|
#ifdef ONLYPOWER
|
||||||
|
/* 光伏充电输出电流比例,放大倍数*电阻 */
|
||||||
|
const float P_CHG_CURR = (1.0 / (50 * 0.005 / 2));
|
||||||
|
/* 光伏充电输出电压比例,分压系数(放电时采集不准) */
|
||||||
|
//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_DSG_CURR = (1.0 / (50 * 0.005 / 2));
|
||||||
|
///* 光伏1开路输出电压比例 */
|
||||||
|
const float P_PV1_VOLT_IN = (100 + 4.7) / 4.7;
|
||||||
|
//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_MOSFET_TEMPER = 0;
|
||||||
|
/* 光伏2开路输出电压比例 */
|
||||||
|
const float P_PV2_VOLT_IN = (100.0 + 4.7) / 4.7;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ONLYPOWER
|
||||||
/* 光伏充电输出电流比例,放大倍数*电阻 */
|
/* 光伏充电输出电流比例,放大倍数*电阻 */
|
||||||
const float P_CHG_CURR = (1.0 / (50 * 0.005));
|
const float P_CHG_CURR = (1.0 / (50 * 0.005));
|
||||||
/* 光伏充电输出电压比例,分压系数(放电时采集不准) */
|
/* 光伏充电输出电压比例,分压系数(放电时采集不准) */
|
||||||
const float P_PV_VOLT_OUT = (47.0 + 10.0) / 10.0;
|
//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_DSG_CURR = (1.0 / (50 * 0.005));
|
const float P_DSG_CURR = (1.0 / (50 * 0.005));
|
||||||
///* 光伏1开路输出电压比例 */
|
///* 光伏1开路输出电压比例 */
|
||||||
const float P_PV1_VOLT_IN = (100 + 4.7) / 4.7;
|
//const float P_PV1_VOLT_IN = (100 + 4.7) / 4.7;
|
||||||
|
const float P_PV1_VOLT_IN = (47.0 + 4.7) / 4.7;
|
||||||
/* 光伏1开路输出电压比例 */
|
/* 光伏1开路输出电压比例 */
|
||||||
//const float P_PV1_VOLT_IN = (47 + 4.7) / 4.7;
|
//const float P_PV1_VOLT_IN = (47 + 4.7) / 4.7;
|
||||||
/* 系统电源电压比例 */
|
/* 系统电源电压比例 */
|
||||||
|
@ -39,42 +68,116 @@ const float P_PV_VOLT_IN1 = (47 + 4.7) / 4.7;
|
||||||
//const float P_MOSFET_TEMPER = 0;
|
//const float P_MOSFET_TEMPER = 0;
|
||||||
/* 光伏2开路输出电压比例 */
|
/* 光伏2开路输出电压比例 */
|
||||||
const float P_PV2_VOLT_IN = (47 + 4.7) / 4.7;
|
const float P_PV2_VOLT_IN = (47 + 4.7) / 4.7;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 温度的adc值的个数 */
|
/* 温度的adc值的个数 */
|
||||||
#define mosTemperADCLen 241
|
#define mosTemperADCLen 241
|
||||||
|
///* 温度 */
|
||||||
|
//const uint16_t mosTemperADC[mosTemperADCLen] = {
|
||||||
|
// 3707, 3697, 3687, 3676, 3665, 3654, 3643, 3632, 3620, 3608, /* -20 - -15.5 ℃ */
|
||||||
|
// 3596, 3584, 3571, 3559, 3546, 3533, 3519, 3506, 3492, 3478, /* -15 - -10.5 ℃ */
|
||||||
|
// 3464, 3449, 3434, 3419, 3404, 3389, 3373, 3358, 3341, 3325, /* -10 - -5.5 ℃ */
|
||||||
|
// 3309, 3292, 3275, 3258, 3241, 3223, 3205, 3187, 3169, 3151, /* -5 - -0.5 ℃ */
|
||||||
|
// 3132, 3114, 3095, 3075, 3056, 3037, 3017, 2997, 2977, 2957, /* 0 - 4.5 ℃ */
|
||||||
|
// 2936, 2916, 2895, 2874, 2854, 2832, 2811, 2790, 2768, 2747, /* 9 - 9.5 ℃ */
|
||||||
|
// 2725, 2703, 2681, 2659, 2637, 2615, 2592, 2570, 2548, 2525, /* 10 - 14.5 ℃ */
|
||||||
|
// 2503, 2480, 2457, 2435, 2412, 2389, 2366, 2343, 2321, 2298, /* 15 - 19.5 ℃ */
|
||||||
|
// 2275, 2252, 2229, 2207, 2184, 2161, 2138, 2116, 2093, 2071, /* 20 - 24.5 ℃ */
|
||||||
|
// 2048, 2026, 2003, 1981, 1959, 1937, 1914, 1893, 1871, 1849, /* 25 - 29.5 ℃ */
|
||||||
|
// 1827, 1806, 1784, 1763, 1742, 1721, 1700, 1679, 1658, 1638, /* 30 - 34.5 ℃ */
|
||||||
|
// 1617, 1597, 1577, 1557, 1537, 1518, 1498, 1479, 1460, 1441, /* 35 - 39.5 ℃ */
|
||||||
|
// 1422, 1403, 1385, 1366, 1348, 1330, 1312, 1295, 1277, 1260, /* 40 - 44.5 ℃ */
|
||||||
|
// 1243, 1226, 1209, 1192, 1176, 1160, 1144, 1128, 1112, 1097, /* 45 - 49.5 ℃ */
|
||||||
|
// 1081, 1066, 1051, 1036, 1022, 1007, 993, 979, 965, 951, /* 50 - 54.5 ℃ */
|
||||||
|
// 938, 924, 911, 898, 885, 872, 860, 848, 835, 823, /* 55 - 59.5 ℃ */
|
||||||
|
// 811, 800, 788, 777, 765, 754, 743, 732, 722, 711, /* 60 - 64.5 ℃ */
|
||||||
|
// 701, 691, 681, 671, 661, 651, 642, 632, 623, 614, /* 65 - 69.5 ℃ */
|
||||||
|
// 605, 596, 588, 579, 571, 562, 554, 546, 538, 530, /* 70 - 74.5 ℃ */
|
||||||
|
// 522, 515, 507, 500, 493, 486, 478, 471, 465, 458, /* 75 - 79.5 ℃ */
|
||||||
|
// 451, 445, 438, 432, 426, 420, 414, 408, 402, 396, /* 80 - 84.5 ℃ */
|
||||||
|
// 390, 385, 379, 374, 368, 363, 358, 353, 348, 343, /* 85 - 89.5 ℃ */
|
||||||
|
// 338, 333, 328, 324, 319, 315, 310, 306, 301, 297, /* 90 - 94.5 ℃ */
|
||||||
|
// 293, 289, 285, 281, 277, 273, 269, 266, 262, 258, /* 95 - 99.5 ℃ */
|
||||||
|
// 255 /* 100 ℃ */
|
||||||
|
//};
|
||||||
/* 温度 */
|
/* 温度 */
|
||||||
const uint16_t mosTemperADC[mosTemperADCLen] = {
|
const uint16_t mosTemperADC[mosTemperADCLen] = {
|
||||||
3707, 3697, 3687, 3676, 3665, 3654, 3643, 3632, 3620, 3608, /* -20 - -15.5 ¡æ */
|
4893, 4879, 4866, 4852, 4838, 4823, 4808, 4793, 4778, 4762, /* -20 - -15.5 ℃ */
|
||||||
3596, 3584, 3571, 3559, 3546, 3533, 3519, 3506, 3492, 3478, /* -15 - -10.5 ¡æ */
|
4746, 4730, 4714, 4697, 4680, 4663, 4645, 4627, 4609, 4590, /* -15 - -10.5 ℃ */
|
||||||
3464, 3449, 3434, 3419, 3404, 3389, 3373, 3358, 3341, 3325, /* -10 - -5.5 ¡æ */
|
4571, 4552, 4533, 4513, 4493, 4473, 4452, 4431, 4410, 4389, /* -10 - -5.5 ℃ */
|
||||||
3309, 3292, 3275, 3258, 3241, 3223, 3205, 3187, 3169, 3151, /* -5 - -0.5 ¡æ */
|
4367, 4345, 4323, 4300, 4277, 4254, 4231, 4207, 4183, 4159, /* -5 - -0.5 ℃ */
|
||||||
3132, 3114, 3095, 3075, 3056, 3037, 3017, 2997, 2977, 2957, /* 0 - 4.5 ¡æ */
|
4134, 4109, 4084, 4059, 4034, 4008, 3982, 3956, 3929, 3903, /* 0 - 4.5 ℃ */
|
||||||
2936, 2916, 2895, 2874, 2854, 2832, 2811, 2790, 2768, 2747, /* 9 - 9.5 ¡æ */
|
3876, 3849, 3821, 3794, 3766, 3738, 3710, 3682, 3654, 3625, /* 5 - 9.5 ℃ */
|
||||||
2725, 2703, 2681, 2659, 2637, 2615, 2592, 2570, 2548, 2525, /* 10 - 14.5 ¡æ */
|
3596, 3568, 3539, 3510, 3480, 3451, 3422, 3392, 3362, 3333, /* 10 - 14.5 ℃ */
|
||||||
2503, 2480, 2457, 2435, 2412, 2389, 2366, 2343, 2321, 2298, /* 15 - 19.5 ¡æ */
|
3303, 3273, 3243, 3213, 3183, 3153, 3123, 3093, 3063, 3033, /* 15 - 19.5 ℃ */
|
||||||
2275, 2252, 2229, 2207, 2184, 2161, 2138, 2116, 2093, 2071, /* 20 - 24.5 ¡æ */
|
3003, 2972, 2942, 2912, 2882, 2852, 2822, 2792, 2762, 2733, /* 20 - 24.5 ℃ */
|
||||||
2048, 2026, 2003, 1981, 1959, 1937, 1914, 1893, 1871, 1849, /* 25 - 29.5 ¡æ */
|
2703, 2673, 2644, 2614, 2585, 2556, 2527, 2498, 2469, 2440, /* 25 - 29.5 ℃ */
|
||||||
1827, 1806, 1784, 1763, 1742, 1721, 1700, 1679, 1658, 1638, /* 30 - 34.5 ¡æ */
|
2412, 2383, 2355, 2327, 2299, 2271, 2243, 2216, 2189, 2162, /* 30 - 34.5 ℃ */
|
||||||
1617, 1597, 1577, 1557, 1537, 1518, 1498, 1479, 1460, 1441, /* 35 - 39.5 ¡æ */
|
2135, 2108, 2081, 2055, 2029, 2003, 1977, 1952, 1926, 1901, /* 35 - 39.5 ℃ */
|
||||||
1422, 1403, 1385, 1366, 1348, 1330, 1312, 1295, 1277, 1260, /* 40 - 44.5 ¡æ */
|
1876, 1852, 1827, 1803, 1779, 1755, 1732, 1709, 1686, 1663, /* 40 - 44.5 ℃ */
|
||||||
1243, 1226, 1209, 1192, 1176, 1160, 1144, 1128, 1112, 1097, /* 45 - 49.5 ¡æ */
|
1640, 1618, 1596, 1574, 1552, 1531, 1510, 1489, 1468, 1447, /* 45 - 49.5 ℃ */
|
||||||
1081, 1066, 1051, 1036, 1022, 1007, 993, 979, 965, 951, /* 50 - 54.5 ¡æ */
|
1427, 1407, 1387, 1368, 1349, 1330, 1311, 1292, 1274, 1256, /* 50 - 54.5 ℃ */
|
||||||
938, 924, 911, 898, 885, 872, 860, 848, 835, 823, /* 55 - 59.5 ¡æ */
|
1238, 1220, 1203, 1185, 1168, 1151, 1135, 1119, 1102, 1086, /* 55 - 59.5 ℃ */
|
||||||
811, 800, 788, 777, 765, 754, 743, 732, 722, 711, /* 60 - 64.5 ¡æ */
|
1071, 1055, 1040, 1025, 1010, 995, 981, 967, 953, 939, /* 60 - 64.5 ℃ */
|
||||||
701, 691, 681, 671, 661, 651, 642, 632, 623, 614, /* 65 - 69.5 ¡æ */
|
925, 912, 898, 885, 872, 860, 847, 835, 822, 810, /* 65 - 69.5 ℃ */
|
||||||
605, 596, 588, 579, 571, 562, 554, 546, 538, 530, /* 70 - 74.5 ¡æ */
|
799, 787, 775, 764, 753, 742, 731, 721, 710, 700, /* 70 - 74.5 ℃ */
|
||||||
522, 515, 507, 500, 493, 486, 478, 471, 465, 458, /* 75 - 79.5 ¡æ */
|
690, 679, 670, 660, 650, 641, 631, 622, 613, 604, /* 75 - 79.5 ℃ */
|
||||||
451, 445, 438, 432, 426, 420, 414, 408, 402, 396, /* 80 - 84.5 ¡æ */
|
596, 587, 578, 570, 562, 554, 546, 538, 530, 523, /* 80 - 84.5 ℃ */
|
||||||
390, 385, 379, 374, 368, 363, 358, 353, 348, 343, /* 85 - 89.5 ¡æ */
|
515, 508, 500, 493, 486, 479, 472, 466, 459, 452, /* 85 - 89.5 ℃ */
|
||||||
338, 333, 328, 324, 319, 315, 310, 306, 301, 297, /* 90 - 94.5 ¡æ */
|
446, 440, 433, 427, 421, 415, 409, 404, 398, 392, /* 90 - 94.5 ℃ */
|
||||||
293, 289, 285, 281, 277, 273, 269, 266, 262, 258, /* 95 - 99.5 ¡æ */
|
387, 381, 376, 371, 366, 361, 355, 350, 346, 341, /* 95 - 99.5 ℃ */
|
||||||
255 /* 100 ¡æ */
|
336 /* 100 ℃ */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static uint16_t get_adc(uint8_t ADC_Channel);
|
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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取计算后的adc的值
|
||||||
|
* @param ADC_Channel ADC通道
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
uint16_t get_aftercalculationAdc(uint8_t ADC_Channel)
|
||||||
|
{
|
||||||
|
return middleAverageFilter(ADC_Channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define N 6
|
||||||
|
/**
|
||||||
|
* @brief 中位值平均滤波
|
||||||
|
* @param ADC_Channel ADC通道
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
uint16_t middleAverageFilter(uint8_t ADC_Channel)
|
||||||
|
{
|
||||||
|
uint16_t i,j,k;
|
||||||
|
uint16_t temp,sum = 0;
|
||||||
|
uint16_t value_buf[N];
|
||||||
|
for(i = 0; i < N; ++i)
|
||||||
|
{
|
||||||
|
value_buf[i] = get_adc(ADC_Channel);
|
||||||
|
}
|
||||||
|
/*从小到大冒泡排序*/
|
||||||
|
for(j = 0; j < N-1; ++j)
|
||||||
|
{
|
||||||
|
for(k = 0; k < N-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 < N-2; ++i)
|
||||||
|
{
|
||||||
|
sum += value_buf[i];
|
||||||
|
}
|
||||||
|
return sum/(N-4);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 将采集的adc进行校准
|
* @brief 将采集的adc进行校准
|
||||||
|
@ -97,13 +200,14 @@ uint16_t Get_ConversionVal(int16_t val)
|
||||||
*/
|
*/
|
||||||
uint16_t get_adc(uint8_t ADC_Channel)
|
uint16_t get_adc(uint8_t ADC_Channel)
|
||||||
{
|
{
|
||||||
uint16_t val;
|
int16_t val;
|
||||||
ADC_RegularChannelConfig(ADC1, ADC_Channel, 1, ADC_SampleTime_CyclesMode5);
|
ADC_RegularChannelConfig(ADC1, ADC_Channel, 1, ADC_SampleTime_CyclesMode5);
|
||||||
// ADC_RegularChannelConfig(ADC1, ADC_Channel, 1, ADC_SampleTime_CyclesMode7);
|
// ADC_RegularChannelConfig(ADC1, ADC_Channel, 1, ADC_SampleTime_CyclesMode7);
|
||||||
ADC_SoftwareStartConvCmd(ADC1, ENABLE);
|
ADC_SoftwareStartConvCmd(ADC1, ENABLE);
|
||||||
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC));
|
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC));
|
||||||
val = ADC_GetConversionValue(ADC1);
|
val = ADC_GetConversionValue(ADC1);
|
||||||
return val;
|
// return val;
|
||||||
|
return Get_ConversionVal(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,10 +220,12 @@ float get_CHG_CURR(void)
|
||||||
float I;
|
float I;
|
||||||
uint16_t I_ADC;
|
uint16_t I_ADC;
|
||||||
|
|
||||||
I_ADC = Get_ConversionVal(get_adc(CHG_CURR));
|
// I_ADC = Get_ConversionVal(get_adc(CHG_CURR));
|
||||||
|
I_ADC = get_aftercalculationAdc(CHG_CURR);
|
||||||
// I_ADC = get_adc(CHG_CURR);
|
// I_ADC = get_adc(CHG_CURR);
|
||||||
|
|
||||||
I = (float)(I_ADC) / 4095 * 3.3 * P_CHG_CURR * 2;
|
// I = (float)(I_ADC) / 4095 * 3.3 * P_CHG_CURR * 2;
|
||||||
|
I = (float)(I_ADC) / 4095 * 2.5 * P_CHG_CURR;
|
||||||
|
|
||||||
// printf(" CHG_CURR I : %d /10000 \n", (int)(I * 10000));
|
// printf(" CHG_CURR I : %d /10000 \n", (int)(I * 10000));
|
||||||
#ifdef enable_Printf_VI
|
#ifdef enable_Printf_VI
|
||||||
|
@ -140,10 +246,16 @@ float get_PV_VOLT_OUT(void)
|
||||||
float V;
|
float V;
|
||||||
uint16_t V_ADC;
|
uint16_t V_ADC;
|
||||||
|
|
||||||
V_ADC = Get_ConversionVal(get_adc(PV_VOLT_OUT));
|
// V_ADC = Get_ConversionVal(get_adc(PV_VOLT_OUT));
|
||||||
|
V_ADC = get_aftercalculationAdc(PV_VOLT_OUT);
|
||||||
// V_ADC = get_adc(PV_VOLT_OUT);
|
// V_ADC = get_adc(PV_VOLT_OUT);
|
||||||
|
|
||||||
V = (float)(V_ADC) / 4095 * 3.3 * P_PV_VOLT_OUT;
|
V = (float)(V_ADC) / 4095 * 2.5 * P_PV_VOLT_OUT;
|
||||||
|
//
|
||||||
|
// char buffer[30];
|
||||||
|
// memset(buffer, 0, sizeof(buffer));
|
||||||
|
// sprintf(buffer, " PV_VOLT_OUT ADC : %d \n", V_ADC);
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||||
|
|
||||||
#ifdef enable_Printf_VI
|
#ifdef enable_Printf_VI
|
||||||
printf("\n PV_VOLT_OUT ADC : %d \n", V_ADC);
|
printf("\n PV_VOLT_OUT ADC : %d \n", V_ADC);
|
||||||
|
@ -163,10 +275,12 @@ float get_DSG_CURR(void)
|
||||||
float I;
|
float I;
|
||||||
uint16_t I_ADC;
|
uint16_t I_ADC;
|
||||||
|
|
||||||
I_ADC = Get_ConversionVal(get_adc(DSG_CURR));
|
// I_ADC = Get_ConversionVal(get_adc(DSG_CURR));
|
||||||
|
I_ADC = get_aftercalculationAdc(DSG_CURR);
|
||||||
// I_ADC = get_adc(DSG_CURR);
|
// I_ADC = get_adc(DSG_CURR);
|
||||||
|
|
||||||
I = (float)(I_ADC) / 4095 * 3.3 * P_DSG_CURR * 2;
|
// I = (float)(I_ADC) / 4095 * 3.3 * P_DSG_CURR * 2;
|
||||||
|
I = (float)(I_ADC) / 4095 * 2.5 * P_DSG_CURR;
|
||||||
|
|
||||||
#ifdef enable_Printf_VI
|
#ifdef enable_Printf_VI
|
||||||
printf("\n DSG_CURR ADC : %d \n", I_ADC);
|
printf("\n DSG_CURR ADC : %d \n", I_ADC);
|
||||||
|
@ -187,11 +301,13 @@ float get_PV1_VOLT_IN(void)
|
||||||
uint16_t V_ADC;
|
uint16_t V_ADC;
|
||||||
|
|
||||||
// GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, SET);
|
// GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, SET);
|
||||||
V_ADC = Get_ConversionVal(get_adc(PV1_VOLT_IN));
|
// V_ADC = Get_ConversionVal(get_adc(PV1_VOLT_IN));
|
||||||
|
V_ADC = get_aftercalculationAdc(PV1_VOLT_IN);
|
||||||
|
|
||||||
// V_ADC = get_adc(PV1_VOLT_IN);
|
// V_ADC = get_adc(PV1_VOLT_IN);
|
||||||
// GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, RESET);
|
// GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, RESET);
|
||||||
|
|
||||||
V = (float)(V_ADC) / 4095 * 3.3 * P_PV1_VOLT_IN;
|
V = (float)(V_ADC) / 4095 * 2.5 * P_PV1_VOLT_IN;
|
||||||
|
|
||||||
#ifdef enable_Printf_VI
|
#ifdef enable_Printf_VI
|
||||||
printf("\n PV1_VOLT_IN ADC : %d \n", V_ADC);
|
printf("\n PV1_VOLT_IN ADC : %d \n", V_ADC);
|
||||||
|
@ -211,10 +327,11 @@ float get_PV_VOLT_IN1(void)
|
||||||
float V;
|
float V;
|
||||||
uint16_t V_ADC;
|
uint16_t V_ADC;
|
||||||
|
|
||||||
V_ADC = Get_ConversionVal(get_adc(PV_VOLT_IN1));
|
// V_ADC = Get_ConversionVal(get_adc(PV_VOLT_IN1));
|
||||||
|
V_ADC = get_aftercalculationAdc(PV_VOLT_IN1);
|
||||||
// V_ADC = get_adc(PV_VOLT_IN1);
|
// V_ADC = get_adc(PV_VOLT_IN1);
|
||||||
|
|
||||||
V = (float)(V_ADC) / 4095 * 3.3 * P_PV_VOLT_IN1;
|
V = (float)(V_ADC) / 4095 * 2.5 * P_PV_VOLT_IN1;
|
||||||
|
|
||||||
#ifdef enable_Printf_VI
|
#ifdef enable_Printf_VI
|
||||||
printf("\n PV_VOLT_IN1 ADC : %d \n", V_ADC);
|
printf("\n PV_VOLT_IN1 ADC : %d \n", V_ADC);
|
||||||
|
@ -240,7 +357,14 @@ float get_MOSFET_Temper(void)
|
||||||
float T = 0;
|
float T = 0;
|
||||||
uint16_t T_ADC;
|
uint16_t T_ADC;
|
||||||
|
|
||||||
T_ADC = Get_ConversionVal(get_adc(MOSFET_Temper));
|
// T_ADC = Get_ConversionVal(get_adc(MOSFET_Temper));
|
||||||
|
T_ADC = get_aftercalculationAdc(MOSFET_Temper);
|
||||||
|
|
||||||
|
// char buffer[30];
|
||||||
|
// memset(buffer, 0, sizeof(buffer));
|
||||||
|
// sprintf(buffer, " T_ADC : %d \n", T_ADC);
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||||
|
// Delay_Ms(1);
|
||||||
|
|
||||||
for (int i = 0; i < mosTemperADCLen; ++i) {
|
for (int i = 0; i < mosTemperADCLen; ++i) {
|
||||||
if (T_ADC >= mosTemperADC[i]) {
|
if (T_ADC >= mosTemperADC[i]) {
|
||||||
|
@ -276,11 +400,12 @@ float get_PV2_VOLT_IN(void)
|
||||||
uint16_t V_ADC;
|
uint16_t V_ADC;
|
||||||
|
|
||||||
// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
|
// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
|
||||||
V_ADC = Get_ConversionVal(get_adc(PV2_VOLT_IN));
|
// V_ADC = Get_ConversionVal(get_adc(PV2_VOLT_IN));
|
||||||
|
V_ADC = get_aftercalculationAdc(PV2_VOLT_IN);
|
||||||
// V_ADC = get_adc(PV2_VOLT_IN);
|
// V_ADC = get_adc(PV2_VOLT_IN);
|
||||||
// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, RESET);
|
// GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, RESET);
|
||||||
|
|
||||||
V = (float)(V_ADC) / 4095 * 3.3 * P_PV2_VOLT_IN;
|
V = (float)(V_ADC) / 4095 * 2.5 * P_PV2_VOLT_IN;
|
||||||
|
|
||||||
#ifdef enable_Printf_VI
|
#ifdef enable_Printf_VI
|
||||||
printf("\n PV2_VOLT_IN ADC : %d \n", V_ADC);
|
printf("\n PV2_VOLT_IN ADC : %d \n", V_ADC);
|
||||||
|
|
|
@ -11,19 +11,25 @@
|
||||||
|
|
||||||
config_info g_slConfigInfo = {
|
config_info g_slConfigInfo = {
|
||||||
.constantCurrentV = 1000,
|
.constantCurrentV = 1000,
|
||||||
.constantVoltageV = 1400,
|
.constantVoltageV = 1420,
|
||||||
.floatI = 10,
|
.floatI = 20,
|
||||||
.startSolarOpenCircuitV = 1700,
|
.startSolarOpenCircuitV = 1700,
|
||||||
.stopSolarOpenCircuitV = 1500,
|
.stopSolarOpenCircuitV = 1500,
|
||||||
.noBatteryChargeV = 1200,
|
.constantVoltageChargeV = 1440,
|
||||||
.FloatTime = 10,
|
.trickleChargeC = 100,
|
||||||
|
// .FloatTime = 10,
|
||||||
|
.FloatV = 1420,
|
||||||
.checkSolarOpenCircuitVTime = 10,
|
.checkSolarOpenCircuitVTime = 10,
|
||||||
.registerRefreshTime = 1,
|
.registerRefreshTime = 1,
|
||||||
.resRefreshTime = 1,
|
.loopImpedance = 20,
|
||||||
|
// .resRefreshTime = 1,
|
||||||
.sensorEnableBroadcastTime = 20,
|
.sensorEnableBroadcastTime = 20,
|
||||||
.HighSideMosTemperature_stop = 70,
|
.HighSideMosTemperature_stop = 70,
|
||||||
.HighSideMosTemperature_end = 50,
|
.HighSideMosTemperature_end = 50,
|
||||||
.HighSideMosTemperature_start = 40,
|
.HighSideMosTemperature_start = 40,
|
||||||
|
.outputAgainFlagTime = 10,
|
||||||
|
.excessiveLoadFlagTime = 60,
|
||||||
|
.eLAgainTime = 3600,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,9 +38,9 @@ config_info g_slConfigInfo = {
|
||||||
* @param save_config_info ÐèÒª±£´æµÄÅäÖÃÐÅÏ¢
|
* @param save_config_info ÐèÒª±£´æµÄÅäÖÃÐÅÏ¢
|
||||||
* @retval
|
* @retval
|
||||||
*/
|
*/
|
||||||
void save_config_info(config_info save_config_info)
|
void save_config_info(config_info *save_config_info)
|
||||||
{
|
{
|
||||||
SPI_Flash_Write((uint8_t *)&save_config_info, FLASH_SAVE_ADDR_BEGIN, CONFIG_INFO_SIZE);
|
SPI_Flash_Write((uint8_t *)save_config_info, FLASH_SAVE_ADDR_BEGIN, CONFIG_INFO_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,12 +73,39 @@ uint8_t read_config_info(void)
|
||||||
g_slConfigInfo.end_Flag = defaultValue.end_Flag;
|
g_slConfigInfo.end_Flag = defaultValue.end_Flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 读取配置信息
|
||||||
|
* @param read_config_info1 读取的配置信息并保存在in_config_info中
|
||||||
|
* @retval 0 flash中读取配置失败,使用默认配置
|
||||||
|
* 1 flash中读取配置成功
|
||||||
|
*/
|
||||||
|
uint8_t read_config_info1(config_info *in_config_info)
|
||||||
|
{
|
||||||
|
config_info temp_config_info;
|
||||||
|
SPI_Flash_Read((uint8_t *)&temp_config_info, FLASH_SAVE_ADDR_BEGIN, CONFIG_INFO_SIZE);
|
||||||
|
if (temp_config_info.start_Flag[0] == 'S'
|
||||||
|
&& temp_config_info.start_Flag[1] == 'L'
|
||||||
|
&& temp_config_info.end_Flag == 0x16) {
|
||||||
|
*in_config_info = temp_config_info;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
in_config_info->start_Flag[0] = defaultValue.start_Flag[0];
|
||||||
|
in_config_info->start_Flag[1] = defaultValue.start_Flag[1];
|
||||||
|
in_config_info->address[0] = defaultValue.address[0];
|
||||||
|
in_config_info->address[1] = defaultValue.address[1];
|
||||||
|
in_config_info->address[2] = defaultValue.address[2];
|
||||||
|
in_config_info->address[3] = defaultValue.address[3];
|
||||||
|
in_config_info->address[4] = defaultValue.address[4];
|
||||||
|
in_config_info->address[5] = defaultValue.address[5];
|
||||||
|
in_config_info->address[6] = defaultValue.address[6];
|
||||||
|
in_config_info->end_Flag = defaultValue.end_Flag;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,11 @@ static void TrickleCharge(void);
|
||||||
static void ConstantCurrentCharge(void);
|
static void ConstantCurrentCharge(void);
|
||||||
static void ConstantVoltageCharge(void);
|
static void ConstantVoltageCharge(void);
|
||||||
static void FloatingCharge(void);
|
static void FloatingCharge(void);
|
||||||
static void NoBatteryCharge(void);
|
//static void NoBatteryCharge(void);
|
||||||
|
|
||||||
|
|
||||||
/* 占空比 */
|
/* 占空比 */
|
||||||
float g_duty_ratio = 0.7;
|
float g_duty_ratio = 0.75;
|
||||||
/* 用于确定工作模式 */
|
/* 用于确定工作模式 */
|
||||||
//static uint8_t modeFlag = 2;
|
//static uint8_t modeFlag = 2;
|
||||||
|
|
||||||
|
@ -149,35 +149,35 @@ void printf_data(void)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
float_t get_capturedata(float_t (*fun)(void))
|
//float_t get_capturedata(float_t (*fun)(void))
|
||||||
{
|
//{
|
||||||
float_t temp1;
|
// float_t temp1;
|
||||||
float_t temp[3];
|
// float_t temp[3];
|
||||||
|
//
|
||||||
for (int i = 0; i < 3; ++i) {
|
// for (int i = 0; i < 3; ++i) {
|
||||||
temp[i] = fun();
|
// temp[i] = fun();
|
||||||
// Delay_Us(1);
|
//// Delay_Us(1);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (temp[0] > temp[1]) {
|
// if (temp[0] > temp[1]) {
|
||||||
temp1 = temp[0];
|
// temp1 = temp[0];
|
||||||
temp[0] = temp[1];
|
// temp[0] = temp[1];
|
||||||
temp[1] = temp1;
|
// temp[1] = temp1;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (temp[0] > temp[2]) {
|
// if (temp[0] > temp[2]) {
|
||||||
temp1 = temp[0];
|
// temp1 = temp[0];
|
||||||
temp[0] = temp[2];
|
// temp[0] = temp[2];
|
||||||
temp[2] = temp1;
|
// temp[2] = temp1;
|
||||||
if (temp[1] > temp[2]) {
|
// if (temp[1] > temp[2]) {
|
||||||
temp1 = temp[1];
|
// temp1 = temp[1];
|
||||||
temp[1] = temp[2];
|
// temp[1] = temp[2];
|
||||||
temp[2] = temp1;
|
// temp[2] = temp1;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return temp[1];
|
// return temp[1];
|
||||||
}
|
//}
|
||||||
|
|
||||||
//uint16_t get_mpptMode(void)
|
//uint16_t get_mpptMode(void)
|
||||||
//{
|
//{
|
||||||
|
@ -230,7 +230,10 @@ void mppt_constantVoltage(float InVoltage)
|
||||||
// allError += error;
|
// allError += error;
|
||||||
// printf("111\n");
|
// printf("111\n");
|
||||||
|
|
||||||
float_t pv1Volt = get_capturedata(get_PV1_VOLT_IN);
|
// float_t pv1Volt = get_capturedata(get_PV1_VOLT_IN);
|
||||||
|
|
||||||
|
// float_t pv1Volt = get_PV1_VOLT_IN();
|
||||||
|
float_t pv1Volt = g_Mppt_Para.Input_Voltage;
|
||||||
// printf("volt in : %d \n", pv1Volt);
|
// printf("volt in : %d \n", pv1Volt);
|
||||||
float_t error = pv1Volt - InVoltage;
|
float_t error = pv1Volt - InVoltage;
|
||||||
// float_t error = InVoltage - pv1Volt;
|
// float_t error = InVoltage - pv1Volt;
|
||||||
|
@ -245,7 +248,65 @@ void mppt_constantVoltage(float InVoltage)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ºã¶¨Êä³öµçѹ
|
* @brief 恒定输出电压(电池)
|
||||||
|
* @param
|
||||||
|
* @retval
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void mppt_constantVoltageB(float OutVoltage)
|
||||||
|
{
|
||||||
|
// static uint8_t ConstantVoltageFlag = 1;
|
||||||
|
// float PV1_V = get_PV_VOLT_OUT();
|
||||||
|
//
|
||||||
|
// if (ConstantVoltageFlag) {
|
||||||
|
// if (PV1_V > OutVoltage) {
|
||||||
|
// g_duty_ratio -= step1_pwm;
|
||||||
|
// Set_duty_ratio(&g_duty_ratio);
|
||||||
|
// } else {
|
||||||
|
// g_duty_ratio += step1_pwm;
|
||||||
|
// Set_duty_ratio(&g_duty_ratio);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (PV1_V - OutVoltage < 0.1) {
|
||||||
|
// ConstantVoltageFlag = 0;
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (PV1_V > OutVoltage) {
|
||||||
|
// g_duty_ratio -= step2_pwm;
|
||||||
|
// Set_duty_ratio(&g_duty_ratio);
|
||||||
|
// } else {
|
||||||
|
// g_duty_ratio += step2_pwm;
|
||||||
|
// Set_duty_ratio(&g_duty_ratio);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (PV1_V - OutVoltage > 0.1) {
|
||||||
|
// ConstantVoltageFlag = 1;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// static float_t kp = 0.0005;
|
||||||
|
// static float_t ki = 0.000001;
|
||||||
|
static float_t kp = 0.005;
|
||||||
|
static float_t ki = 0.00001;
|
||||||
|
// static float_t kp = 0.1;
|
||||||
|
// static float_t ki = 0.001;
|
||||||
|
|
||||||
|
// float_t outVolt = get_PV_VOLT_OUT();
|
||||||
|
float_t outVolt = g_Mppt_Para.Battery_Voltage;
|
||||||
|
// float_t outVolt = voltOut;
|
||||||
|
// float_t error = outVolt - OutVoltage;
|
||||||
|
float_t error = OutVoltage - outVolt;
|
||||||
|
float_t stepPwm = kp * error + ki * outVolt;
|
||||||
|
g_duty_ratio += stepPwm;
|
||||||
|
|
||||||
|
// printf("setPwm : %d/10000 \n", (int)(stepPwm * 10000));
|
||||||
|
|
||||||
|
Set_duty_ratio(&g_duty_ratio);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 恒定输出电压(输出检测端)
|
||||||
* @param
|
* @param
|
||||||
* @retval
|
* @retval
|
||||||
*
|
*
|
||||||
|
@ -281,13 +342,15 @@ void mppt_constantVoltageO(float OutVoltage)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
static float_t kp = 0.0005;
|
// static float_t kp = 0.0005;
|
||||||
static float_t ki = 0.000001;
|
// static float_t ki = 0.000001;
|
||||||
|
static float_t kp = 0.005;
|
||||||
|
static float_t ki = 0.00001;
|
||||||
// static float_t kp = 0.1;
|
// static float_t kp = 0.1;
|
||||||
// static float_t ki = 0.001;
|
// static float_t ki = 0.001;
|
||||||
|
|
||||||
// float_t outVolt = get_PV_VOLT_OUT();
|
// float_t outVolt = get_PV_VOLT_OUT();
|
||||||
float_t outVolt = g_Mppt_Para.Battery_Voltage;
|
float_t outVolt = g_Mppt_Para.Output_Voltage;
|
||||||
// float_t outVolt = voltOut;
|
// float_t outVolt = voltOut;
|
||||||
// float_t error = outVolt - OutVoltage;
|
// float_t error = outVolt - OutVoltage;
|
||||||
float_t error = OutVoltage - outVolt;
|
float_t error = OutVoltage - outVolt;
|
||||||
|
@ -397,7 +460,14 @@ void mppt_constantCurrentO(float outCurrent)
|
||||||
*/
|
*/
|
||||||
void TrickleCharge(void)
|
void TrickleCharge(void)
|
||||||
{
|
{
|
||||||
mppt_constantCurrentO(2);
|
static float_t TrickleChargeC;
|
||||||
|
static uint8_t onlyOnce = 1;
|
||||||
|
if (onlyOnce) {
|
||||||
|
TrickleChargeC = (float_t)g_slConfigInfo.trickleChargeC / 100;
|
||||||
|
onlyOnce = 0;
|
||||||
|
}
|
||||||
|
// printf("Trickle\n");
|
||||||
|
mppt_constantCurrentO(TrickleChargeC + g_Mppt_Para.Discharg_Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -410,6 +480,7 @@ void ConstantCurrentCharge(void)
|
||||||
{
|
{
|
||||||
// mppt_readJust();
|
// mppt_readJust();
|
||||||
mppt_constantVoltage(18);
|
mppt_constantVoltage(18);
|
||||||
|
// printf("ConstantCurrent\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +492,14 @@ void ConstantCurrentCharge(void)
|
||||||
*/
|
*/
|
||||||
void ConstantVoltageCharge(void)
|
void ConstantVoltageCharge(void)
|
||||||
{
|
{
|
||||||
mppt_constantVoltageO(14.5);
|
static float_t ConstantVoltageChargeV;
|
||||||
|
static uint8_t onlyOnce = 1;
|
||||||
|
if (onlyOnce) {
|
||||||
|
ConstantVoltageChargeV = (float_t)g_slConfigInfo.constantVoltageChargeV / 100;
|
||||||
|
onlyOnce = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mppt_constantVoltageO(ConstantVoltageChargeV);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -432,22 +510,33 @@ void ConstantVoltageCharge(void)
|
||||||
*/
|
*/
|
||||||
void FloatingCharge(void)
|
void FloatingCharge(void)
|
||||||
{
|
{
|
||||||
static uint32_t num = 0;
|
// static uint32_t num = 0;
|
||||||
static uint32_t numLenFlag;
|
// static uint32_t numLenFlag;
|
||||||
|
// static uint8_t onlyOnce = 1;
|
||||||
|
// if (onlyOnce) {
|
||||||
|
// numLenFlag = g_slConfigInfo.FloatTime * 1000;
|
||||||
|
// onlyOnce = 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// printf("float\n");
|
||||||
|
// TIM_SetCompare4(TIM4, 0);
|
||||||
|
|
||||||
|
// if (numLenFlag == ++num) {
|
||||||
|
// num = 0;
|
||||||
|
// for (int var = 0; var < 10; ++var) {
|
||||||
|
// ConstantVoltageCharge();
|
||||||
|
// }
|
||||||
|
// g_Mppt_Para.MPPT_Mode = CONSTANTVOLTAGE;
|
||||||
|
// printf("float\n");
|
||||||
|
// }
|
||||||
|
|
||||||
|
static float_t FloatChargeV;
|
||||||
static uint8_t onlyOnce = 1;
|
static uint8_t onlyOnce = 1;
|
||||||
if (onlyOnce) {
|
if (onlyOnce) {
|
||||||
numLenFlag = g_slConfigInfo.FloatTime * 1000 / 5;
|
FloatChargeV = (float_t)g_slConfigInfo.FloatV / 100;
|
||||||
onlyOnce = 0;
|
onlyOnce = 0;
|
||||||
}
|
}
|
||||||
|
mppt_constantVoltageO(FloatChargeV);
|
||||||
TIM_SetCompare4(TIM4, 0);
|
|
||||||
|
|
||||||
if (numLenFlag == ++num) {
|
|
||||||
num = 0;
|
|
||||||
ConstantVoltageCharge();
|
|
||||||
g_Mppt_Para.MPPT_Mode = CONSTANTVOLTAGE;
|
|
||||||
// printf("float charge \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,14 +548,14 @@ void FloatingCharge(void)
|
||||||
*/
|
*/
|
||||||
void NoBatteryCharge(void)
|
void NoBatteryCharge(void)
|
||||||
{
|
{
|
||||||
static float_t NoBatteryChargeV;
|
// static float_t NoBatteryChargeV;
|
||||||
static uint8_t onlyOnce = 1;
|
// static uint8_t onlyOnce = 1;
|
||||||
if (onlyOnce) {
|
// if (onlyOnce) {
|
||||||
NoBatteryChargeV = (float_t)g_slConfigInfo.noBatteryChargeV / 100;
|
// NoBatteryChargeV = (float_t)g_slConfigInfo.noBatteryChargeV / 100;
|
||||||
onlyOnce = 0;
|
// onlyOnce = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
mppt_constantVoltageO(NoBatteryChargeV);
|
mppt_constantVoltageO(14.2);
|
||||||
|
|
||||||
// if ((g_Mppt_Para.Battery_Voltage - NoBatteryChargeV > 0.2 && g_Mppt_Para.Charg_Current < 0.1)
|
// if ((g_Mppt_Para.Battery_Voltage - NoBatteryChargeV > 0.2 && g_Mppt_Para.Charg_Current < 0.1)
|
||||||
// || (NoBatteryChargeV - g_Mppt_Para.Battery_Voltage > 0.1 && g_Mppt_Para.Charg_Current > 0.5)) {
|
// || (NoBatteryChargeV - g_Mppt_Para.Battery_Voltage > 0.1 && g_Mppt_Para.Charg_Current > 0.5)) {
|
||||||
|
@ -474,13 +563,13 @@ void NoBatteryCharge(void)
|
||||||
// g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
// g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!overTemperature) {
|
// if (!overTemperature) {
|
||||||
if (!(g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < 0.3
|
// if (!(g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < 0.3
|
||||||
&& g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current < 0.3)) {
|
// && g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current < 0.3)) {
|
||||||
ConstantCurrentCharge();
|
// ConstantCurrentCharge();
|
||||||
g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
// g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,6 +584,7 @@ void MpptContorl(void)
|
||||||
case CONSTANTCURRENT:
|
case CONSTANTCURRENT:
|
||||||
// printf("222222\n");
|
// printf("222222\n");
|
||||||
ConstantCurrentCharge();
|
ConstantCurrentCharge();
|
||||||
|
// ConstantVoltageCharge();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTANTVOLTAGE:
|
case CONSTANTVOLTAGE:
|
||||||
|
@ -507,10 +597,10 @@ void MpptContorl(void)
|
||||||
FloatingCharge();
|
FloatingCharge();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NoBattery:
|
// case NoBattery:
|
||||||
// printf("555555555555555\n");
|
//// printf("555555555555555\n");
|
||||||
NoBatteryCharge();
|
// NoBatteryCharge();
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -534,6 +624,7 @@ void MpptMode(void)
|
||||||
ConstantCurrentV = (float)g_slConfigInfo.constantCurrentV / 100;
|
ConstantCurrentV = (float)g_slConfigInfo.constantCurrentV / 100;
|
||||||
ConstantVoltageV = (float)g_slConfigInfo.constantVoltageV / 100;
|
ConstantVoltageV = (float)g_slConfigInfo.constantVoltageV / 100;
|
||||||
FloatI = (float)g_slConfigInfo.floatI / 100;
|
FloatI = (float)g_slConfigInfo.floatI / 100;
|
||||||
|
printf("FloatI: %d / 100 \n", (int)(FloatI * 100));
|
||||||
StopSolarOpenCircuitV = (float)g_slConfigInfo.stopSolarOpenCircuitV / 100;
|
StopSolarOpenCircuitV = (float)g_slConfigInfo.stopSolarOpenCircuitV / 100;
|
||||||
only_once = 0;
|
only_once = 0;
|
||||||
}
|
}
|
||||||
|
@ -614,52 +705,93 @@ void MpptMode(void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (g_Mppt_Para.Solar_Open_Circuit_Voltage < StopSolarOpenCircuitV
|
// if (g_Mppt_Para.Input_Voltage < StopSolarOpenCircuitV
|
||||||
&& (g_Mppt_Para.Discharg_Current >= g_Mppt_Para.Charg_Current
|
// && (g_Mppt_Para.Discharg_Current >= g_Mppt_Para.Charg_Current
|
||||||
|| g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < 0.05)) {
|
// || g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < 0.05)) {
|
||||||
|
if ((g_Mppt_Para.Input_Voltage < StopSolarOpenCircuitV && g_Mppt_Para.Charg_Current < 0.05)
|
||||||
|
&& g_Mppt_Para.MPPT_Mode != NoWork) {
|
||||||
g_Mppt_Para.MPPT_Mode = NoWork;
|
g_Mppt_Para.MPPT_Mode = NoWork;
|
||||||
|
// printf("nowork \n");
|
||||||
stop_mpptWork();
|
stop_mpptWork();
|
||||||
TimeSliceOffset_Register(&m_startMpptControl, Task_startMpptControl
|
TimeSliceOffset_Register(&m_startMpptControl, Task_startMpptControl
|
||||||
, startMpptControl_reloadVal, startMpptControl_offset);
|
, startMpptControl_reloadVal, startMpptControl_offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < 0.03
|
|
||||||
&& g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current < 0.03)
|
|
||||||
|| g_Mppt_Para.Battery_Voltage < 6
|
|
||||||
|| g_Mppt_Para.Battery_Voltage > 16
|
|
||||||
|| g_Mppt_Para.MPPT_Mode == NoBattery) {
|
|
||||||
g_Mppt_Para.MPPT_Mode = NoBattery;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((ConstantVoltageV < g_Mppt_Para.Battery_Voltage) &&
|
// if (((g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < 0.03
|
||||||
(FloatI > g_Mppt_Para.Charg_Current)) || g_Mppt_Para.MPPT_Mode == FLOAT) {
|
// && g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current < 0.03)
|
||||||
|
// && (g_Mppt_Para.Battery_Voltage < ConstantVoltageV - 1
|
||||||
|
// || g_Mppt_Para.Battery_Voltage > ConstantVoltageV + 1))
|
||||||
|
// || g_Mppt_Para.MPPT_Mode == NoBattery) {
|
||||||
|
// g_Mppt_Para.MPPT_Mode = NoBattery;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (((ConstantVoltageV < g_Mppt_Para.Battery_Voltage) &&
|
||||||
|
// (FloatI > g_Mppt_Para.Charg_Current)) || g_Mppt_Para.MPPT_Mode == FLOAT) {
|
||||||
|
// g_Mppt_Para.MPPT_Mode = FLOAT;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if ((g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < 0.05
|
||||||
|
&& g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current < 0.05)
|
||||||
|
|| g_Mppt_Para.Battery_Voltage > 16 || g_Mppt_Para.Battery_Voltage < 8) {
|
||||||
|
// || g_Mppt_Para.MPPT_Mode == NoBattery) {
|
||||||
|
// g_Mppt_Para.MPPT_Mode = NoBattery;
|
||||||
|
// g_Mppt_Para.MPPT_Mode = CONSTANTVOLTAGE;
|
||||||
g_Mppt_Para.MPPT_Mode = FLOAT;
|
g_Mppt_Para.MPPT_Mode = FLOAT;
|
||||||
|
|
||||||
|
// printf("Charg_Current : %d/100 \n", (int)(g_Mppt_Para.Charg_Current * 100));
|
||||||
|
// printf("Discharg_Current : %d/100 \n", (int)(g_Mppt_Para.Discharg_Current * 100));
|
||||||
|
// printf("Battery_Voltage : %d/100 \n", (int)(g_Mppt_Para.Battery_Voltage * 100));
|
||||||
|
|
||||||
|
g_batteryState = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((ConstantCurrentV + 0.4) < g_Mppt_Para.Battery_Voltage) &&
|
if ((((ConstantCurrentV + 0.2) < g_Mppt_Para.Battery_Voltage)
|
||||||
((ConstantVoltageV - 0.4) >= g_Mppt_Para.Battery_Voltage)) {
|
&&((ConstantVoltageV - 0.2) >= g_Mppt_Para.Battery_Voltage))
|
||||||
|
&&(g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current > 0.1)) {
|
||||||
g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// if ((g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current > 4)) {
|
||||||
|
// g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
if ((ConstantVoltageV < g_Mppt_Para.Battery_Voltage) &&
|
// if (((ConstantVoltageV < g_Mppt_Para.Battery_Voltage)
|
||||||
(FloatI + 0.1 <= g_Mppt_Para.Charg_Current)) {
|
// &&(FloatI + 0.1 <= g_Mppt_Para.Charg_Current))
|
||||||
|
// || (FloatI + 0.1 <= g_Mppt_Para.Discharg_Current)) {
|
||||||
|
//// || (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < 0.03
|
||||||
|
//// && g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current < 0.03)) {
|
||||||
|
//
|
||||||
|
//// printf("mppt mode \n");
|
||||||
|
//// printf(" vout : %d/100 \n", (int)(g_Mppt_Para.Battery_Voltage * 100));
|
||||||
|
// g_Mppt_Para.MPPT_Mode = CONSTANTVOLTAGE;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
// printf("mppt mode \n");
|
if (((ConstantVoltageV < g_Mppt_Para.Battery_Voltage)
|
||||||
// printf(" vout : %d/100 \n", (int)(g_Mppt_Para.Battery_Voltage * 100));
|
&&(FloatI + 0.1 <= g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current))) {
|
||||||
g_Mppt_Para.MPPT_Mode = CONSTANTVOLTAGE;
|
g_Mppt_Para.MPPT_Mode = CONSTANTVOLTAGE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((((ConstantVoltageV < g_Mppt_Para.Battery_Voltage)
|
||||||
|
&& (FloatI > g_Mppt_Para.Charg_Current))
|
||||||
|
&& (FloatI > g_Mppt_Para.Discharg_Current))) {
|
||||||
|
// || g_Mppt_Para.MPPT_Mode == FLOAT) {
|
||||||
|
g_Mppt_Para.MPPT_Mode = FLOAT;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ConstantCurrentV > g_Mppt_Para.Battery_Voltage) {
|
if (ConstantCurrentV > g_Mppt_Para.Battery_Voltage) {
|
||||||
g_Mppt_Para.MPPT_Mode = TRICKLE;
|
g_Mppt_Para.MPPT_Mode = TRICKLE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void findMiNDutyRatio(void)
|
void findMiNDutyRatio(void)
|
||||||
|
@ -695,8 +827,56 @@ void test(void)
|
||||||
|
|
||||||
// mppt_constantCurrentO(1);
|
// mppt_constantCurrentO(1);
|
||||||
|
|
||||||
g_Mppt_Para.Charg_Current = get_capturedata(get_CHG_CURR);
|
|
||||||
g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
|
// 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 = 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
|
// if (g_Mppt_Para.MPPT_Mode == CONSTANTCURRENT
|
||||||
// || g_Mppt_Para.MPPT_Mode == CONSTANTVOLTAGE) {
|
// || g_Mppt_Para.MPPT_Mode == CONSTANTVOLTAGE) {
|
||||||
|
@ -704,18 +884,21 @@ void test(void)
|
||||||
// g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT)
|
// g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT)
|
||||||
// - g_impedance * (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current);
|
// - g_impedance * (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current);
|
||||||
// } else {
|
// } else {
|
||||||
g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
// g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// voltOut = 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);
|
// g_Mppt_Para.Battery_Voltage = voltOut - g_impedance * (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current);
|
||||||
|
|
||||||
|
|
||||||
|
// ConstantVoltageCharge();
|
||||||
|
// return;
|
||||||
|
|
||||||
if (!overTemperature) {
|
if (!overTemperature) {
|
||||||
MpptMode();
|
MpptMode();
|
||||||
|
MpptContorl();
|
||||||
}
|
}
|
||||||
|
|
||||||
MpptContorl();
|
|
||||||
|
|
||||||
// mppt_constantVoltageO(12);
|
// mppt_constantVoltageO(12);
|
||||||
|
|
||||||
|
|
|
@ -336,6 +336,7 @@ void SL_MsgProcFunc_Registration_request(device_handle device, void *pMsg, uint3
|
||||||
recvbroadcast_flag = 1;
|
recvbroadcast_flag = 1;
|
||||||
RegistrationRequestFlag = 0;
|
RegistrationRequestFlag = 0;
|
||||||
TimeSliceOffset_Unregister(&m_recvbroadcast);
|
TimeSliceOffset_Unregister(&m_recvbroadcast);
|
||||||
|
m_recvbroadcast.runFlag = 0;
|
||||||
SL_Mppt_RegistrationReply_pack *rpack = (SL_Mppt_RegistrationReply_pack *)pMsg;
|
SL_Mppt_RegistrationReply_pack *rpack = (SL_Mppt_RegistrationReply_pack *)pMsg;
|
||||||
g_Mppt_Para.Registration_Status = chang_8_to_16(rpack->registration_Status_L, rpack->registration_Status_H);
|
g_Mppt_Para.Registration_Status = chang_8_to_16(rpack->registration_Status_L, rpack->registration_Status_H);
|
||||||
|
|
||||||
|
|
461
App/src/task.c
461
App/src/task.c
|
@ -4,6 +4,7 @@
|
||||||
* Created on: 2024Äê6ÔÂ24ÈÕ
|
* Created on: 2024Äê6ÔÂ24ÈÕ
|
||||||
* Author: psx
|
* Author: psx
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
|
@ -23,11 +24,13 @@
|
||||||
#include "collect_Conversion.h"
|
#include "collect_Conversion.h"
|
||||||
|
|
||||||
|
|
||||||
|
//uint8_t g_interruptNum = 0; /* 每次关闭或重新开启定时器3时,先清零该引脚 */
|
||||||
void stop_mpptWork(void)
|
void stop_mpptWork(void)
|
||||||
{
|
{
|
||||||
GPIO_WriteBit(EnPowerSupply_GPIO, EnPowerSupply_PIN, SET);
|
// GPIO_WriteBit(EnPowerSupply_GPIO, EnPowerSupply_PIN, SET);
|
||||||
g_duty_ratio = 0.7;
|
g_duty_ratio = 0.7;
|
||||||
TIM_Cmd(TIM3, DISABLE);
|
TIM_Cmd(TIM3, DISABLE);
|
||||||
|
// g_interruptNum = 0;
|
||||||
TIM_SetCompare4(TIM4, 0);
|
TIM_SetCompare4(TIM4, 0);
|
||||||
// TimeSliceOffset_Register(&m_startMpptControl, Task_startMpptControl
|
// TimeSliceOffset_Register(&m_startMpptControl, Task_startMpptControl
|
||||||
// , startMpptControl_reloadVal, startMpptControl_offset);
|
// , startMpptControl_reloadVal, startMpptControl_offset);
|
||||||
|
@ -38,11 +41,13 @@ void stop_mpptWork(void)
|
||||||
void start_mpptWork(void)
|
void start_mpptWork(void)
|
||||||
{
|
{
|
||||||
// GPIO_WriteBit(EnPowerSupply_GPIO, EnPowerSupply_PIN, RESET);
|
// GPIO_WriteBit(EnPowerSupply_GPIO, EnPowerSupply_PIN, RESET);
|
||||||
|
// g_interruptNum = 0;
|
||||||
TIM_Cmd(TIM3, ENABLE);
|
TIM_Cmd(TIM3, ENABLE);
|
||||||
|
// TIM3->CNT = 0;
|
||||||
g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
g_Mppt_Para.MPPT_Mode = CONSTANTCURRENT;
|
||||||
// TimeSliceOffset_Unregister(&m_startMpptControl);
|
// TimeSliceOffset_Unregister(&m_startMpptControl);
|
||||||
// Delay_Ms(500);
|
// Delay_Ms(500);
|
||||||
GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,20 +62,84 @@ void Task_RunLED(void)
|
||||||
// uart_sendstr(g_gw485_uart4_handle, "is gw485\n");
|
// uart_sendstr(g_gw485_uart4_handle, "is gw485\n");
|
||||||
// uart_sendstr(g_bat485_uart3_handle, "is bat485\n");get_PV1_VOLT_IN();
|
// uart_sendstr(g_bat485_uart3_handle, "is bat485\n");get_PV1_VOLT_IN();
|
||||||
|
|
||||||
printf(" \n");
|
// printf(" \n");
|
||||||
printf(" duty_ratio : %d/1000 \n", (int)(g_duty_ratio * 1000));
|
// printf(" duty_ratio : %d/1000 \n", (int)(g_duty_ratio * 1000));
|
||||||
|
//
|
||||||
|
// printf(" vout : %d/100 \n", (int)(g_Mppt_Para.Battery_Voltage * 100));
|
||||||
|
// printf(" Iout : %d/100 \n", (int)(g_Mppt_Para.Charg_Current * 100));
|
||||||
|
// printf(" Idisout : %d/100 \n", (int)(g_Mppt_Para.Discharg_Current * 100));
|
||||||
|
// printf(" mosT : %d/10 \n", (int)(g_Mppt_Para.HighSideMos_Temperature * 10));
|
||||||
|
// printf(" mosState : %d \n", (int)(g_Mppt_Para.DischargMos_State));
|
||||||
|
//// printf(" mosState : %d \n", GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN));
|
||||||
|
//// printf(" mosState : %d \n", GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN));
|
||||||
|
//
|
||||||
|
// printf(" 0.没有工作; 1.涓流模式; 2.恒流模式; 3.恒压模式; 4.浮充模式; 5.没有电池 : %d \n", g_Mppt_Para.MPPT_Mode);
|
||||||
|
//
|
||||||
|
// printf(" \n");
|
||||||
|
// uart_sendstr(g_bat485_uart3_handle, " \n");
|
||||||
|
|
||||||
printf(" vout : %d/100 \n", (int)(g_Mppt_Para.Battery_Voltage * 100));
|
uart_dev_write(g_bat485_uart3_handle, " \n", sizeof(" \n"));
|
||||||
printf(" Iout : %d/100 \n", (int)(g_Mppt_Para.Charg_Current * 100));
|
|
||||||
printf(" Idisout : %d/100 \n", (int)(g_Mppt_Para.Discharg_Current * 100));
|
char buffer[80];
|
||||||
printf(" mosT : %d/10 \n", (int)(g_Mppt_Para.HighSideMos_Temperature * 10));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
printf(" mosState : %d \n", (int)(g_Mppt_Para.DischargMos_State));
|
sprintf(buffer, " duty_ratio : %d/1000 \n", (int)(g_duty_ratio * 1000));
|
||||||
// printf(" mosState : %d \n", GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN));
|
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||||
// printf(" mosState : %d \n", GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN));
|
|
||||||
|
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"));
|
||||||
|
|
||||||
printf(" 0.没有工作; 1.涓流模式; 2.恒流模式; 3.恒压模式; 4.浮充模式; 5.没有电池 : %d \n", g_Mppt_Para.MPPT_Mode);
|
|
||||||
|
|
||||||
printf(" \n");
|
|
||||||
|
|
||||||
// printf("vout : %d/100 \n", (int)(get_capturedata(get_PV_VOLT_OUT) * 100));
|
// printf("vout : %d/100 \n", (int)(get_capturedata(get_PV_VOLT_OUT) * 100));
|
||||||
|
|
||||||
|
@ -80,10 +149,11 @@ void Task_RunLED(void)
|
||||||
flag = !flag;
|
flag = !flag;
|
||||||
GPIO_WriteBit(RUN_LED_GPIO, RUN_LED_PIN, flag);
|
GPIO_WriteBit(RUN_LED_GPIO, RUN_LED_PIN, flag);
|
||||||
|
|
||||||
// static uint8_t num = 0;
|
|
||||||
// if (10 == ++num) {
|
static uint8_t num = 0;
|
||||||
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
if (10 == ++num) {
|
||||||
// }
|
GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,14 +176,25 @@ void Task_startMpptControl(void)
|
||||||
|
|
||||||
if (g_slConfigInfo.checkSolarOpenCircuitVTime == ++checkSolarOpenCircuitVTimeFlag) {
|
if (g_slConfigInfo.checkSolarOpenCircuitVTime == ++checkSolarOpenCircuitVTimeFlag) {
|
||||||
checkSolarOpenCircuitVTimeFlag = 0;
|
checkSolarOpenCircuitVTimeFlag = 0;
|
||||||
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_capturedata(get_PV1_VOLT_IN);
|
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_PV1_VOLT_IN();
|
||||||
printf("volt in : %d/100 \n", (int)(g_Mppt_Para.Solar_Open_Circuit_Voltage * 100));
|
// printf("volt in : %d/100 \n", (int)(g_Mppt_Para.Solar_Open_Circuit_Voltage * 100));
|
||||||
|
// char buff[50];
|
||||||
|
// memset(buff, 0, sizeof(buff));
|
||||||
|
// sprintf(buff, "volt in : %d/100 \n", (int)(g_Mppt_Para.Solar_Open_Circuit_Voltage * 100));
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, buff, sizeof(buff));
|
||||||
|
|
||||||
if (g_Mppt_Para.Solar_Open_Circuit_Voltage
|
if (g_Mppt_Para.Solar_Open_Circuit_Voltage
|
||||||
> ((float_t)g_slConfigInfo.startSolarOpenCircuitV / 100)) {
|
> ((float_t)g_slConfigInfo.startSolarOpenCircuitV / 100)) {
|
||||||
// start_mpptWork();
|
|
||||||
TimeSliceOffset_Register(&m_softStart, Task_softStart, softStart_reloadVal, softStart_offset);
|
|
||||||
TimeSliceOffset_Unregister(&m_startMpptControl);
|
TimeSliceOffset_Unregister(&m_startMpptControl);
|
||||||
|
m_startMpptControl.runFlag = 0;
|
||||||
|
// printf("1\n");
|
||||||
|
// start_mpptWork();
|
||||||
|
if (g_Mppt_Para.Output_Voltage > 11) {
|
||||||
|
g_batteryState = 1;
|
||||||
|
} else {
|
||||||
|
g_batteryState = 0;
|
||||||
|
}
|
||||||
|
TimeSliceOffset_Register(&m_softStart, Task_softStart, softStart_reloadVal, softStart_offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -132,23 +213,53 @@ void Task_softStart(void)
|
||||||
|
|
||||||
num++;
|
num++;
|
||||||
|
|
||||||
if (num == 1) {
|
// if (num == 1) {
|
||||||
GPIO_WriteBit(EnPowerSupply_GPIO, EnPowerSupply_PIN, RESET);
|
// GPIO_WriteBit(EnPowerSupply_GPIO, EnPowerSupply_PIN, RESET);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (num < 5) {
|
if (num < 5) {
|
||||||
TIM_SetCompare4(TIM4, 100);
|
TIM_SetCompare4(TIM4, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (num > 70 || dutyRatio > g_duty_ratio) {
|
else if (num > 70 || dutyRatio > g_duty_ratio) {
|
||||||
|
TimeSliceOffset_Unregister(&m_softStart);
|
||||||
|
m_softStart.runFlag = 0;
|
||||||
|
|
||||||
dutyRatio = 0;
|
dutyRatio = 0;
|
||||||
num = 0;
|
num = 0;
|
||||||
Set_duty_ratio(&g_duty_ratio);
|
Set_duty_ratio(&g_duty_ratio);
|
||||||
TimeSliceOffset_Unregister(&m_softStart);
|
|
||||||
|
if (g_batteryState == 1) {
|
||||||
start_mpptWork();
|
start_mpptWork();
|
||||||
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
||||||
|
// TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
|
||||||
|
// , impedanceCalculation_reloadVal, impedanceCalculation_reloadVal);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
dutyRatio = 0;
|
||||||
|
num = 0;
|
||||||
|
Set_duty_ratio(&g_duty_ratio);
|
||||||
|
// TimeSliceOffset_Unregister(&m_softStart);
|
||||||
|
// m_softStart.runFlag = 0;
|
||||||
|
|
||||||
|
//软起动后bms保护板开启电池充电
|
||||||
|
if (get_CHG_CURR() - get_DSG_CURR() > 0.1
|
||||||
|
|| get_DSG_CURR() - get_CHG_CURR() > 0.1) {
|
||||||
|
// printf("111\n");
|
||||||
|
// TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
|
||||||
|
// , impedanceCalculation_reloadVal, impedanceCalculation_reloadVal);
|
||||||
|
start_mpptWork();
|
||||||
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Mppt_Para.MPPT_Mode = FLOAT;
|
||||||
|
TIM_Cmd(TIM3, ENABLE);
|
||||||
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
dutyRatio += 0.01;
|
dutyRatio += 0.01;
|
||||||
|
@ -167,6 +278,7 @@ void Task_usart(void)
|
||||||
{
|
{
|
||||||
read_and_process_uart_data(g_gw485_uart4_handle);
|
read_and_process_uart_data(g_gw485_uart4_handle);
|
||||||
// read_and_process_uart_data(g_bat485_uart3_handle);
|
// read_and_process_uart_data(g_bat485_uart3_handle);
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, "hello world \n", sizeof("hello world \n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,15 +313,40 @@ void Task_refreshRegister(void)
|
||||||
|
|
||||||
if (g_slConfigInfo.registerRefreshTime == ++checkRegisterRefreshTimeFlag) {
|
if (g_slConfigInfo.registerRefreshTime == ++checkRegisterRefreshTimeFlag) {
|
||||||
checkRegisterRefreshTimeFlag = 0;
|
checkRegisterRefreshTimeFlag = 0;
|
||||||
g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
// g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
||||||
g_Mppt_Para.Charg_Current = get_capturedata(get_CHG_CURR);
|
// g_Mppt_Para.Charg_Current = get_capturedata(get_CHG_CURR);
|
||||||
g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
|
// g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
|
||||||
g_Mppt_Para.HighSideMos_Temperature = get_capturedata(get_MOSFET_Temper);
|
// 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.DischargMos_State = GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN)
|
g_Mppt_Para.DischargMos_State = GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN)
|
||||||
&& GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN);
|
&& GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN);
|
||||||
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_capturedata(get_PV1_VOLT_IN);
|
|
||||||
|
|
||||||
if (g_Mppt_Para.HighSideMos_Temperature < g_slConfigInfo.HighSideMosTemperature_start) {
|
if (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current < -0.1) {
|
||||||
|
g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage
|
||||||
|
- (g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current) * g_impedance;
|
||||||
|
}
|
||||||
|
|
||||||
|
float_t inBatteryCurr = g_Mppt_Para.Charg_Current - g_Mppt_Para.Discharg_Current;
|
||||||
|
float_t outBatteryCurr = g_Mppt_Para.Discharg_Current - g_Mppt_Para.Charg_Current;
|
||||||
|
if (g_batteryState == 0 && (inBatteryCurr > 0.1 || outBatteryCurr > 0.1) && g_Mppt_Para.Output_Voltage < 14.2) {
|
||||||
|
g_batteryState = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 有电池,太阳能输出功率大,同时回路阻抗未测试或需要重新测试 */
|
||||||
|
if (g_batteryState == 1 && (g_Mppt_Para.Charg_Current > 3.0) && (g_impedanceStart == 1 || g_impedance == 0.0)) {
|
||||||
|
TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
|
||||||
|
, impedanceCalculation_reloadVal, impedanceCalculation_reloadVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
if (g_Mppt_Para.HighSideMos_Temperature < g_slConfigInfo.HighSideMosTemperature_start + 3) {
|
||||||
if (overTemperature == 2) {
|
if (overTemperature == 2) {
|
||||||
// start_mpptWork();
|
// start_mpptWork();
|
||||||
TimeSliceOffset_Register(&m_softStart, Task_softStart, softStart_reloadVal, softStart_offset);
|
TimeSliceOffset_Register(&m_softStart, Task_softStart, softStart_reloadVal, softStart_offset);
|
||||||
|
@ -218,16 +355,19 @@ void Task_refreshRegister(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Mppt_Para.HighSideMos_Temperature > g_slConfigInfo.HighSideMosTemperature_end) {
|
if (g_Mppt_Para.HighSideMos_Temperature > g_slConfigInfo.HighSideMosTemperature_end + 3
|
||||||
g_Mppt_Para.MPPT_Mode = NoBattery;
|
&& g_Mppt_Para.HighSideMos_Temperature < g_slConfigInfo.HighSideMosTemperature_stop) {
|
||||||
|
// g_Mppt_Para.MPPT_Mode = NoBattery;
|
||||||
|
// g_duty_ratio -= 0.1;
|
||||||
|
g_duty_ratio = 0.6;
|
||||||
|
Set_duty_ratio(&g_duty_ratio);
|
||||||
overTemperature = 1;
|
overTemperature = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Mppt_Para.HighSideMos_Temperature > g_slConfigInfo.HighSideMosTemperature_stop) {
|
if (g_Mppt_Para.HighSideMos_Temperature > g_slConfigInfo.HighSideMosTemperature_stop + 3) {
|
||||||
overTemperature = 2;
|
overTemperature = 2;
|
||||||
stop_mpptWork();
|
stop_mpptWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +388,7 @@ void Task_recvbroadcast(void)
|
||||||
RegistrationRequestFlag = 0;
|
RegistrationRequestFlag = 0;
|
||||||
run_number = 0;
|
run_number = 0;
|
||||||
TimeSliceOffset_Unregister(&m_recvbroadcast);
|
TimeSliceOffset_Unregister(&m_recvbroadcast);
|
||||||
|
m_recvbroadcast.runFlag = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (g_Mppt_Para.Registration_Status == REGISTER_SUCCESS) {
|
// if (g_Mppt_Para.Registration_Status == REGISTER_SUCCESS) {
|
||||||
|
@ -330,7 +471,9 @@ void Task_recvbroadcast(void)
|
||||||
*/
|
*/
|
||||||
STR_TimeSliceOffset m_impedanceCalculation;
|
STR_TimeSliceOffset m_impedanceCalculation;
|
||||||
float_t g_impedance = 0; /* »Ø·×迹µÄÖµ */
|
float_t g_impedance = 0; /* »Ø·×迹µÄÖµ */
|
||||||
float_t voltOut = 0; /* 输出电压的值 */
|
uint8_t g_batteryState = 0; /* 有无电池 */
|
||||||
|
uint8_t g_impedanceStart = 0; /* 是否开始测量回路阻抗 */
|
||||||
|
//config_info tempConfigInfo;
|
||||||
void Task_impedanceCalculation(void)
|
void Task_impedanceCalculation(void)
|
||||||
{
|
{
|
||||||
static uint8_t num = 0;
|
static uint8_t num = 0;
|
||||||
|
@ -338,42 +481,121 @@ void Task_impedanceCalculation(void)
|
||||||
static float_t voltOne = 0;
|
static float_t voltOne = 0;
|
||||||
static float_t currTwo = 0;
|
static float_t currTwo = 0;
|
||||||
static float_t voltTwo = 0;
|
static float_t voltTwo = 0;
|
||||||
|
// static uint8_t only_one = 1;
|
||||||
|
// if (only_one) {
|
||||||
|
// g_impedance = g_slConfigInfo.loopImpedance;
|
||||||
|
// }
|
||||||
|
|
||||||
if (g_Mppt_Para.MPPT_Mode == CONSTANTCURRENT
|
// if (g_Mppt_Para.MPPT_Mode == CONSTANTCURRENT
|
||||||
|| g_Mppt_Para.MPPT_Mode == CONSTANTVOLTAGE) {
|
// || g_Mppt_Para.MPPT_Mode == CONSTANTVOLTAGE) {
|
||||||
++num;
|
// ++num;
|
||||||
} else {
|
// } else {
|
||||||
num = 0;
|
// num = 0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (num == 10) {
|
||||||
|
// num = 0;
|
||||||
|
// TIM_Cmd(TIM3, DISABLE);
|
||||||
|
//
|
||||||
|
// TIM_SetCompare4(TIM4, 300);
|
||||||
|
// Delay_Ms(500);
|
||||||
|
//
|
||||||
|
// TIM_SetCompare4(TIM4, 420);
|
||||||
|
// Delay_Ms(5);
|
||||||
|
//// currOne = get_capturedata(get_CHG_CURR) - get_capturedata(get_DSG_CURR);
|
||||||
|
//// voltOne = get_capturedata(get_PV_VOLT_OUT);
|
||||||
|
// currOne = get_CHG_CURR() - get_DSG_CURR();
|
||||||
|
// voltOne = get_PV_VOLT_OUT();
|
||||||
|
//
|
||||||
|
//// currTwo = get_capturedata(get_CHG_CURR) - get_capturedata(get_DSG_CURR);
|
||||||
|
//// voltTwo = get_capturedata(get_PV_VOLT_OUT);
|
||||||
|
// currTwo = get_CHG_CURR() - get_DSG_CURR();
|
||||||
|
// voltTwo = get_PV_VOLT_OUT();
|
||||||
|
//
|
||||||
|
// g_impedance = (voltOne - voltTwo) / (currOne - currTwo);
|
||||||
|
//
|
||||||
|
// printf("currOne = %d/1000, voltOne = %d/100 \n", (int)(currOne * 1000), (int)(voltOne * 100));
|
||||||
|
// printf("currTwo = %d/1000, voltTwo = %d/100 \n", (int)(currTwo * 1000), (int)(voltTwo * 100));
|
||||||
|
// printf("Res = %d/1000, E = %d/100 \n", (int)(g_impedance * 1000), (int)((voltTwo - currTwo * g_impedance) * 100));
|
||||||
|
//
|
||||||
|
//// TIM_Cmd(TIM3, ENABLE);
|
||||||
|
// }
|
||||||
|
|
||||||
|
num++;
|
||||||
|
|
||||||
|
// printf("g_batteryState : %d\n", g_batteryState);
|
||||||
|
|
||||||
|
if (num == 1) {
|
||||||
|
TIM_Cmd(TIM3, DISABLE);
|
||||||
|
// g_interruptNum = 0;
|
||||||
|
TIM_SetCompare4(TIM4, 300);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num == 10) {
|
if (num == 11) {
|
||||||
num = 0;
|
currOne = get_CHG_CURR() - get_DSG_CURR();
|
||||||
TIM_Cmd(TIM3, DISABLE);
|
voltOne = get_PV_VOLT_OUT();
|
||||||
|
|
||||||
TIM_SetCompare4(TIM4, 420);
|
TIM_SetCompare4(TIM4, 420);
|
||||||
Delay_Ms(5);
|
return;
|
||||||
currOne = get_capturedata(get_CHG_CURR) - get_capturedata(get_DSG_CURR);
|
}
|
||||||
voltOne = get_capturedata(get_PV_VOLT_OUT);
|
|
||||||
|
|
||||||
TIM_SetCompare4(TIM4, 350);
|
if (num == 21) {
|
||||||
Delay_Ms(5);
|
TimeSliceOffset_Unregister(&m_impedanceCalculation);
|
||||||
currTwo = get_capturedata(get_CHG_CURR) - get_capturedata(get_DSG_CURR);
|
m_impedanceCalculation.runFlag = 0;
|
||||||
voltTwo = get_capturedata(get_PV_VOLT_OUT);
|
|
||||||
|
|
||||||
|
currTwo = get_CHG_CURR() - get_DSG_CURR();
|
||||||
|
voltTwo = get_PV_VOLT_OUT();
|
||||||
g_impedance = (voltOne - voltTwo) / (currOne - currTwo);
|
g_impedance = (voltOne - voltTwo) / (currOne - currTwo);
|
||||||
|
|
||||||
printf("currOne = %d/1000, voltOne = %d/100 \n", (int)(currOne * 1000), (int)(voltOne * 100));
|
// printf("g_batteryState : %d\n", g_batteryState);
|
||||||
printf("currTwo = %d/1000, voltTwo = %d/100 \n", (int)(currTwo * 1000), (int)(voltTwo * 100));
|
|
||||||
printf("Res = %d/1000, E = %d/100 \n", (int)(g_impedance * 1000), (int)((voltTwo - currTwo * g_impedance) * 100));
|
|
||||||
|
|
||||||
TIM_Cmd(TIM3, ENABLE);
|
// printf("currOne = %d/1000, voltOne = %d/100 \n", (int)(currOne * 1000), (int)(voltOne * 100));
|
||||||
|
// printf("currTwo = %d/1000, voltTwo = %d/100 \n", (int)(currTwo * 1000), (int)(voltTwo * 100));
|
||||||
|
// printf("Res = %d/1000, E = %d/100 \n", (int)(g_impedance * 1000), (int)((voltTwo - currTwo * g_impedance) * 100));
|
||||||
|
|
||||||
|
/* 判断回路阻抗是否合理 */
|
||||||
|
if (g_impedance > 1.0 || g_impedance < 0.05) {
|
||||||
|
g_impedance = 0;
|
||||||
|
num = 0;
|
||||||
|
start_mpptWork();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 将回路阻抗的值放入flash中 */
|
||||||
|
config_info tempConfigInfo;
|
||||||
|
if (read_config_info1(&tempConfigInfo)) {
|
||||||
|
tempConfigInfo.loopImpedance = (uint16_t)(g_impedance * 1000);
|
||||||
|
save_config_info(&tempConfigInfo);
|
||||||
|
} else {
|
||||||
|
tempConfigInfo = g_slConfigInfo;
|
||||||
|
tempConfigInfo.loopImpedance = (uint16_t)(g_impedance * 1000);
|
||||||
|
save_config_info(&tempConfigInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, "\n\n\n\n\n", sizeof("\n\n\n\n\n"));
|
||||||
|
// char buffer[80];
|
||||||
|
// memset(buffer, 0, sizeof(buffer));
|
||||||
|
// sprintf(buffer, " tempConfigInfo.loopImpedance : %d/1000 \n", tempConfigInfo.loopImpedance);
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||||
|
// memset(buffer, 0, sizeof(buffer));
|
||||||
|
// config_info tempConfigInfo2 = {0};
|
||||||
|
// read_config_info1(&tempConfigInfo2);
|
||||||
|
// sprintf(buffer, " tempConfigInfo2.loopImpedance : %d/1000 \n", tempConfigInfo2.loopImpedance);
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, "\n\n\n\n\n", sizeof("\n\n\n\n\n"));
|
||||||
|
|
||||||
|
g_impedanceStart = 0;
|
||||||
|
num = 0;
|
||||||
|
start_mpptWork();
|
||||||
|
// TIM_Cmd(TIM3, ENABLE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 再次打开放电端口,避免上电引起的异常波动
|
* @brief 延时一段时间后检测是否仍然短路
|
||||||
* @param
|
* @param
|
||||||
* @retval
|
* @retval
|
||||||
*/
|
*/
|
||||||
|
@ -381,14 +603,94 @@ STR_TimeSliceOffset m_outputAgain;
|
||||||
uint8_t outputAgainFlag = 0;
|
uint8_t outputAgainFlag = 0;
|
||||||
void Task_outputAgain(void)
|
void Task_outputAgain(void)
|
||||||
{
|
{
|
||||||
|
static uint8_t num = 0;
|
||||||
|
num++;
|
||||||
|
|
||||||
if (outputAgainFlag == 1) {
|
// if (outputAgainFlag == 1) {
|
||||||
|
//// outputAgainFlag = 0;
|
||||||
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, RESET);
|
||||||
|
// TimeSliceOffset_Unregister(&m_outputAgain);
|
||||||
|
// m_outputAgain.runFlag = 0;
|
||||||
|
// num = 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// printf(" in POW_OUT_CON\n");
|
||||||
|
if (num == g_slConfigInfo.outputAgainFlagTime) {
|
||||||
|
num = 0;
|
||||||
outputAgainFlag = 0;
|
outputAgainFlag = 0;
|
||||||
TimeSliceOffset_Unregister(&m_outputAgain);
|
TimeSliceOffset_Unregister(&m_outputAgain);
|
||||||
|
m_outputAgain.runFlag = 0;
|
||||||
|
// printf(" in POW_OUT_CON control %d \n", GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN));
|
||||||
|
if (!(GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN))) {
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, " \n\n\n\n\n", sizeof(" \n\n\n\n\n"));
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, " in task pow_out_con reset", sizeof(" in task pow_out_con reset"));
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, " \n\n\n\n\n", sizeof(" \n\n\n\n\n"));
|
||||||
|
// printf(" in POW_OUT_CON RESET \n");
|
||||||
|
GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, RESET);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outputAgainFlag == 2) {
|
return;
|
||||||
TimeSliceOffset_Unregister(&m_outputAgain);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 过载后开始延时,这段时间内再次过载则关闭输出
|
||||||
|
* @param
|
||||||
|
* @retval
|
||||||
|
*/
|
||||||
|
STR_TimeSliceOffset m_excessiveLoad;
|
||||||
|
uint8_t excessiveLoadFlag = 0;
|
||||||
|
void Task_excessiveLoad(void)
|
||||||
|
{
|
||||||
|
static uint8_t num = 0;
|
||||||
|
static uint16_t numLong = 0;
|
||||||
|
|
||||||
|
// if (outputAgainFlag == 1) {
|
||||||
|
//// outputAgainFlag = 0;
|
||||||
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, RESET);
|
||||||
|
// TimeSliceOffset_Unregister(&m_outputAgain);
|
||||||
|
// m_outputAgain.runFlag = 0;
|
||||||
|
// num = 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// printf(" in POW_OUT_CON\n");
|
||||||
|
if (outputAgainFlag == 1) {
|
||||||
|
num = 0;
|
||||||
|
numLong = 0;
|
||||||
|
excessiveLoadFlag = 0;
|
||||||
|
TimeSliceOffset_Unregister(&m_excessiveLoad);
|
||||||
|
m_excessiveLoad.runFlag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (excessiveLoadFlag == 1) {
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num == g_slConfigInfo.excessiveLoadFlagTime) {
|
||||||
|
num = 0;
|
||||||
|
excessiveLoadFlag = 0;
|
||||||
|
TimeSliceOffset_Unregister(&m_excessiveLoad);
|
||||||
|
m_excessiveLoad.runFlag = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (excessiveLoadFlag >= 2) {
|
||||||
|
GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, RESET);
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN))) {
|
||||||
|
numLong++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numLong == g_slConfigInfo.eLAgainTime) {
|
||||||
|
numLong = 0;
|
||||||
|
GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
||||||
|
excessiveLoadFlag = 0;
|
||||||
|
TimeSliceOffset_Unregister(&m_excessiveLoad);
|
||||||
|
m_excessiveLoad.runFlag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -412,6 +714,7 @@ void Task_sensorEnableBroadcast(void)
|
||||||
enabBroadcastTimeFlag = 0;
|
enabBroadcastTimeFlag = 0;
|
||||||
run_Broadcast = 1;
|
run_Broadcast = 1;
|
||||||
TimeSliceOffset_Unregister(&m_sensorEnableBroadcast);
|
TimeSliceOffset_Unregister(&m_sensorEnableBroadcast);
|
||||||
|
m_sensorEnableBroadcast.runFlag = 0;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -423,6 +726,8 @@ void Task_sensorEnableBroadcast(void)
|
||||||
*/
|
*/
|
||||||
void g_Mppt_Para_Init(void)
|
void g_Mppt_Para_Init(void)
|
||||||
{
|
{
|
||||||
|
g_impedance = (float_t)g_slConfigInfo.loopImpedance / 1000;
|
||||||
|
|
||||||
g_Mppt_Para.Registration_Status = UNREGISTER;
|
g_Mppt_Para.Registration_Status = UNREGISTER;
|
||||||
g_Mppt_Para.address[0] = g_slConfigInfo.address[0];
|
g_Mppt_Para.address[0] = g_slConfigInfo.address[0];
|
||||||
g_Mppt_Para.address[1] = g_slConfigInfo.address[1];
|
g_Mppt_Para.address[1] = g_slConfigInfo.address[1];
|
||||||
|
@ -434,11 +739,26 @@ void g_Mppt_Para_Init(void)
|
||||||
g_Mppt_Para.Access_Node_Type = defaultValue.access_Node_Type;
|
g_Mppt_Para.Access_Node_Type = defaultValue.access_Node_Type;
|
||||||
g_Mppt_Para.Communication_Methods = defaultValue.communication_Methods;
|
g_Mppt_Para.Communication_Methods = defaultValue.communication_Methods;
|
||||||
|
|
||||||
g_Mppt_Para.Battery_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
// g_Mppt_Para.Output_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
||||||
g_Mppt_Para.Charg_Current = get_capturedata(get_CHG_CURR);
|
// g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage;
|
||||||
g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
|
// g_Mppt_Para.Charg_Current = get_capturedata(get_CHG_CURR);
|
||||||
g_Mppt_Para.Solar_Open_Circuit_Voltage = get_capturedata(get_PV1_VOLT_IN);
|
// g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
|
||||||
g_Mppt_Para.HighSideMos_Temperature = get_capturedata(get_MOSFET_Temper);
|
// g_Mppt_Para.Solar_Open_Circuit_Voltage = get_capturedata(get_PV1_VOLT_IN);
|
||||||
|
// g_Mppt_Para.HighSideMos_Temperature = get_capturedata(get_MOSFET_Temper); g_Mppt_Para.Output_Voltage = get_capturedata(get_PV_VOLT_OUT);
|
||||||
|
|
||||||
|
g_Mppt_Para.Output_Voltage = 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.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.HighSideMos_Temperature = get_MOSFET_Temper();
|
||||||
|
|
||||||
|
if (g_Mppt_Para.Battery_Voltage < 15 || g_Mppt_Para.Battery_Voltage > 11) {
|
||||||
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
||||||
|
g_impedanceStart = 1;
|
||||||
|
}
|
||||||
g_Mppt_Para.DischargMos_State = GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN)
|
g_Mppt_Para.DischargMos_State = GPIO_ReadOutputDataBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN)
|
||||||
&& GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN);
|
&& GPIO_ReadInputDataBit(DSG_PROT_GPIO, DSG_PROT_PIN);
|
||||||
g_Mppt_Para.MPPT_Mode = NoWork;
|
g_Mppt_Para.MPPT_Mode = NoWork;
|
||||||
|
@ -492,14 +812,21 @@ void hardware_Init(void)
|
||||||
TIM2_Init(1);
|
TIM2_Init(1);
|
||||||
uart_dev_init();
|
uart_dev_init();
|
||||||
PWM_TIM_Configuration();
|
PWM_TIM_Configuration();
|
||||||
|
// TIM_SetCompare4(TIM4, 0);
|
||||||
ADC_all_Init();
|
ADC_all_Init();
|
||||||
RUN_LED_Init();
|
RUN_LED_Init();
|
||||||
WDI_INPUT_Init();
|
WDI_INPUT_Init();
|
||||||
SPI_Flash_Init();
|
SPI_Flash_Init();
|
||||||
POW_OUT_CON_Init();
|
POW_OUT_CON_Init();
|
||||||
DSG_PROT_Init();
|
DSG_PROT_Init();
|
||||||
EnPowerSupply_Init();
|
WORK_VOLT_INT_Init();
|
||||||
|
// EnPowerSupply_Init();
|
||||||
|
|
||||||
TIM3_Init(1);
|
// 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使能
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,8 @@ device_handle uart_dev_init(void)
|
||||||
void uart_init(uartIndex_e uart_index, int baud)
|
void uart_init(uartIndex_e uart_index, int baud)
|
||||||
{
|
{
|
||||||
if (uart_index == BAT485_UART_INDEX) {
|
if (uart_index == BAT485_UART_INDEX) {
|
||||||
BAT_485_Init(uart_devices[0].uart_baudrate);
|
// BAT_485_Init(uart_devices[0].uart_baudrate);
|
||||||
|
BAT_485_Init(115200);
|
||||||
} else if (uart_index == GW485_UART_INDEX) {
|
} else if (uart_index == GW485_UART_INDEX) {
|
||||||
GW_485_Init(uart_devices[1].uart_baudrate);
|
GW_485_Init(uart_devices[1].uart_baudrate);
|
||||||
}
|
}
|
||||||
|
@ -227,9 +228,12 @@ void uart_dev_write(device_handle device, void *data, int len)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
uart_putchar(device, ((u_int8_t *)data)[i]);
|
// uart_putchar(device, ((u_int8_t *)data)[i]);
|
||||||
|
uart_putchar(device, ((char *)data)[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Delay_Ms(1);
|
||||||
|
|
||||||
#if rs485_send_enable
|
#if rs485_send_enable
|
||||||
if(device == g_bat485_uart3_handle){
|
if(device == g_bat485_uart3_handle){
|
||||||
bat485_tx_disenabla();
|
bat485_tx_disenabla();
|
||||||
|
|
|
@ -66,4 +66,10 @@ void DSG_PROT_Init(void);
|
||||||
#define EnPowerSupply_PIN GPIO_Pin_3
|
#define EnPowerSupply_PIN GPIO_Pin_3
|
||||||
void EnPowerSupply_Init(void);
|
void EnPowerSupply_Init(void);
|
||||||
|
|
||||||
|
/* 电压低于11V进入中断 */
|
||||||
|
/* WORK_VOLT_INT --> PA12 */
|
||||||
|
#define WORK_VOLT_INT_GPIO GPIOA
|
||||||
|
#define WORK_VOLT_INT_PIN GPIO_Pin_12
|
||||||
|
void WORK_VOLT_INT_Init(void);
|
||||||
|
|
||||||
#endif /* HARDWARE_INC_GPIO_H_ */
|
#endif /* HARDWARE_INC_GPIO_H_ */
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include <adc.h>
|
#include <adc.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int16_t Calibrattion_Val = 0;
|
int16_t Calibrattion_Val = 0;
|
||||||
|
|
||||||
//ADC对应GPIO初始化配置以及ADC初始化配置
|
//ADC对应GPIO初始化配置以及ADC初始化配置
|
||||||
|
|
|
@ -66,8 +66,8 @@ void POW_OUT_CON_Init(void)
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_Init(POW_OUT_CON_GPIO, &GPIO_InitStructure);
|
GPIO_Init(POW_OUT_CON_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, SET);
|
||||||
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, RESET);
|
GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXTI2_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
|
void EXTI2_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
|
||||||
|
@ -100,22 +100,23 @@ void DSG_PROT_Init(void)
|
||||||
void EXTI2_IRQHandler(void)
|
void EXTI2_IRQHandler(void)
|
||||||
{
|
{
|
||||||
if(EXTI_GetITStatus(EXTI_Line2)==SET) { //EXTI_GetITStatus用来获取中断标志位状态,如果EXTI线产生中断则返回SET,否则返回RESET
|
if(EXTI_GetITStatus(EXTI_Line2)==SET) { //EXTI_GetITStatus用来获取中断标志位状态,如果EXTI线产生中断则返回SET,否则返回RESET
|
||||||
// printf("Run at EXTI\r\n");
|
// GPIO_WriteBit(DSG_PROT_GPIO, DSG_PROT_PIN, RESET);
|
||||||
GPIO_WriteBit(DSG_PROT_GPIO, DSG_PROT_PIN, RESET);
|
|
||||||
if (outputAgainFlag == 0) {
|
|
||||||
Delay_Ms(1);
|
|
||||||
GPIO_WriteBit(DSG_PROT_GPIO, DSG_PROT_PIN, SET);
|
|
||||||
// TimeSliceOffset_Register(&m_outputAgain, Task_outputAgain
|
|
||||||
// , outputAgain_reloadVal, outputAgain_offset);
|
|
||||||
outputAgainFlag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (outputAgainFlag == 1) {
|
|
||||||
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, RESET);
|
|
||||||
outputAgainFlag = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXTI_ClearITPendingBit(EXTI_Line2); //清除中断标志位
|
EXTI_ClearITPendingBit(EXTI_Line2); //清除中断标志位
|
||||||
|
// printf("Run at EXTI 111\r\n");
|
||||||
|
if (outputAgainFlag == 0) {
|
||||||
|
outputAgainFlag = 1;
|
||||||
|
TimeSliceOffset_Register(&m_outputAgain, Task_outputAgain
|
||||||
|
, outputAgain_reloadVal, outputAgain_offset);
|
||||||
|
// m_outputAgain.runFlag = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (outputAgainFlag == 1) {
|
||||||
|
// GPIO_WriteBit(POW_OUT_CON_GPIO, POW_OUT_CON_PIN, RESET);
|
||||||
|
// EXTI_ClearITPendingBit(EXTI_Line2); //清除中断标志位
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,5 +133,49 @@ void EnPowerSupply_Init(void)
|
||||||
GPIO_WriteBit(EnPowerSupply_GPIO, EnPowerSupply_PIN, RESET);
|
GPIO_WriteBit(EnPowerSupply_GPIO, EnPowerSupply_PIN, RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EXTI15_10_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
|
||||||
|
|
||||||
|
void WORK_VOLT_INT_Init(void)
|
||||||
|
{
|
||||||
|
RCC_PB2PeriphClockCmd(RCC_PB2Periph_AFIO | RCC_PB2Periph_GPIOA, ENABLE);
|
||||||
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
GPIO_InitStructure.GPIO_Pin = WORK_VOLT_INT_PIN;
|
||||||
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; //下拉输入
|
||||||
|
GPIO_Init(WORK_VOLT_INT_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
|
/* GPIOA ----> EXTI_Line12 */
|
||||||
|
EXTI_InitTypeDef EXTI_InitStructure;
|
||||||
|
GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource12);//指定中断/事件线的输入源,实际上是设定外部中断配置寄存器AFIO_EXTICRx的值,此处为PA12
|
||||||
|
EXTI_InitStructure.EXTI_Line = EXTI_Line12; //EXTI中断/事件线选择,此处选择EXTI_Line12
|
||||||
|
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; //EXTI模式选择,此处选择为产生中断模式
|
||||||
|
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; //EXTI边沿触发事件,此处选择为上升沿触发
|
||||||
|
EXTI_InitStructure.EXTI_LineCmd = ENABLE; //使能EXTI线
|
||||||
|
EXTI_Init(&EXTI_InitStructure);
|
||||||
|
|
||||||
|
NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //使能EXTI12中断通道
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; //设置抢占优先级为1
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //设置子优先级为2
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能外部中断通道
|
||||||
|
NVIC_Init(&NVIC_InitStructure); //中断优先级分组初始化
|
||||||
|
}
|
||||||
|
|
||||||
|
void EXTI15_10_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if(EXTI_GetITStatus(EXTI_Line12)==SET) { //EXTI_GetITStatus用来获取中断标志位状态,如果EXTI线产生中断则返回SET,否则返回RESET
|
||||||
|
// printf(" vout low 11V \n");
|
||||||
|
EXTI_ClearITPendingBit(EXTI_Line12); //清除中断标志位
|
||||||
|
excessiveLoadFlag++;
|
||||||
|
TimeSliceOffset_Register(&m_excessiveLoad, Task_excessiveLoad
|
||||||
|
, excessiveLoad_reloadVal, excessiveLoad_offset);
|
||||||
|
|
||||||
|
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, "\n\n\n\n\n in vout low 8V (Set)\n\n\n\n\n", sizeof("\n\n\n\n\n in vout low 8V (Set)\n\n\n\n\n"));
|
||||||
|
}
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, "\n\n\n\n\n in vout low 8V\n\n\n\n\n", sizeof("\n\n\n\n\n in vout low 8V\n\n\n\n\n"));
|
||||||
|
// if(EXTI_GetITStatus(EXTI_Line12)==SET) { //EXTI_GetITStatus用来获取中断标志位状态,如果EXTI线产生中断则返回SET,否则返回RESET
|
||||||
|
//// printf(" vout low 11V \n");
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, "\n\n\n\n\n in vout low 8V\n\n\n\n\n", sizeof("\n\n\n\n\n in vout low 8V\n\n\n\n\n"));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ void PWM_TIM_Configuration(void)
|
||||||
|
|
||||||
void Set_duty_ratio(float *duty_ratio)
|
void Set_duty_ratio(float *duty_ratio)
|
||||||
{
|
{
|
||||||
if (*duty_ratio < 0.5) {
|
if (*duty_ratio < 0.05) {
|
||||||
*duty_ratio = 0.5;
|
*duty_ratio = 0.05;
|
||||||
// return;
|
// return;
|
||||||
} else if (*duty_ratio > 0.9) {
|
} else if (*duty_ratio > 0.9) {
|
||||||
*duty_ratio = 0.9;
|
*duty_ratio = 0.9;
|
||||||
|
|
|
@ -23,7 +23,7 @@ void TIM3_Init(uint16_t delay_ms)
|
||||||
/* 分频系数 */
|
/* 分频系数 */
|
||||||
uint16_t psc = (SystemCoreClock / 10000) - 1;
|
uint16_t psc = (SystemCoreClock / 10000) - 1;
|
||||||
/* 周期数 */
|
/* 周期数 */
|
||||||
uint16_t arr = delay_ms * 10 - 1;
|
uint16_t arr = delay_ms * 1 - 1;
|
||||||
|
|
||||||
TIM3_Int_Init(arr, psc);
|
TIM3_Int_Init(arr, psc);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ void TIM3_Int_Init(uint16_t arr, uint16_t psc)
|
||||||
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //TIM计数模式,向上计数模式
|
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //TIM计数模式,向上计数模式
|
||||||
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); //根据指定的参数初始化TIMx的时间基数单位
|
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); //根据指定的参数初始化TIMx的时间基数单位
|
||||||
|
|
||||||
|
TIM_ClearITPendingBit(TIM3, TIM_IT_Update); //清除TIM3的中断挂起位。
|
||||||
TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE ); //使能TIM3中断,允许更新中断
|
TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE ); //使能TIM3中断,允许更新中断
|
||||||
|
|
||||||
//初始化TIM NVIC,设置中断优先级分组
|
//初始化TIM NVIC,设置中断优先级分组
|
||||||
|
@ -50,13 +51,14 @@ void TIM3_Int_Init(uint16_t arr, uint16_t psc)
|
||||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道1中断
|
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道1中断
|
||||||
NVIC_Init(&NVIC_InitStructure); //初始化NVIC
|
NVIC_Init(&NVIC_InitStructure); //初始化NVIC
|
||||||
|
|
||||||
TIM_Cmd(TIM3, ENABLE); //TIM3使能
|
// TIM_Cmd(TIM3, ENABLE); //TIM3使能
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIM3_IRQHandler(void)
|
void TIM3_IRQHandler(void)
|
||||||
{
|
{
|
||||||
if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) { //检查TIM3中断是否发生。
|
if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) { //检查TIM3中断是否发生。
|
||||||
TIM_ClearITPendingBit(TIM3, TIM_IT_Update); //清除TIM3的中断挂起位。
|
TIM_ClearITPendingBit(TIM3, TIM_IT_Update); //清除TIM3的中断挂起位。
|
||||||
|
// uart_dev_write(g_bat485_uart3_handle, "\n\n\n\n\nin tim3 irt\n\n\n\n\n", sizeof("\n\n\n\n\nin tim3 irt\n\n\n\n\n"));
|
||||||
test();
|
test();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,9 +103,9 @@ void TIM2_IRQHandler(void)
|
||||||
if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) { //检查TIM2中断是否发生。
|
if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) { //检查TIM2中断是否发生。
|
||||||
TIM_ClearITPendingBit(TIM2, TIM_IT_Update); //清除TIM1的中断挂起位。
|
TIM_ClearITPendingBit(TIM2, TIM_IT_Update); //清除TIM1的中断挂起位。
|
||||||
TimeSliceOffset_Produce();
|
TimeSliceOffset_Produce();
|
||||||
if (outputAgainFlag == 1) {
|
// if (outputAgainFlag == 1) {
|
||||||
outputAgainFlag = 0;
|
// outputAgainFlag = 0;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,10 @@ 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_misc.h \
|
||||||
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.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\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/gpio.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\Drivers\RingQueue/ring_queue.h \
|
||||||
|
D:\psx\MPPT\git\Hardware\inc/rs485.h
|
||||||
|
|
||||||
D:\psx\MPPT\git\App\inc/collect_Conversion.h:
|
D:\psx\MPPT\git\App\inc/collect_Conversion.h:
|
||||||
|
|
||||||
|
@ -89,3 +92,9 @@ D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h:
|
||||||
D:\psx\MPPT\git\Hardware\inc/adc.h:
|
D:\psx\MPPT\git\Hardware\inc/adc.h:
|
||||||
|
|
||||||
D:\psx\MPPT\git\Hardware\inc/gpio.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:
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
obj/User/main.o
BIN
obj/User/main.o
Binary file not shown.
|
@ -68,12 +68,17 @@ mppt_Nos_V0.4.lst: mppt_Nos_V0.4.elf
|
||||||
mppt_Nos_V0.4.siz: mppt_Nos_V0.4.elf
|
mppt_Nos_V0.4.siz: mppt_Nos_V0.4.elf
|
||||||
@ riscv-none-embed-size --format=berkeley "mppt_Nos_V0.4.elf"
|
@ riscv-none-embed-size --format=berkeley "mppt_Nos_V0.4.elf"
|
||||||
@ @
|
@ @
|
||||||
|
$(MAKE) --no-print-directory post-build
|
||||||
|
|
||||||
# ÆäËûÄ¿±ê
|
# ÆäËûÄ¿±ê
|
||||||
clean:
|
clean:
|
||||||
-$(RM) $(ASM_UPPER_DEPS)$(OBJS)$(SECONDARY_FLASH)$(SECONDARY_LIST)$(SECONDARY_SIZE)$(ASM_DEPS)$(S_DEPS)$(S_UPPER_DEPS)$(C_DEPS) mppt_Nos_V0.4.elf
|
-$(RM) $(ASM_UPPER_DEPS)$(OBJS)$(SECONDARY_FLASH)$(SECONDARY_LIST)$(SECONDARY_SIZE)$(ASM_DEPS)$(S_DEPS)$(S_UPPER_DEPS)$(C_DEPS) mppt_Nos_V0.4.elf
|
||||||
-@
|
-@
|
||||||
|
post-build:
|
||||||
|
-riscv-none-embed-objcopy -O binary "mppt_Nos_V0.4.elf" "mppt_Nos_V0.4.bin"
|
||||||
|
-@
|
||||||
secondary-outputs: $(SECONDARY_FLASH) $(SECONDARY_LIST) $(SECONDARY_SIZE)
|
secondary-outputs: $(SECONDARY_FLASH) $(SECONDARY_LIST) $(SECONDARY_SIZE)
|
||||||
|
|
||||||
.PHONY: all clean dependents
|
.PHONY: all clean dependents post-build
|
||||||
|
|
||||||
-include ../makefile.targets
|
-include ../makefile.targets
|
||||||
|
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
22565
obj/mppt_Nos_V0.4.lst
22565
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
|
@ -0,0 +1,326 @@
|
||||||
|
.text
|
||||||
|
| 0x00000140 | __riscv_save_12 | FUNC | 0x30
|
||||||
|
| 0x00000148 | __riscv_save_8 | FUNC | 0x28
|
||||||
|
| 0x00000156 | __riscv_save_7 | FUNC | 0x1a
|
||||||
|
| 0x00000170 | __riscv_save_1 | FUNC | 0xc
|
||||||
|
| 0x0000017c | __riscv_restore_12 | FUNC | 0x24
|
||||||
|
| 0x00000180 | __riscv_restore_10 | FUNC | 0x20
|
||||||
|
| 0x0000018a | __riscv_restore_5 | FUNC | 0x16
|
||||||
|
| 0x00000194 | __riscv_restore_3 | FUNC | 0xc
|
||||||
|
| 0x000001a0 | memset | FUNC | 0xa8
|
||||||
|
| 0x00000248 | NMI_Handler | FUNC | 0x2
|
||||||
|
| 0x0000024a | HardFault_Handler | FUNC | 0x2
|
||||||
|
| 0x0000024c | main | FUNC | 0x4a
|
||||||
|
| 0x00000296 | SystemInit | FUNC | 0x106
|
||||||
|
| 0x0000039c | SystemCoreClockUpdate | FUNC | 0xa4
|
||||||
|
| 0x000004c8 | ADC_DeInit | FUNC | 0x28
|
||||||
|
| 0x000004f0 | ADC_Init | FUNC | 0x56
|
||||||
|
| 0x00000546 | ADC_Cmd | FUNC | 0x10
|
||||||
|
| 0x00000556 | ADC_ResetCalibration | FUNC | 0xa
|
||||||
|
| 0x00000560 | ADC_GetResetCalibrationStatus | FUNC | 0x8
|
||||||
|
| 0x00000568 | ADC_StartCalibration | FUNC | 0xa
|
||||||
|
| 0x00000572 | ADC_GetCalibrationStatus | FUNC | 0x8
|
||||||
|
| 0x0000057a | ADC_SoftwareStartConvCmd | FUNC | 0x18
|
||||||
|
| 0x00000592 | ADC_RegularChannelConfig | FUNC | 0xb8
|
||||||
|
| 0x0000064a | ADC_GetConversionValue | FUNC | 0x8
|
||||||
|
| 0x00000652 | ADC_GetFlagStatus | FUNC | 0xa
|
||||||
|
| 0x0000065c | ADC_BufferCmd | FUNC | 0x18
|
||||||
|
| 0x00000674 | ADC_DutyDelayCmd | FUNC | 0x12
|
||||||
|
| 0x00000686 | ADC_FIFO_Cmd | FUNC | 0x12
|
||||||
|
| 0x00000698 | ADC_Sample_ModeConfig | FUNC | 0x10
|
||||||
|
| 0x000006a8 | Get_CalibrationValue | FUNC | 0x1d4
|
||||||
|
| 0x0000087c | DBGMCU_GetCHIPID | FUNC | 0x6
|
||||||
|
| 0x00000882 | EXTI_Init | FUNC | 0x6a
|
||||||
|
| 0x000008ec | EXTI_GetITStatus | FUNC | 0x1e
|
||||||
|
| 0x0000090a | EXTI_ClearITPendingBit | FUNC | 0xa
|
||||||
|
| 0x00000914 | GPIO_Init | FUNC | 0xc0
|
||||||
|
| 0x000009d4 | GPIO_ReadInputDataBit | FUNC | 0xa
|
||||||
|
| 0x000009de | GPIO_ReadOutputDataBit | FUNC | 0xa
|
||||||
|
| 0x000009e8 | GPIO_SetBits | FUNC | 0x4
|
||||||
|
| 0x000009ec | GPIO_WriteBit | FUNC | 0xa
|
||||||
|
| 0x000009f6 | GPIO_PinRemapConfig | FUNC | 0x12c
|
||||||
|
| 0x00000b22 | GPIO_EXTILineConfig | FUNC | 0x2c
|
||||||
|
| 0x00000b4e | GPIO_IPD_Unused | FUNC | 0x190
|
||||||
|
| 0x00000cde | NVIC_PriorityGroupConfig | FUNC | 0x6
|
||||||
|
| 0x00000ce4 | NVIC_Init | FUNC | 0x54
|
||||||
|
| 0x00000d38 | RCC_ADCCLKConfig | FUNC | 0x14
|
||||||
|
| 0x00000d4c | RCC_GetClocksFreq | FUNC | 0xd6
|
||||||
|
| 0x00000e22 | RCC_PB2PeriphClockCmd | FUNC | 0x1e
|
||||||
|
| 0x00000e40 | RCC_PB1PeriphClockCmd | FUNC | 0x1e
|
||||||
|
| 0x00000e5e | RCC_PB2PeriphResetCmd | FUNC | 0x1e
|
||||||
|
| 0x00000e7c | SPI_Init | FUNC | 0x32
|
||||||
|
| 0x00000eae | SPI_Cmd | FUNC | 0x1a
|
||||||
|
| 0x00000ec8 | SPI_I2S_SendData | FUNC | 0x4
|
||||||
|
| 0x00000ecc | SPI_I2S_ReceiveData | FUNC | 0x4
|
||||||
|
| 0x00000ed0 | SPI_I2S_GetFlagStatus | FUNC | 0xa
|
||||||
|
| 0x00000eda | TIM_TimeBaseInit | FUNC | 0x76
|
||||||
|
| 0x00000f50 | TIM_OC4Init | FUNC | 0x7c
|
||||||
|
| 0x00000fcc | TIM_Cmd | FUNC | 0x18
|
||||||
|
| 0x00000fe4 | TIM_CtrlPWMOutputs | FUNC | 0x16
|
||||||
|
| 0x00000ffa | TIM_ITConfig | FUNC | 0x12
|
||||||
|
| 0x0000100c | TIM_ARRPreloadConfig | FUNC | 0x1a
|
||||||
|
| 0x00001026 | TIM_OC4PreloadConfig | FUNC | 0x16
|
||||||
|
| 0x0000103c | TIM_SetCompare4 | FUNC | 0x16
|
||||||
|
| 0x00001052 | TIM_GetCounter | FUNC | 0x18
|
||||||
|
| 0x0000106a | TIM_GetITStatus | FUNC | 0x18
|
||||||
|
| 0x00001082 | TIM_ClearITPendingBit | FUNC | 0xc
|
||||||
|
| 0x0000108e | USART_Init | FUNC | 0xba
|
||||||
|
| 0x00001148 | USART_Cmd | FUNC | 0x16
|
||||||
|
| 0x0000115e | USART_ITConfig | FUNC | 0x36
|
||||||
|
| 0x00001194 | USART_SendData | FUNC | 0x8
|
||||||
|
| 0x0000119c | USART_ReceiveData | FUNC | 0x8
|
||||||
|
| 0x000011a4 | USART_GetFlagStatus | FUNC | 0xa
|
||||||
|
| 0x000011ae | USART_GetITStatus | FUNC | 0x3c
|
||||||
|
| 0x000011ea | ADC_all_Init | FUNC | 0xf0
|
||||||
|
| 0x000012da | SPI_Flash_Init | FUNC | 0xa4
|
||||||
|
| 0x0000137e | SPI_ReadWriteByte | FUNC | 0x5a
|
||||||
|
| 0x000013d8 | SPI_Flash_Read | FUNC | 0x68
|
||||||
|
| 0x00001440 | RUN_LED_Init | FUNC | 0x2e
|
||||||
|
| 0x0000146e | WDI_INPUT_Init | FUNC | 0x32
|
||||||
|
| 0x000014a0 | POW_OUT_CON_Init | FUNC | 0x3e
|
||||||
|
| 0x000014de | DSG_PROT_Init | FUNC | 0x5a
|
||||||
|
| 0x00001538 | EXTI2_IRQHandler | FUNC | 0x5e
|
||||||
|
| 0x00001596 | EXTI1_IRQHandler | FUNC | 0x1c
|
||||||
|
| 0x000015b2 | PWM_GPIO_Configuration | FUNC | 0x48
|
||||||
|
| 0x000015fa | PWM_TIM_Configuration | FUNC | 0x6c
|
||||||
|
| 0x00001666 | Set_duty_ratio | FUNC | 0x86
|
||||||
|
| 0x000016ec | GW_485_Init | FUNC | 0xb2
|
||||||
|
| 0x0000179e | BAT_485_Init | FUNC | 0xbe
|
||||||
|
| 0x0000185c | USARTx_SendByte | FUNC | 0x1a
|
||||||
|
| 0x00001876 | USART3_IRQHandler | FUNC | 0x46
|
||||||
|
| 0x000018bc | USART4_IRQHandler | FUNC | 0x46
|
||||||
|
| 0x00001902 | TIM3_Int_Init | FUNC | 0x52
|
||||||
|
| 0x00001954 | TIM3_Init | FUNC | 0x28
|
||||||
|
| 0x0000197c | TIM3_IRQHandler | FUNC | 0x2a
|
||||||
|
| 0x000019a6 | TIM2_Int_Init | FUNC | 0x58
|
||||||
|
| 0x000019fe | TIM2_Init | FUNC | 0x2e
|
||||||
|
| 0x00001a2c | TIM2_IRQHandler | FUNC | 0x2a
|
||||||
|
| 0x00001a56 | SysTick_Handler | FUNC | 0xe
|
||||||
|
| 0x00001a64 | TIM1_UP_IRQHandler | FUNC | 0x32
|
||||||
|
| 0x00001a96 | TimeSliceOffset_Register | FUNC | 0x3e
|
||||||
|
| 0x00001ad4 | TimeSliceOffset_Unregister | FUNC | 0x2e
|
||||||
|
| 0x00001b02 | TimeSliceOffset_Start | FUNC | 0x22
|
||||||
|
| 0x00001b24 | TimeSliceOffset_Produce | FUNC | 0x28
|
||||||
|
| 0x00001b4c | InitRingQueue | FUNC | 0x10
|
||||||
|
| 0x00001b5c | InRingQueue | FUNC | 0x2c
|
||||||
|
| 0x00001b88 | OutRingQueue | FUNC | 0x26
|
||||||
|
| 0x00001bae | RingQueueLength | FUNC | 0x10
|
||||||
|
| 0x00001bbe | Delay_Init | FUNC | 0x20
|
||||||
|
| 0x00001bde | Delay_Ms | FUNC | 0x36
|
||||||
|
| 0x00001c14 | USART_Printf_Init | FUNC | 0x5a
|
||||||
|
| 0x00001c6e | _write | FUNC | 0x3e
|
||||||
|
| 0x00001cac | _sbrk | FUNC | 0x26
|
||||||
|
| 0x00001cd2 | Get_ConversionVal | FUNC | 0x2a
|
||||||
|
| 0x00001cfc | middleAverageFilter | FUNC | 0x92
|
||||||
|
| 0x00001d8e | get_CHG_CURR | FUNC | 0x44
|
||||||
|
| 0x00001dd2 | get_PV_VOLT_OUT | FUNC | 0x44
|
||||||
|
| 0x00001e16 | get_DSG_CURR | FUNC | 0x44
|
||||||
|
| 0x00001e5a | get_PV1_VOLT_IN | FUNC | 0x44
|
||||||
|
| 0x00001e9e | get_MOSFET_Temper | FUNC | 0x56
|
||||||
|
| 0x00001ef4 | read_config_info | FUNC | 0x86
|
||||||
|
| 0x00001f7a | mppt_constantVoltage | FUNC | 0x66
|
||||||
|
| 0x00001fe0 | mppt_constantVoltageO | FUNC | 0x62
|
||||||
|
| 0x00002042 | mppt_constantCurrentO | FUNC | 0x62
|
||||||
|
| 0x000020a4 | MpptContorl | FUNC | 0xe8
|
||||||
|
| 0x0000218c | MpptMode | FUNC | 0x2da
|
||||||
|
| 0x00002466 | test | FUNC | 0x188
|
||||||
|
| 0x000025ee | SL_ReadRegisterMPPTMode | FUNC | 0x2a
|
||||||
|
| 0x00002618 | SL_ReadRegisterDischargMosState | FUNC | 0x24
|
||||||
|
| 0x0000263c | SL_ReadRegisterHighSideMosTemperature | FUNC | 0x3e
|
||||||
|
| 0x0000267a | SL_ReadRegisterSolarOpenCircuitVoltage | FUNC | 0x3e
|
||||||
|
| 0x000026b8 | SL_ReadRegisterDischargCurrent | FUNC | 0x3c
|
||||||
|
| 0x000026f4 | SL_ReadRegisterChargCurrent | FUNC | 0x3c
|
||||||
|
| 0x00002730 | SL_ReadRegisterBatteryVoltage | FUNC | 0x3c
|
||||||
|
| 0x0000276c | SL_MsgProcFunc_Registration_request | FUNC | 0x54
|
||||||
|
| 0x000027c0 | SL_MsgProcFunc_Broadcast_Scan | FUNC | 0x34
|
||||||
|
| 0x000027f4 | SL_MsgProcFunc_Write_Register | FUNC | 0x56
|
||||||
|
| 0x0000284a | CheckFunc | FUNC | 0x3e
|
||||||
|
| 0x00002888 | randomDelay | FUNC | 0x2c
|
||||||
|
| 0x000028b4 | Check_485_bus_busy | FUNC | 0x7a
|
||||||
|
| 0x0000292e | SL_MsgProcFunc_Remote_Upgrade | FUNC | 0x9e
|
||||||
|
| 0x000029cc | SL_MsgProcFunc_Update_Profile | FUNC | 0x9e
|
||||||
|
| 0x00002a6a | SL_MsgProcFunc_Read_Register | FUNC | 0x18c
|
||||||
|
| 0x00002bf6 | FRT_MsgHandler | FUNC | 0x32
|
||||||
|
| 0x00002c28 | read_and_process_uart_data | FUNC | 0x2ca
|
||||||
|
| 0x00002ef2 | Task_wdi | FUNC | 0x52
|
||||||
|
| 0x00002f44 | Task_RunLED | FUNC | 0x326
|
||||||
|
| 0x0000326a | Task_usart | FUNC | 0x10
|
||||||
|
| 0x0000327a | Task_startMpptControl | FUNC | 0x136
|
||||||
|
| 0x000033b0 | Task_softStart | FUNC | 0x12a
|
||||||
|
| 0x000034da | stop_mpptWork | FUNC | 0x30
|
||||||
|
| 0x0000350a | Task_refreshRegister | FUNC | 0x24c
|
||||||
|
| 0x00003756 | start_mpptWork | FUNC | 0x36
|
||||||
|
| 0x0000378c | Task_impedanceCalculation | FUNC | 0x17e
|
||||||
|
| 0x0000390a | Task_recvbroadcast | FUNC | 0x154
|
||||||
|
| 0x00003a5e | Task_sensorEnableBroadcast | FUNC | 0x4c
|
||||||
|
| 0x00003aaa | g_Mppt_Para_Init | FUNC | 0x176
|
||||||
|
| 0x00003c20 | task_Init | FUNC | 0x84
|
||||||
|
| 0x00003ca4 | hardware_Init | FUNC | 0x42
|
||||||
|
| 0x00003ce6 | uart_putchar | FUNC | 0x46
|
||||||
|
| 0x00003d2c | uart_dev_init | FUNC | 0x52
|
||||||
|
| 0x00003d7e | bat485_tx_enabla | FUNC | 0x1a
|
||||||
|
| 0x00003d98 | bat485_tx_disenabla | FUNC | 0x1a
|
||||||
|
| 0x00003db2 | gw485_tx_enabla | FUNC | 0x18
|
||||||
|
| 0x00003dca | gw485_tx_disenabla | FUNC | 0x18
|
||||||
|
| 0x00003de2 | uart_dev_write | FUNC | 0x62
|
||||||
|
| 0x00003e44 | uart_dev_char_present | FUNC | 0x18
|
||||||
|
| 0x00003e5c | uart_dev_in_char | FUNC | 0x28
|
||||||
|
| 0x00003e84 | ring_queue_length | FUNC | 0xe
|
||||||
|
| 0x00003e92 | __adddf3 | FUNC | 0x730
|
||||||
|
| 0x000045c2 | __gtdf2 | FUNC | 0xae
|
||||||
|
| 0x00004670 | __ltdf2 | FUNC | 0xb6
|
||||||
|
| 0x00004726 | __muldf3 | FUNC | 0x4b8
|
||||||
|
| 0x00004bde | __subdf3 | FUNC | 0x73e
|
||||||
|
| 0x0000531c | __floatsidf | FUNC | 0x72
|
||||||
|
| 0x0000538e | __addsf3 | FUNC | 0x36a
|
||||||
|
| 0x000056f8 | __divsf3 | FUNC | 0x2b2
|
||||||
|
| 0x000059aa | __nesf2 | FUNC | 0x5c
|
||||||
|
| 0x00005a06 | __gtsf2 | FUNC | 0x86
|
||||||
|
| 0x00005a8c | __lesf2 | FUNC | 0x8c
|
||||||
|
| 0x00005b18 | __mulsf3 | FUNC | 0x294
|
||||||
|
| 0x00005dac | __subsf3 | FUNC | 0x388
|
||||||
|
| 0x00006134 | __fixsfsi | FUNC | 0x62
|
||||||
|
| 0x00006196 | __fixunssfsi | FUNC | 0x56
|
||||||
|
| 0x000061ec | __floatsisf | FUNC | 0xc6
|
||||||
|
| 0x000062b2 | __floatunsisf | FUNC | 0xce
|
||||||
|
| 0x00006380 | __extendsfdf2 | FUNC | 0xac
|
||||||
|
| 0x0000642c | __truncdfsf2 | FUNC | 0x16a
|
||||||
|
| 0x00006596 | __clzsi2 | FUNC | 0x6e
|
||||||
|
| 0x00006604 | memcpy | FUNC | 0xb2
|
||||||
|
| 0x000066b6 | printf | FUNC | 0x40
|
||||||
|
| 0x000066f6 | _puts_r | FUNC | 0xd4
|
||||||
|
| 0x000067ca | puts | FUNC | 0xc
|
||||||
|
| 0x000067d6 | srand | FUNC | 0x58
|
||||||
|
| 0x0000682e | rand | FUNC | 0x84
|
||||||
|
| 0x000068b2 | sprintf | FUNC | 0x46
|
||||||
|
| 0x000068f8 | __swbuf_r | FUNC | 0xbc
|
||||||
|
| 0x000069b4 | __swsetup_r | FUNC | 0xfc
|
||||||
|
| 0x00006ab0 | __sflush_r | FUNC | 0x130
|
||||||
|
| 0x00006be0 | _fflush_r | FUNC | 0x66
|
||||||
|
| 0x00006c46 | std | FUNC | 0x66
|
||||||
|
| 0x00006cac | _cleanup_r | FUNC | 0xa
|
||||||
|
| 0x00006cb6 | __sfmoreglue | FUNC | 0x46
|
||||||
|
| 0x00006cfc | __sinit | FUNC | 0x6c
|
||||||
|
| 0x00006d68 | __sfp | FUNC | 0xa0
|
||||||
|
| 0x00006e08 | _fwalk_reent | FUNC | 0x6a
|
||||||
|
| 0x00006e72 | __swhatbuf_r | FUNC | 0x58
|
||||||
|
| 0x00006eca | __smakebuf_r | FUNC | 0x92
|
||||||
|
| 0x00006f5c | malloc | FUNC | 0xa
|
||||||
|
| 0x00006f66 | _free_r | FUNC | 0xa8
|
||||||
|
| 0x0000700e | _malloc_r | FUNC | 0xda
|
||||||
|
| 0x000070e8 | __ssputs_r | FUNC | 0xe4
|
||||||
|
| 0x000071cc | _svfprintf_r | FUNC | 0x26a
|
||||||
|
| 0x00007436 | __sfputc_r | FUNC | 0x28
|
||||||
|
| 0x0000745e | __sfputs_r | FUNC | 0x42
|
||||||
|
| 0x000074a0 | _vfiprintf_r | FUNC | 0x288
|
||||||
|
| 0x00007728 | _printf_common | FUNC | 0x10c
|
||||||
|
| 0x00007834 | _printf_i | FUNC | 0x2a2
|
||||||
|
| 0x00007ad6 | _sbrk_r | FUNC | 0x2a
|
||||||
|
| 0x00007b00 | __sread | FUNC | 0x2c
|
||||||
|
| 0x00007b2c | __swrite | FUNC | 0x48
|
||||||
|
| 0x00007b74 | __sseek | FUNC | 0x30
|
||||||
|
| 0x00007ba4 | __sclose | FUNC | 0x6
|
||||||
|
| 0x00007baa | _write_r | FUNC | 0x2e
|
||||||
|
| 0x00007bd8 | _close_r | FUNC | 0x28
|
||||||
|
| 0x00007c00 | _fstat_r | FUNC | 0x2a
|
||||||
|
| 0x00007c2a | _isatty_r | FUNC | 0x28
|
||||||
|
| 0x00007c52 | _lseek_r | FUNC | 0x2c
|
||||||
|
| 0x00007c7e | memchr | FUNC | 0x18
|
||||||
|
| 0x00007c96 | memmove | FUNC | 0x46
|
||||||
|
| 0x00007cdc | __malloc_lock | FUNC | 0x2
|
||||||
|
| 0x00007cde | __malloc_unlock | FUNC | 0x2
|
||||||
|
| 0x00007ce0 | _realloc_r | FUNC | 0x58
|
||||||
|
| 0x00007d38 | _read_r | FUNC | 0x2c
|
||||||
|
| 0x00007d64 | _malloc_usable_size_r | FUNC | 0x14
|
||||||
|
| 0x00007d78 | _close | FUNC | 0xc
|
||||||
|
| 0x00007d84 | _fstat | FUNC | 0xc
|
||||||
|
| 0x00007d90 | _isatty | FUNC | 0xc
|
||||||
|
| 0x00007d9c | _lseek | FUNC | 0xc
|
||||||
|
| 0x00007da8 | _read | FUNC | 0xc
|
||||||
|
| 0x00007e60 | mosTemperADC | OBJECT | 0x1e2
|
||||||
|
| 0x00008718 | __clz_tab | OBJECT | 0x100
|
||||||
|
| 0x00008818 | __sf_fake_stderr | OBJECT | 0x20
|
||||||
|
| 0x00008838 | __sf_fake_stdin | OBJECT | 0x20
|
||||||
|
| 0x00008858 | __sf_fake_stdout | OBJECT | 0x20
|
||||||
|
|
||||||
|
.data
|
||||||
|
| 0x20000000 | HBPrescTable | OBJECT | 0x10
|
||||||
|
| 0x20000010 | PBHBPrescTable | OBJECT | 0x10
|
||||||
|
| 0x20000020 | g_slConfigInfo | OBJECT | 0x2c
|
||||||
|
| 0x2000004c | defaultValue | OBJECT | 0xe
|
||||||
|
| 0x2000005c | g_MsgTbl | OBJECT | 0x30
|
||||||
|
| 0x2000008c | g_RegTblR | OBJECT | 0x38
|
||||||
|
| 0x200000c4 | uart_devices | OBJECT | 0x38
|
||||||
|
| 0x200000fc | impure_data | OBJECT | 0x60
|
||||||
|
| 0x20000160 | SystemCoreClock | OBJECT | 0x4
|
||||||
|
| 0x20000164 | ADCPrescTable | OBJECT | 0x4
|
||||||
|
| 0x20000168 | curbrk.5007 | OBJECT | 0x4
|
||||||
|
| 0x2000016c | g_duty_ratio | OBJECT | 0x4
|
||||||
|
| 0x20000170 | onlyOnce.5797 | OBJECT | 0x1
|
||||||
|
| 0x20000171 | onlyOnce.5805 | OBJECT | 0x1
|
||||||
|
| 0x20000172 | onlyOnce.5810 | OBJECT | 0x1
|
||||||
|
| 0x20000173 | only_once.5830 | OBJECT | 0x1
|
||||||
|
| 0x20000174 | only_once.6423 | OBJECT | 0x1
|
||||||
|
| 0x20000175 | run_Broadcast | OBJECT | 0x1
|
||||||
|
| 0x20000178 | _impure_ptr | OBJECT | 0x4
|
||||||
|
| 0x2000017c | _global_impure_ptr | OBJECT | 0x4
|
||||||
|
|
||||||
|
.bss
|
||||||
|
| 0x20000180 | ADC_Trim | OBJECT | 0x2
|
||||||
|
| 0x20000184 | CHIPID | OBJECT | 0x4
|
||||||
|
| 0x20000188 | OPA_Trim | OBJECT | 0x4
|
||||||
|
| 0x2000018c | TS_Val | OBJECT | 0x4
|
||||||
|
| 0x20000190 | NVIC_Priority_Group | OBJECT | 0x4
|
||||||
|
| 0x20000194 | Calibrattion_Val | OBJECT | 0x2
|
||||||
|
| 0x20000198 | USART3_Rbuffer | OBJECT | 0x1
|
||||||
|
| 0x2000019c | USART4_Rbuffer | OBJECT | 0x1
|
||||||
|
| 0x200001a0 | pTimeSliceList | OBJECT | 0x4
|
||||||
|
| 0x200001a4 | p_ms | OBJECT | 0x2
|
||||||
|
| 0x200001a6 | p_us | OBJECT | 0x2
|
||||||
|
| 0x200001a8 | ConstantCurrentV.5826 | OBJECT | 0x4
|
||||||
|
| 0x200001ac | ConstantVoltageChargeV.5804 | OBJECT | 0x4
|
||||||
|
| 0x200001b0 | ConstantVoltageV.5827 | OBJECT | 0x4
|
||||||
|
| 0x200001b4 | FloatChargeV.5809 | OBJECT | 0x4
|
||||||
|
| 0x200001b8 | FloatI.5828 | OBJECT | 0x4
|
||||||
|
| 0x200001bc | StopSolarOpenCircuitV.5829 | OBJECT | 0x4
|
||||||
|
| 0x200001c0 | TrickleChargeC.5796 | OBJECT | 0x4
|
||||||
|
| 0x200001c4 | RegistrationRequestFlag | OBJECT | 0x1
|
||||||
|
| 0x200001c6 | checkRegisterRefreshTimeFlag.6446 | OBJECT | 0x2
|
||||||
|
| 0x200001c8 | checkSolarOpenCircuitVTimeFlag.6422 | OBJECT | 0x2
|
||||||
|
| 0x200001cc | currOne.6468 | OBJECT | 0x4
|
||||||
|
| 0x200001d0 | currTwo.6470 | OBJECT | 0x4
|
||||||
|
| 0x200001d4 | dutyRatio.6430 | OBJECT | 0x4
|
||||||
|
| 0x200001d8 | enabBroadcastTimeFlag.6482 | OBJECT | 0x4
|
||||||
|
| 0x200001dc | flag.6417 | OBJECT | 0x1
|
||||||
|
| 0x200001dd | g_batteryState | OBJECT | 0x1
|
||||||
|
| 0x200001e0 | g_impedance | OBJECT | 0x4
|
||||||
|
| 0x200001e4 | g_recvBroadcastDevice | OBJECT | 0x4
|
||||||
|
| 0x200001e8 | g_recvBroadcastRegisterNumber | OBJECT | 0x1
|
||||||
|
| 0x200001ea | num.6429 | OBJECT | 0x2
|
||||||
|
| 0x200001ec | num.6467 | OBJECT | 0x1
|
||||||
|
| 0x200001ed | outputAgainFlag | OBJECT | 0x1
|
||||||
|
| 0x200001ee | overTemperature | OBJECT | 0x1
|
||||||
|
| 0x200001ef | recvbroadcast_flag | OBJECT | 0x1
|
||||||
|
| 0x200001f0 | run_number.6454 | OBJECT | 0x1
|
||||||
|
| 0x200001f4 | temp.6440 | OBJECT | 0x4
|
||||||
|
| 0x200001f8 | voltOne.6469 | OBJECT | 0x4
|
||||||
|
| 0x200001fc | voltTwo.6471 | OBJECT | 0x4
|
||||||
|
| 0x20000200 | g_bat485_uart3_handle | OBJECT | 0x4
|
||||||
|
| 0x20000204 | g_gw485_uart4_handle | OBJECT | 0x4
|
||||||
|
| 0x20000208 | __malloc_free_list | OBJECT | 0x4
|
||||||
|
| 0x2000020c | __malloc_sbrk_start | OBJECT | 0x4
|
||||||
|
| 0x20000210 | g_Mppt_Para | OBJECT | 0x2d
|
||||||
|
| 0x20000240 | rs485_buff | OBJECT | 0x32
|
||||||
|
| 0x20000274 | m_impedanceCalculation | OBJECT | 0x10
|
||||||
|
| 0x20000284 | m_recvbroadcast | OBJECT | 0x10
|
||||||
|
| 0x20000294 | m_refreshRegister | OBJECT | 0x10
|
||||||
|
| 0x200002a4 | m_runled | OBJECT | 0x10
|
||||||
|
| 0x200002b4 | m_sensorEnableBroadcast | OBJECT | 0x10
|
||||||
|
| 0x200002c4 | m_softStart | OBJECT | 0x10
|
||||||
|
| 0x200002d4 | m_startMpptControl | OBJECT | 0x10
|
||||||
|
| 0x200002e4 | m_usart | OBJECT | 0x10
|
||||||
|
| 0x200002f4 | m_wdi | OBJECT | 0x10
|
||||||
|
| 0x20000304 | bat485_in_buff | OBJECT | 0xc8
|
||||||
|
| 0x200003cc | gw485_in_buff | OBJECT | 0x12c
|
||||||
|
| 0x200004f8 | errno | OBJECT | 0x4
|
||||||
|
|
Loading…
Reference in New Issue