更新 整定参数EEPROM存储

This commit is contained in:
吴俊潮 2024-08-26 17:37:50 +08:00
parent 1d430b6b62
commit c2fc039068
80 changed files with 2417 additions and 1830 deletions

View File

@ -33,6 +33,7 @@
#include "dac7311.h"
#include "provalctrl.h"
#include "encoder.h"
#include "eeprom.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -119,8 +120,11 @@ int main(void)
ds18b20_init();
_74hc165_init();
modbus_rtu_init();
ee_io_init();
prov_init(); //比例阀初始化
prov_adj_init(); //比例阀整定参数初始化
/* USER CODE END 2 */
/* Infinite loop */
@ -128,8 +132,8 @@ int main(void)
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
//数字量输入输出
digital_ctrl();
@ -143,6 +147,7 @@ int main(void)
encoder_run();
}
/* USER CODE END 3 */
}

File diff suppressed because one or more lines are too long

View File

@ -201,6 +201,14 @@
<ItemText>adj_pv2</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>0</SubType>
<ItemText>0x080C0000</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
@ -967,6 +975,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>56</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\users\Src\flash.c</PathWithFileName>
<FilenameWithoutPath>flash.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>

View File

@ -82,7 +82,7 @@
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>1</RunUserProg2>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
@ -792,6 +792,11 @@
<FileType>1</FileType>
<FilePath>..\users\Src\encoder.c</FilePath>
</File>
<File>
<FileName>flash.c</FileName>
<FileType>1</FileType>
<FilePath>..\users\Src\flash.c</FilePath>
</File>
</Files>
</Group>
<Group>

Binary file not shown.

View File

