去掉了tim7定时中断
This commit is contained in:
parent
3fd1e9a035
commit
c895308110
|
@ -57,7 +57,6 @@ void PendSV_Handler(void);
|
|||
void SysTick_Handler(void);
|
||||
void EXTI9_5_IRQHandler(void);
|
||||
void USART1_IRQHandler(void);
|
||||
void TIM7_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
|
|
@ -34,8 +34,6 @@ extern "C" {
|
|||
|
||||
extern TIM_HandleTypeDef htim1;
|
||||
|
||||
extern TIM_HandleTypeDef htim7;
|
||||
|
||||
extern TIM_HandleTypeDef htim15;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
@ -43,7 +41,6 @@ extern TIM_HandleTypeDef htim15;
|
|||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_TIM1_Init(void);
|
||||
void MX_TIM7_Init(void);
|
||||
void MX_TIM15_Init(void);
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
||||
|
|
Binary file not shown.
|
@ -22,14 +22,13 @@ Dialog DLL: TCM.DLL V1.32.0.0
|
|||
|
||||
<h2>Project:</h2>
|
||||
D:\Develop\Stm32Project\Project\MDK-ARM\Project.uvprojx
|
||||
Project File Date: 11/06/2024
|
||||
Project File Date: 11/07/2024
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'D:\Keil5\ARM\ARMCC\Bin'
|
||||
Build target 'Project'
|
||||
compiling stm32l4xx_it.c...
|
||||
linking...
|
||||
Program Size: Code=18316 RO-data=59236 RW-data=40 ZI-data=2896
|
||||
Program Size: Code=17940 RO-data=59236 RW-data=36 ZI-data=2820
|
||||
FromELF: creating hex file...
|
||||
"Project\Project.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
Dependencies for Project 'Project', Target 'Project': (DO NOT MODIFY !)
|
||||
F (startup_stm32l475xx.s)(0x672B7429)(--cpu Cortex-M4.fp -g --apcs=interwork --pd "__MICROLIB SETA 1"
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
--pd "__UVISION_VERSION SETA 514" --pd "_RTE_ SETA 1" --pd "STM32L475xx SETA 1"
--list startup_stm32l475xx.lst --xref -o project\startup_stm32l475xx.o --depend project\startup_stm32l475xx.d)
|
||||
F (startup_stm32l475xx.s)(0x672B9D47)(--cpu Cortex-M4.fp -g --apcs=interwork --pd "__MICROLIB SETA 1"
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
--pd "__UVISION_VERSION SETA 514" --pd "_RTE_ SETA 1" --pd "STM32L475xx SETA 1"
--list startup_stm32l475xx.lst --xref -o project\startup_stm32l475xx.o --depend project\startup_stm32l475xx.d)
|
||||
F (..\Src\lcd.c)(0x672794C0)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\lcd.o --omf_browse project\lcd.crf --depend project\lcd.d)
|
||||
I (../Inc/sys.h)(0x67279973)
|
||||
I (../Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h)(0x671507AF)
|
||||
|
@ -116,7 +116,7 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
|
|||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
|
||||
F (../Src/main.c)(0x672B77FF)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\main.o --omf_browse project\main.crf --depend project\main.d)
|
||||
F (../Src/main.c)(0x672B9D9A)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\main.o --omf_browse project\main.crf --depend project\main.d)
|
||||
I (../Inc/main.h)(0x672B2071)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
|
||||
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
|
||||
|
@ -155,7 +155,7 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
|
|||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
|
||||
I (../Inc/adc.h)(0x67284CF2)
|
||||
I (../Inc/spi.h)(0x67279574)
|
||||
I (../Inc/tim.h)(0x672B1D40)
|
||||
I (../Inc/tim.h)(0x672B9D44)
|
||||
I (../Inc/usart.h)(0x67276B93)
|
||||
I (../Inc/gpio.h)(0x6715E327)
|
||||
I (../Inc/lcd.h)(0x5BF21D0E)
|
||||
|
@ -277,8 +277,8 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
|
|||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
|
||||
F (../Src/tim.c)(0x672B33B5)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\tim.o --omf_browse project\tim.crf --depend project\tim.d)
|
||||
I (../Inc/tim.h)(0x672B1D40)
|
||||
F (../Src/tim.c)(0x672B9D44)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\tim.o --omf_browse project\tim.crf --depend project\tim.d)
|
||||
I (../Inc/tim.h)(0x672B9D44)
|
||||
I (../Inc/main.h)(0x672B2071)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
|
||||
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
|
||||
|
@ -353,7 +353,7 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
|
|||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
|
||||
F (../Src/stm32l4xx_it.c)(0x672B788A)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\stm32l4xx_it.o --omf_browse project\stm32l4xx_it.crf --depend project\stm32l4xx_it.d)
|
||||
F (../Src/stm32l4xx_it.c)(0x672B9D45)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\stm32l4xx_it.o --omf_browse project\stm32l4xx_it.crf --depend project\stm32l4xx_it.d)
|
||||
I (../Inc/main.h)(0x672B2071)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
|
||||
I (../Inc/stm32l4xx_hal_conf.h)(0x67299DDD)
|
||||
|
@ -390,8 +390,8 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
|
|||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
|
||||
I (../Inc/stm32l4xx_it.h)(0x672B1D40)
|
||||
I (../Inc/tim.h)(0x672B1D40)
|
||||
I (../Inc/stm32l4xx_it.h)(0x672B9D45)
|
||||
I (../Inc/tim.h)(0x672B9D44)
|
||||
I (../Inc/servo.h)(0x672B3D09)
|
||||
I (../Inc/usart.h)(0x67276B93)
|
||||
I (D:\Keil5\ARM\ARMCC\include\stdio.h)(0x588B8344)
|
||||
|
@ -433,7 +433,7 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
|
|||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
|
||||
F (..\Src\servo.c)(0x672B3F1D)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\servo.o --omf_browse project\servo.crf --depend project\servo.d)
|
||||
F (..\Src\servo.c)(0x672B9D72)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\servo.o --omf_browse project\servo.crf --depend project\servo.d)
|
||||
I (../Inc/servo.h)(0x672B3D09)
|
||||
I (../Inc/main.h)(0x672B2071)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
|
||||
|
@ -471,7 +471,9 @@ I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h)(0x671507AF)
|
|||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h)(0x671507AF)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h)(0x671507AF)
|
||||
I (../Inc/tim.h)(0x672B1D40)
|
||||
I (../Inc/tim.h)(0x672B9D44)
|
||||
I (../Inc/lcd.h)(0x5BF21D0E)
|
||||
I (../Inc/sys.h)(0x67279973)
|
||||
F (..\Inc\servo.h)(0x672B3D09)()
|
||||
F (../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c)(0x671507AF)(--c99 -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include
-I D:\Develop\Stm32Project\Project\MDK-ARM\RTE
-I D:\Keil5\ARM\PACK\ARM\CMSIS\5.0.1\CMSIS\Include
-I D:\Keil5\ARM\PACK\Keil\STM32L4xx_DFP\1.4.0\Device\Include
-D__UVISION_VERSION="514" -D_RTE_ -DSTM32L475xx -DUSE_HAL_DRIVER -DSTM32L475xx
-o project\stm32l4xx_hal_adc.o --omf_browse project\stm32l4xx_hal_adc.crf --depend project\stm32l4xx_hal_adc.d)
|
||||
I (../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h)(0x671507AF)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -38,3 +38,5 @@ project\servo.o: ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h
|
|||
project\servo.o: ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart.h
|
||||
project\servo.o: ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_uart_ex.h
|
||||
project\servo.o: ../Inc/tim.h
|
||||
project\servo.o: ../Inc/lcd.h
|
||||
project\servo.o: ../Inc/sys.h
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
19
Project.ioc
19
Project.ioc
|
@ -23,10 +23,9 @@ Mcu.IP2=RCC
|
|||
Mcu.IP3=SPI3
|
||||
Mcu.IP4=SYS
|
||||
Mcu.IP5=TIM1
|
||||
Mcu.IP6=TIM7
|
||||
Mcu.IP7=TIM15
|
||||
Mcu.IP8=USART1
|
||||
Mcu.IPNb=9
|
||||
Mcu.IP6=TIM15
|
||||
Mcu.IP7=USART1
|
||||
Mcu.IPNb=8
|
||||
Mcu.Name=STM32L475V(C-E-G)Tx
|
||||
Mcu.Package=LQFP100
|
||||
Mcu.Pin0=PH0-OSC_IN (PH0)
|
||||
|
@ -37,7 +36,7 @@ Mcu.Pin12=PC12
|
|||
Mcu.Pin13=PB8
|
||||
Mcu.Pin14=PB9
|
||||
Mcu.Pin15=VP_SYS_VS_Systick
|
||||
Mcu.Pin16=VP_TIM7_VS_ClockSourceINT
|
||||
Mcu.Pin16=VP_TIM15_VS_ClockSourceINT
|
||||
Mcu.Pin2=PC2
|
||||
Mcu.Pin3=PB2
|
||||
Mcu.Pin4=PE7
|
||||
|
@ -63,7 +62,6 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||
NVIC.TIM7_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
PA10.Mode=Asynchronous
|
||||
|
@ -145,7 +143,7 @@ ProjectManager.ToolChainLocation=
|
|||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_SPI3_Init-SPI3-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true,7-MX_TIM15_Init-TIM15-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_SPI3_Init-SPI3-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true,7-MX_TIM15_Init-TIM15-false-HAL-true,8-MX_TIM7_Init-TIM7-false-HAL-true
|
||||
RCC.ADCFreq_Value=12000000
|
||||
RCC.AHBFreq_Value=72000000
|
||||
RCC.APB1Freq_Value=72000000
|
||||
|
@ -227,13 +225,10 @@ TIM15.IPParameters=Channel-PWM Generation2 CH2,Prescaler,Period,Pulse-PWM Genera
|
|||
TIM15.Period=20000-1
|
||||
TIM15.Prescaler=72-1
|
||||
TIM15.Pulse-PWM\ Generation2\ CH2=500
|
||||
TIM7.IPParameters=Prescaler,Period
|
||||
TIM7.Period=100-1
|
||||
TIM7.Prescaler=720-1
|
||||
USART1.IPParameters=VirtualMode-Asynchronous
|
||||
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
VP_TIM7_VS_ClockSourceINT.Mode=Enable_Timer
|
||||
VP_TIM7_VS_ClockSourceINT.Signal=TIM7_VS_ClockSourceINT
|
||||
VP_TIM15_VS_ClockSourceINT.Mode=Internal
|
||||
VP_TIM15_VS_ClockSourceINT.Signal=TIM15_VS_ClockSourceINT
|
||||
board=custom
|
||||
|
|
|
@ -149,7 +149,6 @@ int main(void)
|
|||
MX_SPI3_Init();
|
||||
MX_TIM1_Init();
|
||||
MX_TIM15_Init();
|
||||
MX_TIM7_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
LCD_Init();
|
||||
HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
|
||||
|
@ -167,7 +166,7 @@ int main(void)
|
|||
HAL_GPIO_WritePin(LED_B_GPIO_Port, LED_B_Pin, GPIO_PIN_SET);
|
||||
printf("Hello!");
|
||||
//__HAL_TIM_SET_COMPARE(&htim15,TIM_CHANNEL_2,5);
|
||||
HAL_TIM_Base_Start_IT(&htim7);
|
||||
//HAL_TIM_Base_Start_IT(&htim7);
|
||||
while (1)
|
||||
{ //??ADC??
|
||||
// HAL_ADC_PollForConversion(&hadc1, 50); //??????,50???????,???ms
|
||||
|
|
45
Src/servo.c
45
Src/servo.c
|
@ -1,16 +1,51 @@
|
|||
#include "servo.h"
|
||||
#include "tim.h"
|
||||
#include "lcd.h"
|
||||
|
||||
uint8_t Servo_Speed=1,Servo_goal=0,Servo_position=0;
|
||||
uint8_t Servo_Speed = 1, Servo_goal = 0, Servo_position = 0;
|
||||
|
||||
void Servo_SetAngle(int goal)
|
||||
{
|
||||
Servo_position=goal;
|
||||
__HAL_TIM_SET_COMPARE(&htim15,TIM_CHANNEL_2,2500*goal/180-500);
|
||||
Servo_position = goal;
|
||||
__HAL_TIM_SET_COMPARE(&htim15, TIM_CHANNEL_2, 2500 * goal / 180 - 500);
|
||||
}
|
||||
|
||||
//往哪个方向转
|
||||
// 往哪个方向转
|
||||
int Servo_toward(void)
|
||||
{
|
||||
return Servo_goal>Servo_position;
|
||||
return Servo_goal > Servo_position;
|
||||
}
|
||||
|
||||
// void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||
// {
|
||||
// static uint8_t times = 0,tt=0;
|
||||
// if (htim == &htim7)
|
||||
// {
|
||||
// // if (++times == 250)
|
||||
// // {
|
||||
// // LCD_ShowxNum(50, 50, ++tt, 4, 16, 0);
|
||||
// // times = 0;
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // return;
|
||||
// // }
|
||||
// if (Servo_position == Servo_goal)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// if (Servo_Speed == 1)
|
||||
// {
|
||||
// Servo_position = Servo_goal;
|
||||
// }
|
||||
// if (Servo_Speed == 2)
|
||||
// {
|
||||
// Servo_position += Servo_toward() * 9;
|
||||
// }
|
||||
// if (Servo_Speed == 3)
|
||||
// {
|
||||
// Servo_position += Servo_toward();
|
||||
// }
|
||||
// Servo_SetAngle(Servo_position);
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
extern TIM_HandleTypeDef htim7;
|
||||
extern UART_HandleTypeDef huart1;
|
||||
/* USER CODE BEGIN EV */
|
||||
extern uint8_t Servo_Speed;
|
||||
|
@ -235,46 +234,6 @@ void USART1_IRQHandler(void)
|
|||
/* USER CODE END USART1_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles TIM7 global interrupt.
|
||||
*/
|
||||
void TIM7_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN TIM7_IRQn 0 */
|
||||
//printf("tim7!");
|
||||
static int times=0;
|
||||
if(++times==500)
|
||||
{
|
||||
times=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ;
|
||||
}
|
||||
if(Servo_position==Servo_goal)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
if(Servo_Speed==1)
|
||||
{
|
||||
Servo_position=Servo_goal;
|
||||
}
|
||||
if(Servo_Speed==2)
|
||||
{
|
||||
Servo_position+=Servo_toward()*9;
|
||||
}
|
||||
if(Servo_Speed==3)
|
||||
{
|
||||
Servo_position+=Servo_toward();
|
||||
}
|
||||
Servo_SetAngle(Servo_position);
|
||||
/* USER CODE END TIM7_IRQn 0 */
|
||||
HAL_TIM_IRQHandler(&htim7);
|
||||
/* USER CODE BEGIN TIM7_IRQn 1 */
|
||||
|
||||
/* USER CODE END TIM7_IRQn 1 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
uint8_t NewCCRValue(int now_ccr,int plus)
|
||||
{
|
||||
|
|
97
Src/tim.c
97
Src/tim.c
|
@ -25,7 +25,6 @@
|
|||
/* USER CODE END 0 */
|
||||
|
||||
TIM_HandleTypeDef htim1;
|
||||
TIM_HandleTypeDef htim7;
|
||||
TIM_HandleTypeDef htim15;
|
||||
|
||||
/* TIM1 init function */
|
||||
|
@ -92,39 +91,6 @@ void MX_TIM1_Init(void)
|
|||
/* USER CODE END TIM1_Init 2 */
|
||||
HAL_TIM_MspPostInit(&htim1);
|
||||
|
||||
}
|
||||
/* TIM7 init function */
|
||||
void MX_TIM7_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN TIM7_Init 0 */
|
||||
|
||||
/* USER CODE END TIM7_Init 0 */
|
||||
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
|
||||
/* USER CODE BEGIN TIM7_Init 1 */
|
||||
|
||||
/* USER CODE END TIM7_Init 1 */
|
||||
htim7.Instance = TIM7;
|
||||
htim7.Init.Prescaler = 720-1;
|
||||
htim7.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim7.Init.Period = 100-1;
|
||||
htim7.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim7) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim7, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM7_Init 2 */
|
||||
|
||||
/* USER CODE END TIM7_Init 2 */
|
||||
|
||||
}
|
||||
/* TIM15 init function */
|
||||
void MX_TIM15_Init(void)
|
||||
|
@ -134,6 +100,7 @@ void MX_TIM15_Init(void)
|
|||
|
||||
/* USER CODE END TIM15_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||
TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = {0};
|
||||
|
@ -148,6 +115,15 @@ void MX_TIM15_Init(void)
|
|||
htim15.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim15.Init.RepetitionCounter = 0;
|
||||
htim15.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim15) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim15, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_Init(&htim15) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
|
@ -201,7 +177,12 @@ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* tim_pwmHandle)
|
|||
|
||||
/* USER CODE END TIM1_MspInit 1 */
|
||||
}
|
||||
else if(tim_pwmHandle->Instance==TIM15)
|
||||
}
|
||||
|
||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||
{
|
||||
|
||||
if(tim_baseHandle->Instance==TIM15)
|
||||
{
|
||||
/* USER CODE BEGIN TIM15_MspInit 0 */
|
||||
|
||||
|
@ -213,26 +194,6 @@ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* tim_pwmHandle)
|
|||
/* USER CODE END TIM15_MspInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||
{
|
||||
|
||||
if(tim_baseHandle->Instance==TIM7)
|
||||
{
|
||||
/* USER CODE BEGIN TIM7_MspInit 0 */
|
||||
|
||||
/* USER CODE END TIM7_MspInit 0 */
|
||||
/* TIM7 clock enable */
|
||||
__HAL_RCC_TIM7_CLK_ENABLE();
|
||||
|
||||
/* TIM7 interrupt Init */
|
||||
HAL_NVIC_SetPriority(TIM7_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(TIM7_IRQn);
|
||||
/* USER CODE BEGIN TIM7_MspInit 1 */
|
||||
|
||||
/* USER CODE END TIM7_MspInit 1 */
|
||||
}
|
||||
}
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
|
||||
{
|
||||
|
||||
|
@ -295,7 +256,12 @@ void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* tim_pwmHandle)
|
|||
|
||||
/* USER CODE END TIM1_MspDeInit 1 */
|
||||
}
|
||||
else if(tim_pwmHandle->Instance==TIM15)
|
||||
}
|
||||
|
||||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||
{
|
||||
|
||||
if(tim_baseHandle->Instance==TIM15)
|
||||
{
|
||||
/* USER CODE BEGIN TIM15_MspDeInit 0 */
|
||||
|
||||
|
@ -308,25 +274,6 @@ void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* tim_pwmHandle)
|
|||
}
|
||||
}
|
||||
|
||||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||
{
|
||||
|
||||
if(tim_baseHandle->Instance==TIM7)
|
||||
{
|
||||
/* USER CODE BEGIN TIM7_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END TIM7_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_TIM7_CLK_DISABLE();
|
||||
|
||||
/* TIM7 interrupt Deinit */
|
||||
HAL_NVIC_DisableIRQ(TIM7_IRQn);
|
||||
/* USER CODE BEGIN TIM7_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM7_MspDeInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
|
Loading…
Reference in New Issue