diff --git a/Project/SY4.pdsprj b/Project/SY4.pdsprj
index e0261de..0f8974e 100644
Binary files a/Project/SY4.pdsprj and b/Project/SY4.pdsprj differ
diff --git a/Project/SY4.uvopt b/Project/SY4.uvopt
deleted file mode 100644
index fef421f..0000000
--- a/Project/SY4.uvopt
+++ /dev/null
@@ -1,645 +0,0 @@
-
-
-
- 1.0
-
- ### uVision Project, (C) Keil Software
-
-
- *.c
- *.s*; *.src; *.a*
- *.obj
- *.lib
- *.txt; *.h; *.inc
- *.plm
- *.cpp
-
-
-
- 0
- 0
-
-
-
- 171492105
- 0x4
- ARM-ADS
-
- 8000000
-
- 1
- 1
- 1
- 0
-
-
- 1
- 65535
- 0
- 0
- 0
-
-
- 79
- 66
- 8
- .\
-
-
- 1
- 1
- 1
- 0
- 1
- 1
- 0
- 1
- 0
- 0
- 0
- 0
-
-
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 0
- 0
-
-
- 1
- 0
- 1
-
- 255
-
- 1
- 0
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 0
- 1
- 1
- 1
- 1
- 0
- 0
- 0
- 0
-
-
-
-
-
-
-
-
-
-
- BIN\UL2CM3.DLL
-
-
-
- 0
- UL2CM3
- UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128 -FS08000000 -FL08000)
-
-
-
-
- 0
-
-
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
-
-
-
-
-
-
-
- STARTUP
- 0
- 0
- 0
- 0
-
- 1
- 1
- 2
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_ld.s
- startup_stm32f10x_ld.s
- 0
- 0
-
-
-
-
- CMSIS
- 0
- 0
- 0
- 0
-
- 2
- 2
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c
- core_cm3.c
- 0
- 0
-
-
- 2
- 3
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c
- system_stm32f10x.c
- 0
- 0
-
-
-
-
- FWLIB
- 0
- 0
- 0
- 0
-
- 3
- 4
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c
- misc.c
- 0
- 0
-
-
- 3
- 5
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c
- stm32f10x_adc.c
- 0
- 0
-
-
- 3
- 6
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c
- stm32f10x_bkp.c
- 0
- 0
-
-
- 3
- 7
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c
- stm32f10x_can.c
- 0
- 0
-
-
- 3
- 8
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c
- stm32f10x_cec.c
- 0
- 0
-
-
- 3
- 9
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c
- stm32f10x_crc.c
- 0
- 0
-
-
- 3
- 10
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c
- stm32f10x_dac.c
- 0
- 0
-
-
- 3
- 11
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c
- stm32f10x_dbgmcu.c
- 0
- 0
-
-
- 3
- 12
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c
- stm32f10x_dma.c
- 0
- 0
-
-
- 3
- 13
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c
- stm32f10x_exti.c
- 0
- 0
-
-
- 3
- 14
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c
- stm32f10x_flash.c
- 0
- 0
-
-
- 3
- 15
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c
- stm32f10x_fsmc.c
- 0
- 0
-
-
- 3
- 16
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c
- stm32f10x_gpio.c
- 0
- 0
-
-
- 3
- 17
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c
- stm32f10x_i2c.c
- 0
- 0
-
-
- 3
- 18
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c
- stm32f10x_iwdg.c
- 0
- 0
-
-
- 3
- 19
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c
- stm32f10x_pwr.c
- 0
- 0
-
-
- 3
- 20
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c
- stm32f10x_rcc.c
- 0
- 0
-
-
- 3
- 21
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c
- stm32f10x_rtc.c
- 0
- 0
-
-
- 3
- 22
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c
- stm32f10x_sdio.c
- 0
- 0
-
-
- 3
- 23
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c
- stm32f10x_spi.c
- 0
- 0
-
-
- 3
- 24
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c
- stm32f10x_tim.c
- 0
- 0
-
-
- 3
- 25
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c
- stm32f10x_usart.c
- 0
- 0
-
-
- 3
- 26
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c
- stm32f10x_wwdg.c
- 0
- 0
-
-
-
-
- USER
- 1
- 0
- 0
- 0
-
- 4
- 27
- 1
- 0
- 0
- 48
- 0
- 56
- 66
- 0
- ..\USER\main.c
- main.c
- 0
- 0
-
-
- 4
- 28
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\USER\stm32f10x_it.c
- stm32f10x_it.c
- 0
- 0
-
-
-
-
- DOC
- 0
- 0
- 0
- 0
-
-
-
diff --git a/Project/SY4.uvoptx b/Project/SY4.uvoptx
deleted file mode 100644
index 509038d..0000000
--- a/Project/SY4.uvoptx
+++ /dev/null
@@ -1,661 +0,0 @@
-
-
-
- 1.0
-
- ### uVision Project, (C) Keil Software
-
-
- *.c
- *.s*; *.src; *.a*
- *.obj
- *.lib
- *.txt; *.h; *.inc
- *.plm
- *.cpp
- 0
-
-
-
- 0
- 0
-
-
-
- 171492105
- 0x4
- ARM-ADS
-
- 8000000
-
- 1
- 1
- 0
- 1
- 0
-
-
- 1
- 65535
- 0
- 0
- 0
-
-
- 79
- 66
- 8
- .\Listings\
-
-
- 1
- 1
- 1
- 0
- 1
- 1
- 0
- 1
- 0
- 0
- 0
- 0
-
-
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 0
- 0
-
-
- 1
- 0
- 1
-
- 18
-
-
- 0
- Quick Start Guide (MCBSTM32E)
- D:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.2.0\Boards\Keil\MCBSTM32E\Documentation\STM32E_QSG.pdf
-
-
- 1
- Base Board Schematics (MCBSTM32E)
- D:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.2.0\Boards\Keil\MCBSTM32E\Documentation\mcbstm32e-base-board-schematics.pdf
-
-
- 2
- Display Board Schematics (MCBSTM32E)
- D:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.2.0\Boards\Keil\MCBSTM32E\Documentation\mcbstm32e-display-board-schematics.pdf
-
-
- 3
- User Manual (MCBSTM32E)
- D:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.2.0\Boards\Keil\MCBSTM32E\Documentation\mcbstm32e.chm
-
-
- 4
- MCBSTM32E Evaluation Board Web Page (MCBSTM32E)
- http://www.keil.com/mcbstm32e/
-
-
-
- 1
- 0
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 0
- 1
- 1
- 1
- 1
- 0
- 0
- 0
-
-
-
-
-
-
-
-
-
-
- BIN\UL2CM3.DLL
-
-
-
- 0
- ARMRTXEVENTFLAGS
- -L70 -Z18 -C0 -M0 -T1
-
-
- 0
- DLGDARM
- (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=-1,-1,-1,-1,0)(121=-1,-1,-1,-1,0)(122=-1,-1,-1,-1,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
-
-
- 0
- ARMDBGFLAGS
- -T0
-
-
- 0
- UL2CM3
- UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103R6$Flash\STM32F10x_128.FLM))
-
-
-
-
- 0
-
-
- 0
- 1
- 1
- 0
- 0
- 0
- 0
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
-
-
-
- 0
-
-
- 0
-
-
- 0
- ((PORTA & 0x00000080) >> 7 & 0x80) >> 7
- FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028504F5254412026203078303030303030383029203E3E20370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000010000009A9999999999C93F0E00000000000000000000000000000000000000080A0008
-
-
- 1
- ((PORTA & 0x00000004) >> 2 & 0x4) >> 2
- 00800000000000000000000000000000E0FFEF400100000000000000000000000000000028504F5254412026203078303030303030303429203E3E20320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000020000009A9999999999C93F0E00000000000000000000000000000000000000FA090008
-
-
- 2
- ((PORTA & 0x00000008) >> 3 & 0x8) >> 3
- 00008000000000000000000000000000E0FFEF400100000000000000000000000000000028504F5254412026203078303030303030303829203E3E20330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000030000009A9999999999C93F0E00000000000000000000000000000000000000FE090008
-
-
- 3
- ((PORTA & 0x00000010) >> 4 & 0x10) >> 4
- 00000000000000000000000000000000E0FFEF400100000000000000000000000000000028504F5254412026203078303030303030313029203E3E20340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000040000009A9999999999C93F0E00000000000000000000000000000000000000FA090008
-
-
- 4
- ((PORTA & 0x00000020) >> 5 & 0x20) >> 5
- FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028504F5254412026203078303030303030323029203E3E20350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000050000009A9999999999C93F0E00000000000000000000000000000000000000040A0008
-
-
-
- 1
- 0
- 2
- 10000000
-
-
-
-
-
- STARTUP
- 1
- 0
- 0
- 0
-
- 1
- 1
- 2
- 0
- 0
- 0
- ..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_ld.s
- startup_stm32f10x_ld.s
- 0
- 0
-
-
-
-
- CMSIS
- 1
- 0
- 0
- 0
-
- 2
- 2
- 1
- 0
- 0
- 0
- ..\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c
- core_cm3.c
- 0
- 0
-
-
- 2
- 3
- 1
- 0
- 0
- 0
- ..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c
- system_stm32f10x.c
- 0
- 0
-
-
-
-
- FWLIB
- 0
- 0
- 0
- 0
-
- 3
- 4
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c
- misc.c
- 0
- 0
-
-
- 3
- 5
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c
- stm32f10x_adc.c
- 0
- 0
-
-
- 3
- 6
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c
- stm32f10x_bkp.c
- 0
- 0
-
-
- 3
- 7
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c
- stm32f10x_can.c
- 0
- 0
-
-
- 3
- 8
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c
- stm32f10x_cec.c
- 0
- 0
-
-
- 3
- 9
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c
- stm32f10x_crc.c
- 0
- 0
-
-
- 3
- 10
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c
- stm32f10x_dac.c
- 0
- 0
-
-
- 3
- 11
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c
- stm32f10x_dbgmcu.c
- 0
- 0
-
-
- 3
- 12
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c
- stm32f10x_dma.c
- 0
- 0
-
-
- 3
- 13
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c
- stm32f10x_exti.c
- 0
- 0
-
-
- 3
- 14
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c
- stm32f10x_flash.c
- 0
- 0
-
-
- 3
- 15
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c
- stm32f10x_fsmc.c
- 0
- 0
-
-
- 3
- 16
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c
- stm32f10x_gpio.c
- 0
- 0
-
-
- 3
- 17
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c
- stm32f10x_i2c.c
- 0
- 0
-
-
- 3
- 18
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c
- stm32f10x_iwdg.c
- 0
- 0
-
-
- 3
- 19
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c
- stm32f10x_pwr.c
- 0
- 0
-
-
- 3
- 20
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c
- stm32f10x_rcc.c
- 0
- 0
-
-
- 3
- 21
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c
- stm32f10x_tim.c
- 0
- 0
-
-
- 3
- 22
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c
- stm32f10x_rtc.c
- 0
- 0
-
-
- 3
- 23
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c
- stm32f10x_sdio.c
- 0
- 0
-
-
- 3
- 24
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c
- stm32f10x_spi.c
- 0
- 0
-
-
- 3
- 25
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c
- stm32f10x_usart.c
- 0
- 0
-
-
- 3
- 26
- 1
- 0
- 0
- 0
- ..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c
- stm32f10x_wwdg.c
- 0
- 0
-
-
-
-
- USER
- 1
- 0
- 0
- 0
-
- 4
- 27
- 1
- 0
- 0
- 0
- ..\USER\main.c
- main.c
- 0
- 0
-
-
- 4
- 28
- 1
- 0
- 0
- 0
- ..\USER\stm32f10x_it.c
- stm32f10x_it.c
- 0
- 0
-
-
- 4
- 29
- 1
- 0
- 0
- 0
- ..\USER\Key\Key.c
- Key.c
- 0
- 0
-
-
- 4
- 30
- 1
- 0
- 0
- 0
- ..\USER\Led\Led.c
- Led.c
- 0
- 0
-
-
- 4
- 31
- 1
- 0
- 0
- 0
- ..\USER\Tim\Tim.c
- Tim.c
- 0
- 0
-
-
- 4
- 32
- 1
- 1
- 0
- 0
- ..\USER\Delay\Delay.c
- Delay.c
- 0
- 0
-
-
-
-
- DOC
- 0
- 0
- 0
- 0
-
-
-
diff --git a/Project/SY4.uvproj b/Project/SY4.uvproj
index b3a3b6f..32646c9 100644
--- a/Project/SY4.uvproj
+++ b/Project/SY4.uvproj
@@ -362,7 +362,7 @@
USE_STDPERIPH_DRIVER,STM32F10X_LD
- ..\Project;..\USER;..\Libraries\STM32F10x_StdPeriph_Driver\inc;..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;..\Libraries\CMSIS\CM3\CoreSupport
+ ..\Project;..\USER;..\Libraries\STM32F10x_StdPeriph_Driver\inc;..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;..\Libraries\CMSIS\CM3\CoreSupport;..\USER\Delay;..\USER\Key;..\USER\Led;..\USER\Sys;..\USER\Tim;..\USER\Usart
@@ -560,6 +560,36 @@
1
..\USER\stm32f10x_it.c
+
+ Delay.c
+ 1
+ ..\USER\Delay\Delay.c
+
+
+ Key.c
+ 1
+ ..\USER\Key\Key.c
+
+
+ Led.c
+ 1
+ ..\USER\Led\Led.c
+
+
+ Sys.c
+ 1
+ ..\USER\Sys\Sys.c
+
+
+ Tim.c
+ 1
+ ..\USER\Tim\Tim.c
+
+
+ bsp_usart.c
+ 1
+ ..\USER\Usart\bsp_usart.c
+
diff --git a/Project/SY4.uvprojx b/Project/SY4.uvprojx
index ca91c45..685753e 100644
--- a/Project/SY4.uvprojx
+++ b/Project/SY4.uvprojx
@@ -335,7 +335,7 @@
USE_STDPERIPH_DRIVER,STM32F10X_LD
- ..\Project;..\USER;..\Libraries\STM32F10x_StdPeriph_Driver\inc;..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;..\Libraries\CMSIS\CM3\CoreSupport;..\USER\Delay;..\USER\Key;..\USER\Led;..\USER\Tim
+ ..\Project;..\USER;..\Libraries\STM32F10x_StdPeriph_Driver\inc;..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x;..\Libraries\CMSIS\CM3\CoreSupport;..\USER\Delay;..\USER\Key;..\USER\Led;..\USER\Tim;..\USER\Usart;..\USER\Sys
@@ -554,6 +554,16 @@
1
..\USER\Delay\Delay.c
+
+ bsp_usart.c
+ 1
+ ..\USER\Usart\bsp_usart.c
+
+
+ Sys.c
+ 1
+ ..\USER\Sys\Sys.c
+
diff --git a/USER/Sys/Sys.c b/USER/Sys/Sys.c
new file mode 100644
index 0000000..16095e3
--- /dev/null
+++ b/USER/Sys/Sys.c
@@ -0,0 +1,29 @@
+#include "Sys.h"
+
+/*RCC时钟�始化*/
+void RCC_Configuration(void)
+{
+ RCC_DeInit(); //é‡�设RCC寄å˜å™¨ä¸ºç¼ºçœ�值
+ /* 开�HSI �内部晶振时钟 */
+ RCC->CR |= (uint32_t)0x00000001;
+ /*选择HSI为PLL的时钟�HSI必须2分频给PLL*/
+ RCC->CFGR |= (uint32_t)RCC_CFGR_PLLSRC_HSI_Div2;
+ /*PLLCLK=8/2*10=40MHz 设置�频得到时钟�PLL的频率*/
+ RCC->CFGR |= (uint32_t)RCC_CFGR_PLLMULL10;
+ /* PLL�分频输出 */
+ RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;
+ /* 使能 PLL时钟 */
+ RCC->CR |= RCC_CR_PLLON;
+ /* ç‰å¾…PLL时钟就绪*/
+ while((RCC->CR & RCC_CR_PLLRDY) == 0)
+ {
+ }
+ /* 选择PLL为系统时钟的时钟� */
+ RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
+ RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;
+ /* ç‰åˆ°PLLæˆ�为系统时钟的时钟æº�*/
+ while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x08)
+ {
+ }
+}
+
diff --git a/USER/Sys/Sys.h b/USER/Sys/Sys.h
new file mode 100644
index 0000000..2bbefa4
--- /dev/null
+++ b/USER/Sys/Sys.h
@@ -0,0 +1,11 @@
+#ifndef __SYS_H
+#define __SYS_H
+
+#include "stm32f10x.h"
+
+
+void RCC_Configuration(void);
+
+
+
+#endif
diff --git a/USER/Usart/bsp_usart.c b/USER/Usart/bsp_usart.c
new file mode 100644
index 0000000..19e23aa
--- /dev/null
+++ b/USER/Usart/bsp_usart.c
@@ -0,0 +1,208 @@
+#include "bsp_usart.h"
+extern u8 flag,leddat;
+extern void LED_ON(u8 n);
+extern void LED_OFF(void);
+
+
+static void NVIC_Configuration(void)
+{
+ NVIC_InitTypeDef NVIC_InitStructure;
+
+ /* ǶÌ×ÏòÁ¿ÖжϿØÖÆÆ÷×éÑ¡Ôñ */
+ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
+
+ /* ÅäÖÃUSARTΪÖжÏÔ´ */
+ NVIC_InitStructure.NVIC_IRQChannel = DEBUG_USART_IRQ;
+ /* ÇÀ¶ÏÓÅÏȼ¶*/
+ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
+ /* ×ÓÓÅÏȼ¶ */
+ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
+ /* ʹÄÜÖÐ¶Ï */
+ NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+ /* ³õʼ»¯ÅäÖÃNVIC */
+ NVIC_Init(&NVIC_InitStructure);
+}
+
+void USART_Config(u32 bouad)
+{
+ GPIO_InitTypeDef GPIO_InitStructure;
+ USART_InitTypeDef USART_InitStructure;
+
+ // ´ò¿ª´®¿ÚGPIOµÄʱÖÓ
+ DEBUG_USART_GPIO_APBxClkCmd(DEBUG_USART_GPIO_CLK, ENABLE);
+
+ // ´ò¿ª´®¿ÚÍâÉèµÄʱÖÓ
+ DEBUG_USART_APBxClkCmd(DEBUG_USART_CLK, ENABLE);
+
+ // ½«USART TxµÄGPIOÅäÖÃÎªÍÆÍ츴ÓÃģʽ
+ GPIO_InitStructure.GPIO_Pin = DEBUG_USART_TX_GPIO_PIN;
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+ GPIO_Init(DEBUG_USART_TX_GPIO_PORT, &GPIO_InitStructure);
+
+ // ½«USART RxµÄGPIOÅäÖÃΪ¸¡¿ÕÊäÈëģʽ
+ GPIO_InitStructure.GPIO_Pin = DEBUG_USART_RX_GPIO_PIN;
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+ GPIO_Init(DEBUG_USART_RX_GPIO_PORT, &GPIO_InitStructure);
+
+ // ÅäÖô®¿ÚµÄ¹¤×÷²ÎÊý
+ // ÅäÖò¨ÌØÂÊ
+ USART_InitStructure.USART_BaudRate = bouad;
+ // ÅäÖà ÕëÊý¾Ý×Ö³¤
+ USART_InitStructure.USART_WordLength = USART_WordLength_8b;
+ // ÅäÖÃֹͣλ
+ USART_InitStructure.USART_StopBits = USART_StopBits_1;
+ // ÅäÖÃУÑéλ
+ USART_InitStructure.USART_Parity = USART_Parity_No ;
+ // ÅäÖÃÓ²¼þÁ÷¿ØÖÆ
+ USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
+ // ÅäÖù¤×÷ģʽ£¬ÊÕ·¢Ò»Æð
+ USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
+ // Íê³É´®¿ÚµÄ³õʼ»¯ÅäÖÃ
+ USART_Init(DEBUG_USARTx, &USART_InitStructure);
+
+ // ´®¿ÚÖжÏÓÅÏȼ¶ÅäÖÃ
+ NVIC_Configuration();
+
+ // ʹÄÜ´®¿Ú½ÓÊÕÖжÏ
+ USART_ITConfig(DEBUG_USARTx, USART_IT_RXNE, ENABLE);
+
+ // ʹÄÜ´®¿Ú
+ USART_Cmd(DEBUG_USARTx, ENABLE);
+}
+
+void DEBUG_USART_IRQHandler(void)
+{
+ uint8_t ucTemp;
+ char ch;
+ if(USART_GetITStatus(DEBUG_USARTx,USART_IT_RXNE)!=RESET)
+ {
+ ucTemp = USART_ReceiveData(DEBUG_USARTx);
+ USART_SendData(DEBUG_USARTx,ucTemp);
+
+ ch = ucTemp;
+
+ if(ch == '0')//¹Ø±Õ¶¨Ê±Æ÷ ¹ØµÆ
+ {
+ TIM_Cmd(TIM2, DISABLE);
+
+ LED_OFF();
+ printf("\r\nÁ÷Ë®µÆÒѹرÕ\r\n");
+ }
+ if(ch > '0' && ch <= '4')//¿ªµÆ1,2,3,4
+ {
+ TIM_Cmd(TIM2, DISABLE);
+ LED_ON(ch - '0' - 1);
+ printf("\r\nµãÁÁµÆ%d\r\n",ch - '0');
+ }
+ if(ch == '5')//¿ªÆô¶¨Ê±Æ÷ ¿ªÆôÁ÷Ë®µÆ
+ {
+ TIM_Cmd(TIM2, ENABLE);
+ printf("\r\nÁ÷Ë®µÆÒÑ¿ªÆô\r\n");
+ }
+ if(ch == '6')//¶ÁÈ¡¿ª¹Ø×´Ì¬ÒÔ¼°Á÷Ë®µÆµÄ״̬
+ {
+ printf("\r\n¿ª¹Ø×´Ì¬Îª%d\r\nµÆ×´Ì¬Îª%d\r\n",!flag,leddat+1);
+ LED_OFF();
+ }
+ if(ch == '?')//¶ÁÈ¡¿ª¹Ø×´Ì¬ÒÔ¼°Á÷Ë®µÆµÄ״̬
+ {
+ printf("\r\n˵Ã÷£º\r\n");
+ printf("0--¹Ø±ÕÁ÷Ë®µÆ\r\n");
+ printf("1µ½4--´ò¿ªÖ¸¶¨µÆ\r\n");
+ printf("5--¿ªÆôÁ÷Ë®µÆ\r\n");
+ printf("6--¶ÁÈ¡¿ª¹Ø×´Ì¬ÒÔ¼°Á÷Ë®µÆµÄ״̬\r\n");
+ printf("?--²é¿´ËµÃ÷\r\n");
+ }
+ }
+}
+
+/* ·¢ËÍÒ»¸ö×Ö½Ú */
+void Usart_SendByte(USART_TypeDef* pUSARTx, uint8_t data)
+{
+ USART_SendData(pUSARTx, data);
+ while( USART_GetFlagStatus(pUSARTx, USART_FLAG_TXE) == RESET );
+}
+
+/* ·¢ËÍÁ½¸ö×Ö½ÚµÄÊý¾Ý */
+void Usart_SendHalfWord(USART_TypeDef* pUSARTx, uint16_t data)
+{
+ uint8_t temp_h,temp_l;
+
+ temp_h = (data&0xff00) >> 8 ;
+ temp_l = data&0xff;
+
+ USART_SendData(pUSARTx, temp_h);
+ while( USART_GetFlagStatus(pUSARTx, USART_FLAG_TXE) == RESET );
+
+ USART_SendData(pUSARTx, temp_l);
+ while( USART_GetFlagStatus(pUSARTx, USART_FLAG_TXE) == RESET );
+}
+
+/* ·¢ËÍ8λÊý¾ÝµÄÊý×é */
+void Usart_SendArray(USART_TypeDef* pUSARTx, uint8_t *array,uint8_t num)
+{
+ uint8_t i;
+ for( i=0; i
+
+#define DEBUG_USART1 1
+#define DEBUG_USART2 0
+#define DEBUG_USART3 0
+#define DEBUG_USART4 0
+#define DEBUG_USART5 0
+
+#if DEBUG_USART1
+// ´®¿Ú1-USART1
+#define DEBUG_USARTx USART1
+#define DEBUG_USART_CLK RCC_APB2Periph_USART1
+#define DEBUG_USART_APBxClkCmd RCC_APB2PeriphClockCmd
+#define DEBUG_USART_BAUDRATE 115200
+
+// USART GPIO Òý½Åºê¶¨Òå
+#define DEBUG_USART_GPIO_CLK (RCC_APB2Periph_GPIOA)
+#define DEBUG_USART_GPIO_APBxClkCmd RCC_APB2PeriphClockCmd
+
+#define DEBUG_USART_TX_GPIO_PORT GPIOA
+#define DEBUG_USART_TX_GPIO_PIN GPIO_Pin_9
+#define DEBUG_USART_RX_GPIO_PORT GPIOA
+#define DEBUG_USART_RX_GPIO_PIN GPIO_Pin_10
+
+#define DEBUG_USART_IRQ USART1_IRQn
+#define DEBUG_USART_IRQHandler USART1_IRQHandler
+
+#elif DEBUG_USART2
+//´®¿Ú2-USART2
+#define DEBUG_USARTx USART2
+#define DEBUG_USART_CLK RCC_APB1Periph_USART2
+#define DEBUG_USART_APBxClkCmd RCC_APB1PeriphClockCmd
+#define DEBUG_USART_BAUDRATE 115200
+
+// USART GPIO Òý½Åºê¶¨Òå
+#define DEBUG_USART_GPIO_CLK (RCC_APB2Periph_GPIOA)
+#define DEBUG_USART_GPIO_APBxClkCmd RCC_APB2PeriphClockCmd
+
+#define DEBUG_USART_TX_GPIO_PORT GPIOA
+#define DEBUG_USART_TX_GPIO_PIN GPIO_Pin_2
+#define DEBUG_USART_RX_GPIO_PORT GPIOA
+#define DEBUG_USART_RX_GPIO_PIN GPIO_Pin_3
+
+#define DEBUG_USART_IRQ USART2_IRQn
+#define DEBUG_USART_IRQHandler USART2_IRQHandler
+
+#elif DEBUG_USART3
+//´®¿Ú3-USART3
+#define DEBUG_USARTx USART3
+#define DEBUG_USART_CLK RCC_APB1Periph_USART3
+#define DEBUG_USART_APBxClkCmd RCC_APB1PeriphClockCmd
+#define DEBUG_USART_BAUDRATE 115200
+
+// USART GPIO Òý½Åºê¶¨Òå
+#define DEBUG_USART_GPIO_CLK (RCC_APB2Periph_GPIOB)
+#define DEBUG_USART_GPIO_APBxClkCmd RCC_APB2PeriphClockCmd
+
+#define DEBUG_USART_TX_GPIO_PORT GPIOB
+#define DEBUG_USART_TX_GPIO_PIN GPIO_Pin_10
+#define DEBUG_USART_RX_GPIO_PORT GPIOB
+#define DEBUG_USART_RX_GPIO_PIN GPIO_Pin_11
+
+#define DEBUG_USART_IRQ USART3_IRQn
+#define DEBUG_USART_IRQHandler USART3_IRQHandler
+
+#elif DEBUG_USART4
+//´®¿Ú4-UART4
+#define DEBUG_USARTx UART4
+#define DEBUG_USART_CLK RCC_APB1Periph_UART4
+#define DEBUG_USART_APBxClkCmd RCC_APB1PeriphClockCmd
+#define DEBUG_USART_BAUDRATE 115200
+
+// USART GPIO Òý½Åºê¶¨Òå
+#define DEBUG_USART_GPIO_CLK (RCC_APB2Periph_GPIOC)
+#define DEBUG_USART_GPIO_APBxClkCmd RCC_APB2PeriphClockCmd
+
+#define DEBUG_USART_TX_GPIO_PORT GPIOC
+#define DEBUG_USART_TX_GPIO_PIN GPIO_Pin_10
+#define DEBUG_USART_RX_GPIO_PORT GPIOC
+#define DEBUG_USART_RX_GPIO_PIN GPIO_Pin_11
+
+#define DEBUG_USART_IRQ UART4_IRQn
+#define DEBUG_USART_IRQHandler UART4_IRQHandler
+
+#elif DEBUG_USART5
+//´®¿Ú5-UART5
+#define DEBUG_USARTx UART5
+#define DEBUG_USART_CLK RCC_APB1Periph_UART5
+#define DEBUG_USART_APBxClkCmd RCC_APB1PeriphClockCmd
+#define DEBUG_USART_BAUDRATE 115200
+
+// USART GPIO Òý½Åºê¶¨Òå
+#define DEBUG_USART_GPIO_CLK (RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD)
+#define DEBUG_USART_GPIO_APBxClkCmd RCC_APB2PeriphClockCmd
+
+#define DEBUG_USART_TX_GPIO_PORT GPIOC
+#define DEBUG_USART_TX_GPIO_PIN GPIO_Pin_12
+#define DEBUG_USART_RX_GPIO_PORT GPIOD
+#define DEBUG_USART_RX_GPIO_PIN GPIO_Pin_2
+
+#define DEBUG_USART_IRQ UART5_IRQn
+#define DEBUG_USART_IRQHandler UART5_IRQHandler
+
+#endif
+
+void USART_Config(u32 bouad);
+void Usart_SendByte(USART_TypeDef* pUSARTx, uint8_t data);
+void Usart_SendHalfWord(USART_TypeDef* pUSARTx, uint16_t data);
+void Usart_SendArray(USART_TypeDef* pUSARTx, uint8_t *array,uint8_t num);
+void Usart_SendStr(USART_TypeDef* pUSARTx, uint8_t *str);
+#endif /* __BSP_USART_H */
+
diff --git a/USER/main.c b/USER/main.c
index 2344a6e..de0f2b3 100644
--- a/USER/main.c
+++ b/USER/main.c
@@ -9,10 +9,14 @@
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
+#include "stdio.h"
#include "Delay.h"
#include "Tim.h"
#include "Led.h"
#include "Key.h"
+#include "Sys.h"
+#include "bsp_usart.h"
+
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
@@ -22,12 +26,21 @@
int main(void)
{
- u16 led0pwmval=0;
+ u16 led0pwmval=0;
+ RCC_Configuration();
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //ÉèÖÃNVICÖжϷÖ×é2:2λÇÀÕ¼ÓÅÏȼ¶£¬2λÏìÓ¦ÓÅÏȼ¶
LED_GPIO_INIT();
KEY_INIT();
- TIM2_INIT(499,7199);
+ TIM2_INIT(499,4999);
TIM3_PWM_INIT(9,499);
+ USART_Config(9600);
+
+ printf("\r\n˵Ã÷£º\r\n");
+ printf("0--¹Ø±ÕÁ÷Ë®µÆ\r\n");
+ printf("1µ½4--´ò¿ªÖ¸¶¨µÆ\r\n");
+ printf("5--¿ªÆôÁ÷Ë®µÆ\r\n");
+ printf("6--¶ÁÈ¡¿ª¹Ø×´Ì¬ÒÔ¼°Á÷Ë®µÆµÄ״̬\r\n");
+ printf("?--²é¿´ËµÃ÷\r\n");
while (1)
{
delay(100000);
diff --git a/USER/main.c.dump b/USER/main.c.dump
new file mode 100644
index 0000000..cbd95fb
--- /dev/null
+++ b/USER/main.c.dump
@@ -0,0 +1,46 @@
+/**
+ ******************************************************************************
+ * 内容:SY1
+ * 作者:zhangsan
+ * 版本:v1.0
+ * 日期:2020.04
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32f10x.h"
+#include "Delay.h"
+#include "Tim.h"
+#include "Led.h"
+#include "Key.h"
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
+int main(void)
+{
+
+ u16 led0pwmval=0;
+ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //设置NVIC䏿–分组2:2ä½�抢å� 优先级,2ä½�å“�应优先级
+ LED_GPIO_INIT();
+ KEY_INIT();
+ TIM2_INIT(499,7199);
+ TIM3_PWM_INIT(9,499);
+ while (1)
+ {
+ delay(100000);
+
+ led0pwmval+=1;
+
+ if(led0pwmval>9)led0pwmval=0;
+
+ TIM_SetCompare2(TIM3,led0pwmval);
+
+ }
+}
+
+
+
+/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/