@ -22,14 +22,14 @@ Dialog DLL: TCM.DLL V1.56.4.0
<h2>Project:</h2>
C:\Users\admin\Desktop\wujunchao\00_Projects\02_Actuator Testing\00_Code\00_New\VOQC\MDK-ARM\VOQC.uvprojx
Project File Date: 08/20/2024
Project File Date: 08/26/2024
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin'
Build target 'VOQC'
compiling provalctrl.c...
linking...
Program Size: Code=32202 RO-data=458 RW-data=396 ZI-data=6652
Program Size: Code=33426 RO-data=458 RW-data=396 ZI-data=6644
FromELF: creating hex file...
"VOQC\VOQC.axf" - 0 Error(s), 0 Warning(s).
@ -54,7 +54,7 @@ Package Vendor: Keil
<h2>Collection of Component Files used:</h2>
* Component: ARM::CMSIS:CORE@5.6.0
Build Time Elapsed: 00:00:06
Build Time Elapsed: 00:00:05
</pre>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -53,6 +53,7 @@
"voqc\uarts.o"
"voqc\provalctrl.o"
"voqc\encoder.o"
"voqc\flash.o"
--strict --scatter "VOQC\VOQC.sct"
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
Dependencies for Project 'VOQC', Target 'VOQC': (DO NOT MODIFY !)
CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARM Compiler_5_06
F (startup_stm32f407xx.s)(0x66C2E5B4)(--cpu Cortex-M4.fp.sp -g --apcs=interwork -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include --pd "__UVISION_VERSION SETA 539" --pd "_RTE_ SETA 1" --pd "STM32F407xx SETA 1" --pd "_RTE_ SETA 1" --list startup_stm32f407xx.lst --xref -o voqc\startup_stm32f407xx.o --depend voqc\startup_stm32f407xx.d)
F (../Core/Src/main.c)(0x66C94C4D)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\main.o --omf_browse voqc\main.crf --depend voqc\main.d)
F (../Core/Src/main.c)(0x66CC2AB9)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\main.o --omf_browse voqc\main.crf --depend voqc\main.d)
I (../Core/Inc/main.h)(0x6694D721)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h)(0x66B41EAC)
I (../Core/Inc/stm32f4xx_hal_conf.h)(0x66C2E5B0)
@ -66,7 +66,8 @@ I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compile
I (../board/Inc/ms5803.h)(0x669760FF)
I (../board/Inc/ds18b20.h)(0x6694D35E)
I (../board/Inc/dac7311.h)(0x66949B65)
I (../users/Inc/provalctrl.h)(0x66C9A813)
I (../users/Inc/provalctrl.h)(0x66CC4181)
I (../board/Inc/eeprom.h)(0x66CC2370)
F (../Core/Src/gpio.c)(0x66C2E5A9)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\gpio.o --omf_browse voqc\gpio.crf --depend voqc\gpio.d)
I (../Core/Inc/gpio.h)(0x668F85FA)
I (../Core/Inc/main.h)(0x6694D721)
@ -1428,7 +1429,9 @@ I (../CH395Q/ch395inc.h)(0x66C443B0)
I (../Core/Inc/spi.h)(0x668F85FC)
I (../CH395Q/ch395cmd.h)(0x664FF969)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2)
I (../users/Inc/provalctrl.h)(0x66C9A813)
I (../users/Inc/provalctrl.h)(0x66CC4181)
I (../board/Inc/dac7311.h)(0x66949B65)
I (../board/Inc/eeprom.h)(0x66CC2370)
F (..\board\Src\dac7311.c)(0x66AB21F7)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\dac7311.o --omf_browse voqc\dac7311.crf --depend voqc\dac7311.d)
I (../board/Inc/dac7311.h)(0x66949B65)
I (../Core/Inc/main.h)(0x6694D721)
@ -1479,8 +1482,8 @@ I (../CH395Q/ch395inc.h)(0x66C443B0)
I (../Core/Inc/spi.h)(0x668F85FC)
I (../CH395Q/ch395cmd.h)(0x664FF969)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2)
F (..\board\Src\eeprom.c)(0x6684ABE8)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\eeprom.o --omf_browse voqc\eeprom.crf --depend voqc\eeprom.d)
I (../board/Inc/eeprom.h)(0x66849F26)
F (..\board\Src\eeprom.c)(0x66CC24D3)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\eeprom.o --omf_browse voqc\eeprom.crf --depend voqc\eeprom.d)
I (../board/Inc/eeprom.h)(0x66CC2370)
I (../Core/Inc/main.h)(0x6694D721)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h)(0x66B41EAC)
I (../Core/Inc/stm32f4xx_hal_conf.h)(0x66C2E5B0)
@ -2239,8 +2242,8 @@ I (../Core/Inc/spi.h)(0x668F85FC)
I (../CH395Q/ch395cmd.h)(0x664FF969)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\stdio.h)(0x5E8E3CC2)
F (..\users\Src\provalctrl.c)(0x66C9B557)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\provalctrl.o --omf_browse voqc\provalctrl.crf --depend voqc\provalctrl.d)
I (../users/Inc/provalctrl.h)(0x66C9A813)
F (..\users\Src\provalctrl.c)(0x66CC4C86)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\provalctrl.o --omf_browse voqc\provalctrl.crf --depend voqc\provalctrl.d)
I (../users/Inc/provalctrl.h)(0x66CC4181)
I (../modbus/Inc/modbus.h)(0x669A1795)
I (../users/Inc/timer.h)(0x66C969BA)
I (../Core/Inc/tim.h)(0x6694D67D)
@ -2290,6 +2293,7 @@ I (../Core/Inc/spi.h)(0x668F85FC)
I (../CH395Q/ch395cmd.h)(0x664FF969)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2)
I (../board/Inc/dac7311.h)(0x66949B65)
I (../board/Inc/eeprom.h)(0x66CC2370)
F (..\users\Src\encoder.c)(0x66C43FCC)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\encoder.o --omf_browse voqc\encoder.crf --depend voqc\encoder.d)
I (../users/Inc/encoder.h)(0x66C3E76F)
I (../modbus/Inc/modbus.h)(0x669A1795)
@ -2340,3 +2344,53 @@ I (../CH395Q/ch395inc.h)(0x66C443B0)
I (../Core/Inc/spi.h)(0x668F85FC)
I (../CH395Q/ch395cmd.h)(0x664FF969)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2)
F (..\users\Src\flash.c)(0x66CC176F)(--c99 -c --cpu Cortex-M4.fp.sp -g -O0 -Otime --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../board/Inc -I ../CH395Q -I ../modbus/Inc -I ../users/Inc -I.\RTE\_VOQC -IC:\Users\admin\AppData\Local\Arm\Packs\ARM\CMSIS\5.9.0\CMSIS\Core\Include -IC:\Users\admin\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.15.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION="539" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx -o voqc\flash.o --omf_browse voqc\flash.crf --depend voqc\flash.d)
I (../users/Inc/flash.h)(0x66CC1418)
I (../Core/Inc/main.h)(0x6694D721)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h)(0x66B41EAC)
I (../Core/Inc/stm32f4xx_hal_conf.h)(0x66C2E5B0)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h)(0x66B41EAC)
I (../Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h)(0x66B41EA1)
I (../Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h)(0x66B41EA0)
I (../Drivers/CMSIS/Include/core_cm4.h)(0x66B41EAC)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\stdint.h)(0x5E8E3CC2)
I (../Drivers/CMSIS/Include/cmsis_version.h)(0x66B41EAC)
I (../Drivers/CMSIS/Include/cmsis_compiler.h)(0x66B41EAC)
I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x66B41EAC)
I (../Drivers/CMSIS/Include/mpu_armv7.h)(0x66B41EAC)
I (../Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h)(0x66B41EA1)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h)(0x66B41EAC)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\stddef.h)(0x5E8E3CC2)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_adc.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc_ex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c_ex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h)(0x66B41EAC)
I (../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h)(0x66B41EAC)
I (../users/Inc/timer.h)(0x66C969BA)
I (../Core/Inc/tim.h)(0x6694D67D)
I (../modbus/Inc/modbus.h)(0x669A1795)
I (../users/Inc/uarts.h)(0x66B30E3E)
I (../Core/Inc/usart.h)(0x668F85FD)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\stdio.h)(0x5E8E3CC2)
I (../CH395Q/ch395.h)(0x669605EC)
I (../CH395Q/ch395inc.h)(0x66C443B0)
I (../Core/Inc/spi.h)(0x668F85FC)
I (../CH395Q/ch395cmd.h)(0x664FF969)
I (C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\include\string.h)(0x5E8E3CC2)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -53,3 +53,5 @@ voqc\ads1220.o: ../Core/Inc/spi.h
voqc\ads1220.o: ../CH395Q/ch395cmd.h
voqc\ads1220.o: C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin\..\include\string.h
voqc\ads1220.o: ../users/Inc/provalctrl.h
voqc\ads1220.o: ../board/Inc/dac7311.h
voqc\ads1220.o: ../board/Inc/eeprom.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
MDK-ARM/VOQC/flash.crf Normal file

Binary file not shown.

54
MDK-ARM/VOQC/flash.d Normal file
View File

@ -0,0 +1,54 @@
voqc\flash.o: ..\users\Src\flash.c
voqc\flash.o: ../users/Inc/flash.h
voqc\flash.o: ../Core/Inc/main.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h
voqc\flash.o: ../Core/Inc/stm32f4xx_hal_conf.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h
voqc\flash.o: ../Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h
voqc\flash.o: ../Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h
voqc\flash.o: ../Drivers/CMSIS/Include/core_cm4.h
voqc\flash.o: C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin\..\include\stdint.h
voqc\flash.o: ../Drivers/CMSIS/Include/cmsis_version.h
voqc\flash.o: ../Drivers/CMSIS/Include/cmsis_compiler.h
voqc\flash.o: ../Drivers/CMSIS/Include/cmsis_armcc.h
voqc\flash.o: ../Drivers/CMSIS/Include/mpu_armv7.h
voqc\flash.o: ../Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
voqc\flash.o: C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin\..\include\stddef.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_exti.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_adc.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_adc_ex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c_ex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h
voqc\flash.o: ../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h
voqc\flash.o: ../users/Inc/timer.h
voqc\flash.o: ../Core/Inc/tim.h
voqc\flash.o: ../Core/Inc/main.h
voqc\flash.o: ../modbus/Inc/modbus.h
voqc\flash.o: ../users/Inc/timer.h
voqc\flash.o: ../users/Inc/uarts.h
voqc\flash.o: ../Core/Inc/usart.h
voqc\flash.o: C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin\..\include\stdio.h
voqc\flash.o: ../modbus/Inc/modbus.h
voqc\flash.o: ../CH395Q/ch395.h
voqc\flash.o: ../CH395Q/ch395inc.h
voqc\flash.o: ../Core/Inc/spi.h
voqc\flash.o: ../CH395Q/ch395cmd.h
voqc\flash.o: C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin\..\include\string.h

BIN
MDK-ARM/VOQC/flash.o Normal file

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.

View File

@ -68,3 +68,4 @@ voqc\main.o: ../board/Inc/ms5803.h
voqc\main.o: ../board/Inc/ds18b20.h
voqc\main.o: ../board/Inc/dac7311.h
voqc\main.o: ../users/Inc/provalctrl.h
voqc\main.o: ../board/Inc/eeprom.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.

View File

@ -52,3 +52,4 @@ voqc\provalctrl.o: ../Core/Inc/spi.h
voqc\provalctrl.o: ../CH395Q/ch395cmd.h
voqc\provalctrl.o: C:\Users\admin\Desktop\wujunchao\99_General softwares\Keil_v5\ARM\ARM Compiler_5_06\Bin\..\include\string.h
voqc\provalctrl.o: ../board/Inc/dac7311.h
voqc\provalctrl.o: ../board/Inc/eeprom.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.

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.

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.

View File

@ -39,7 +39,8 @@ void ee_io_init(void);
uint8_t ee_writebytes(uint8_t *_pWriteBuf, uint16_t _usAddress, uint16_t _usSize);
uint8_t ee_readbytes(uint8_t *_pReadBuf, uint16_t _usAddress, uint16_t _usSize);
void ee_writefloats(uint16_t _usAddress, float wr_data[3], uint8_t _usSize);
void ee_readfloats(uint16_t _usAddress, float rd_data[3], uint8_t _usSize);
#endif
/*! end of the file */

View File

@ -380,4 +380,23 @@ cmd_fail: /*
// printf(" Rx1_Buffer is:%s,\t the BufferSize1 is:%d\r\n",Rx1_Buffer,BufferSize1);
uint8_t trans1[12]={0};
uint8_t trans2[12]={0};
void ee_writefloats(uint16_t _usAddress, float wr_data[3], uint8_t _usSize)
{
for(uint8_t i = 0;i<_usSize;i++)
{
memcpy(trans1,&wr_data[i],4);
ee_writebytes(trans1, _usAddress + i*4, 4);
}
}
void ee_readfloats(uint16_t _usAddress, float rd_data[3], uint8_t _usSize)
{
for(uint8_t i =0 ;i<_usSize;i++)
{
ee_readbytes(trans2, _usAddress + i*4, 4);
memcpy(&rd_data[i],&trans2,4);
}
}

32
users/Inc/flash.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef __FLASH_H
#define __FLASH_H
#include "main.h"
#define FMC_FLASH_BASE 0x08000000 // FLASH的起始地址
#define FMC_FLASH_END 0x080E0000 // FLASH的结束地址
#define ADDR_WRITE ((uint32_t)0x080C0000)
#define FLASH_WAITETIME 50000 //FLASH等待超时时间
//FLASH 扇区的起始地址
#define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) //扇区0起始地址, 16 Kbytes
#define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000) //扇区1起始地址, 16 Kbytes
#define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000) //扇区2起始地址, 16 Kbytes
#define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000) //扇区3起始地址, 16 Kbytes
#define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000) //扇区4起始地址, 64 Kbytes
#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) //扇区5起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) //扇区6起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) //扇区7起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) //扇区8起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) //扇区9起始地址, 128 Kbytes
#define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) //扇区10起始地址,128 Kbytes
#define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) //扇区11起始地址,128 Kbytes
void ReadFlashData(uint32_t ReadAddress, uint8_t *data, uint32_t length);
static uint32_t STMFLASH_ReadWord(uint32_t faddr);
uint8_t STMFLASH_GetFlashSector(uint32_t addr);
void WriteFlashData(uint32_t WriteAddress, uint8_t *data, uint32_t length);
#endif

View File

@ -1,15 +1,22 @@
#ifndef _PROVALCTRL_H_
#define _PROVALCTRL_H_
#include "modbus.h"
#include "dac7311.h"
#include "main.h"
//#include "flash.h" //擦写出错,写入出错
#include "eeprom.h"
extern float ao_dwq; //AO输出电流值(定位器)
extern float ao_blf1; //AO输出电流值(比例阀)
extern float ao_blf2; //AO输出电流值(比例阀)
typedef enum
{
PROV_RUNNING = 0,
PROV_ADJUSTING = 1,
PROV_HOLDING = 2
PROV_RUNNING = 0, //运行
PROV_ADJUSTING = 1, //整定
PROV_HOLDING = 2 //保持原样,不进行校准
}prov_status;
typedef enum
@ -25,6 +32,7 @@ typedef enum
typedef struct
{
prov_status status;
unsigned char tag;
float current_pressure;
float current_percent;
@ -59,7 +67,7 @@ typedef struct
void (*pvout)(float pout); //dac out
}propotion_valve; //propotion valve
#define OSCILL_TIMES 10
#define OSCILL_TIMES 5
typedef struct
{
unsigned char adj_flag;
@ -94,13 +102,6 @@ void prov_adj(propotion_valve *pvx, prov_adjust *adj_pvx);
/******************************************************************************************/
#endif

96
users/Src/flash.c Normal file
View File

@ -0,0 +1,96 @@
#include "flash.h"
/**
*@Flash读取指定字节数据
*@1ReadAddress
*@2*data
*@3length
*/
void ReadFlashData(uint32_t ReadAddress, uint8_t *data, uint32_t length)
{
for(uint32_t i=0;i<length;i++)
{
data[i]=*(uint8_t*)(ReadAddress+i); //读取数据
}
}
//读取指定地址的字(32位数据)
//faddr:读地址
//返回值:对应数据.
static uint32_t STMFLASH_ReadWord(uint32_t faddr)
{
return *(uint32_t*)faddr;
}
//获取某个地址所在的flash扇区
//addr:flash地址
//返回值:0~11,即addr所在的扇区
uint8_t STMFLASH_GetFlashSector(uint32_t addr)
{
if(addr<ADDR_FLASH_SECTOR_1)return FLASH_SECTOR_0;
else if(addr<ADDR_FLASH_SECTOR_2)return FLASH_SECTOR_1;
else if(addr<ADDR_FLASH_SECTOR_3)return FLASH_SECTOR_2;
else if(addr<ADDR_FLASH_SECTOR_4)return FLASH_SECTOR_3;
else if(addr<ADDR_FLASH_SECTOR_5)return FLASH_SECTOR_4;
else if(addr<ADDR_FLASH_SECTOR_6)return FLASH_SECTOR_5;
else if(addr<ADDR_FLASH_SECTOR_7)return FLASH_SECTOR_6;
else if(addr<ADDR_FLASH_SECTOR_8)return FLASH_SECTOR_7;
else if(addr<ADDR_FLASH_SECTOR_9)return FLASH_SECTOR_8;
else if(addr<ADDR_FLASH_SECTOR_10)return FLASH_SECTOR_9;
else if(addr<ADDR_FLASH_SECTOR_11)return FLASH_SECTOR_10;
return FLASH_SECTOR_11;
}
/**
*@Flash写入数据
*@1WriteAddress
*@2*data
*@3length
*/
void WriteFlashData(uint32_t WriteAddress, uint8_t *data, uint32_t length)
{
FLASH_EraseInitTypeDef FlashEraseInit;
HAL_StatusTypeDef FlashStatus=HAL_OK;
uint32_t SectorError=0;
uint32_t addrx=0;
uint32_t endaddr=0;
if( (WriteAddress < FMC_FLASH_BASE) || ( WriteAddress + length >= FMC_FLASH_END) || (length <= 0) )
return;
HAL_FLASH_Unlock(); //解锁
addrx = WriteAddress; //写入的起始地址
endaddr = WriteAddress+length; //写入的结束地址
while(addrx<endaddr) //扫清一切障碍.(对非FFFFFFFF的地方,先擦除)
{
if(STMFLASH_ReadWord(addrx)!=0XFFFFFFFF)//有非0XFFFFFFFF的地方,要擦除这个扇区
{
FlashEraseInit.TypeErase=FLASH_TYPEERASE_SECTORS; //擦除类型,扇区擦除
FlashEraseInit.Sector=STMFLASH_GetFlashSector(addrx); //要擦除的扇区
FlashEraseInit.NbSectors=1; //一次只擦除一个扇区
FlashEraseInit.VoltageRange=FLASH_VOLTAGE_RANGE_3; //电压范围VCC=2.7~3.6V之间!!
if(HAL_FLASHEx_Erase(&FlashEraseInit,&SectorError)!=HAL_OK)
{
break;//发生错误了
}
}else addrx+=1;
FLASH_WaitForLastOperation(FLASH_WAITETIME); //等待上次操作完成
}
FlashStatus=FLASH_WaitForLastOperation(FLASH_WAITETIME); //等待上次操作完成
if(FlashStatus==HAL_OK)
{
while(WriteAddress<endaddr)//写数据
{
if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE,WriteAddress,*data)!=HAL_OK)//写入数据
{
break; //写入异常
}
WriteAddress+=1;
data++;
}
}
HAL_FLASH_Lock(); //上锁
}

View File

@ -1,14 +1,15 @@
#include "provalctrl.h"
#include "modbus.h"
#include "dac7311.h"
#include "main.h"
propotion_valve pv_one;
propotion_valve pv_two;
float data_wr[3] = {0}; //[0,1,2] -> “Kp, Ti, Td”
float data_rd[3] = {0};
void prov_init(void) //比例阀结构体参数初始化
{
ee_readfloats(EEPROM_ReadAddress1,data_rd,3);
pv_one.status = PROV_RUNNING;
pv_one.tag = 1; //标签比例阀1
pv_one.current_pressure = 0; //当前气压Kpa
pv_one.current_percent = 0; //当前气压百分比( 0~900Kpa -> 0~100%
pv_one.target_pressure = 0; //目标气压Kpa
@ -20,13 +21,13 @@ void prov_init(void) //比例阀结构体参数初始化
pv_one.bias_previous = 0; //前一个时刻的偏差
pv_one.bias_area = 0.5; //允许的误差范围±a(%)
pv_one.Kp = 0.02; //比例系数
pv_one.Ti = 1.6; //积分时间
pv_one.Kp = data_rd[0]; //比例系数
pv_one.Ti = (data_rd[1] == 0)?(1000000):(data_rd[1]); //积分时间
pv_one.Ing = 0; //积分输出
pv_one.Ing_max = 50; //积分上限
pv_one.Ing_max = 50; //积分上限
pv_one.Ing_min = -50; //积分下限
pv_one.Ing_sum = 0; //偏差求和
pv_one.Td = 0.4; //微分时间
pv_one.Td = data_rd[2]; //微分时间
pv_one.Ts = 0.05; //采样周期50ms
pv_one.Div = 0; //微分输出
pv_one.pidout = 0;
@ -44,7 +45,9 @@ void prov_init(void) //比例阀结构体参数初始化
/************************************************/
ee_readfloats(EEPROM_ReadAddress1+12,data_rd,3);
pv_two.status = PROV_RUNNING;
pv_two.tag = 2; //标签比例阀2
pv_two.current_pressure = 0;
pv_two.current_percent = 0;
pv_two.target_pressure = 0;
@ -53,16 +56,16 @@ void prov_init(void) //比例阀结构体参数初始化
pv_two.input_min = 4;
pv_two.input_max = 20;
pv_two.bias = 0;
pv_one.bias_previous = 0; //前一个时刻的偏差
pv_two.bias_previous = 0; //前一个时刻的偏差
pv_two.bias_area = 0.5;
pv_two.Kp = 0;
pv_two.Ti = 1000000;
pv_two.Kp = data_rd[0];
pv_two.Ti = (data_rd[1] == 0)?(1000000):(data_rd[1]); //积分时间
pv_two.Ing = 0;
pv_two.Ing_max = 50;
pv_two.Ing_min = -50;
pv_two.Ing_sum = 0;
pv_two.Td = 0;
pv_two.Td = data_rd[2];
pv_two.Ts = 0.05; //采样周期50ms
pv_two.Div = 0;
pv_two.pidout = 0;
@ -90,7 +93,7 @@ void prov_adj_init(void)
adj_pv1.relay_a[i] = 0;
adj_pv1.relay_tc[i] = 0;
}
adj_pv1.relay_d = 0.1; //继电整定,回环幅值
adj_pv1.relay_d = 0.15; //继电整定,回环幅值
adj_pv1.air_source = 0; //气源单位Kpa
adj_pv1.middle_current = 0; //中间气压电流
adj_pv1.oscil_times = 0; //振荡次数
@ -103,7 +106,7 @@ void prov_adj_init(void)
adj_pv2.relay_a[i] = 0;
adj_pv2.relay_tc[i] = 0;
}
adj_pv2.relay_d = 0.1; //继电整定,回环幅值
adj_pv2.relay_d = 0.15; //继电整定,回环幅值
adj_pv2.air_source = 0; //气源单位Kpa
adj_pv2.middle_current = 0; //中间气压电流
adj_pv2.oscil_times = 0; //振荡次数
@ -123,10 +126,10 @@ void prov_set(float target_p, propotion_valve *pvx) //比例阀目标值设定
pvx->cstep_min = pvx->current_input - (float)0.8; //逐步输出调节下限
pvx->cstep_wait = 0; //等待计数清零
pvx->pidout_max = pvx->current_input + 1; //pid输出调节上限
pvx->pidout_min = pvx->current_input - 1; //pid输出调节下限
pvx->pidout_max = pvx->current_input + (float)0.5; //pid输出调节上限
pvx->pidout_min = pvx->current_input - (float)0.5; //pid输出调节下限
pvx->pvout(target_p); //dac输出
pvx->pvout(pvx->current_input); //dac输出
}
float abs_bias(float bias) //绝对值计算
@ -165,7 +168,6 @@ void prov_calibrate_pid(propotion_valve *pvx) //pid校准
{
pvx->Ing_sum = 0;
pvx->Ing = 0;
pvx->bias_previous = 0;
}
}
@ -175,6 +177,7 @@ float ao_dwq = 0; //AO输出电流值(定位器)
float ao_blf1 = 0; //AO输出电流值(比例阀)
float ao_blf2 = 0; //AO输出电流值(比例阀)
float atm_pressure = 0; //用于存放大气绝压单位0.1Kpa
adj_steps astep = ADJ_WAIT; //自整定步骤
void analog_ctrl(void)
{
@ -197,6 +200,23 @@ void analog_ctrl(void)
prov_set(ao_blf2,&pv_two); //控制比例阀2
}
if( (CoilState[3]&(0x40)) == 0x40 )
{
if(astep == ADJ_WAIT)
{
pv_one.status = PROV_ADJUSTING;
}
}
if( (CoilState[3]&(0x20)) == 0x20 )
{
if(astep == ADJ_WAIT)
{
pv_two.status = PROV_ADJUSTING;
}
}
if(it_100ms_flag_pv == 1) //每隔100ms更新一次数据
{
it_100ms_flag_pv = 0;
@ -266,7 +286,7 @@ void prov_calibrate_step(propotion_valve *pvx) //逐步接近法
}
adj_steps astep = ADJ_WAIT; //自整定步骤
void prov_ctrl(propotion_valve *pvx, prov_adjust *adj_pvx)
{
switch(pvx->status)
@ -407,7 +427,21 @@ void prov_adj(propotion_valve *pvx, prov_adjust *adj_pvx)
}
}else //振荡次数达到目标
{
astep++;
if(tick_previous == -1)
{
tick_previous = tick500ms;
}
tick_current = tick500ms;
if( (tick_current - tick_previous) > 6) //等待6*500ms后排气
{
prov_set(4,pvx);
tick_previous = -1;
tick_current = -1;
astep++;
}
}
}
@ -420,30 +454,42 @@ void prov_adj(propotion_valve *pvx, prov_adjust *adj_pvx)
adj_pvx->relay_A += adj_pvx->relay_a[i];
adj_pvx->relay_Tc += adj_pvx->relay_tc[i];
}
adj_pvx->relay_A /= 10 * ( adj_pvx->air_source/2 * (1 + adj_pvx->relay_d) );
adj_pvx->relay_Tc /= 10;
adj_pvx->relay_A /= OSCILL_TIMES * ( adj_pvx->air_source/2 * (1 + adj_pvx->relay_d) );
adj_pvx->relay_Tc /= OSCILL_TIMES;
/* PI [0.45,0.8]*/
/* PID [0.6,0.5,0.12]*/
pvx->Kp = (float)0.2 * ( 4 * (float)0.1 ) / ( (float)3.1415 * adj_pvx->relay_A );//偏大
pvx->Ti = (float)0.5 * adj_pvx->relay_Tc/1000;
pvx->Td = (float)0.12 * adj_pvx->relay_Tc/1000;
pvx->Kp = (float)0.6 * ( 4 * (float)0.1 ) / ( (float)3.1415 * adj_pvx->relay_A ) *(float)0.5;//偏大
pvx->Ti = (float)0.5 * adj_pvx->relay_Tc/1000 * 100; //偏小
pvx->Td = (float)0.12 * adj_pvx->relay_Tc/1000 * (float)0.5; //偏大
if(tick_previous == -1)
{
tick_previous = tick500ms;
}
tick_current = tick500ms;
if( (tick_current - tick_previous) > 6) //等待6*500ms后排气
switch(pvx->tag)
{
prov_set(4,pvx);
case 1:
{
data_wr[0] = pvx->Kp;
data_wr[1] = pvx->Ti;
data_wr[2] = pvx->Td;
ee_writefloats(EEPROM_WriteAddress1,data_wr,3);
}
break;
tick_previous = -1;
tick_current = -1;
astep++;
case 2:
{
data_wr[0] = pvx->Kp;
data_wr[1] = pvx->Ti;
data_wr[2] = pvx->Td;
ee_writefloats(EEPROM_WriteAddress1 + 12,data_wr,3);
}
break;
default:
{
}
break;
}
astep++;
}
break;
@ -456,8 +502,26 @@ void prov_adj(propotion_valve *pvx, prov_adjust *adj_pvx)
tick_current = tick500ms;
if( (tick_current - tick_previous) > 10) //等待10*500ms后恢复控制
{
ao_blf1 = 0;
ao_blf2 = 0;
switch(pvx->tag) //重新触发保持寄存器
{
case 1:
{
ao_blf1 = 0;
CoilState[3] &= 0xBF; //D6 = 0
}
break;
case 2:
{
ao_blf2 = 0;
CoilState[3] &= 0xDF; //D5 = 0
}
break;
default:
{
}
break;
}
tick_previous = -1;
tick_current = -1;