4 Commits

Author SHA1 Message Date
  QQyyblithe 82ba71d0b4 2022/8/10实现编码器位置读取 2 years ago
  QQyyblithe 31ed50eb17 实现UART0 2 years ago
  QQyyblithe 4856675f22 UART1波特率设置25M 2 years ago
  QQyyblithe cb9e5e16a5 添加UART1 2 years ago
11 changed files with 584 additions and 207 deletions
Split View
  1. +1
    -1
      IAR/settings/test01.Debug.driver.xcl
  2. +105
    -26
      IAR/settings/test01.dbgdt
  3. +1
    -1
      IAR/settings/test01.dnx
  4. +43
    -20
      IAR/settings/test01.wsdt
  5. +261
    -137
      IAR/test01.dep
  6. +1
    -1
      IAR/test01.ewd
  7. +19
    -5
      user/main.c
  8. +25
    -5
      user/pin_Init.c
  9. +3
    -0
      user/pin_Init.h
  10. +117
    -9
      user/uart_Interrupt.c
  11. +8
    -2
      user/uart_Interrupt.h

+ 1
- 1
IAR/settings/test01.Debug.driver.xcl View File

@@ -16,7 +16,7 @@

"--drv_interface_speed=auto"

"--jlink_initial_speed=1000"
"--jlink_initial_speed=10000"

"--jlink_reset_strategy=0,0"



+ 105
- 26
IAR/settings/test01.dbgdt
File diff suppressed because it is too large
View File


+ 1
- 1
IAR/settings/test01.dnx View File

@@ -35,7 +35,7 @@
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
</JLinkDriver>
<DebugChecksum>
<Checksum>2166995177</Checksum>
<Checksum>2353942654</Checksum>
</DebugChecksum>
<Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught>


+ 43
- 20
IAR/settings/test01.wsdt
File diff suppressed because it is too large
View File


+ 261
- 137
IAR/test01.dep View File

@@ -5,184 +5,277 @@
<configuration>
<name>Debug</name>
<outputs>
<file>$PROJ_DIR$\..\drivers\fsl_port.h</file>
<file>$PROJ_DIR$\..\startup\MKV56F24.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_common.c</file>
<file>$PROJ_DIR$\..\drivers\fsl_clock.c</file>
<file>$PROJ_DIR$\..\drivers\fsl_gpio.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.o</file>
<file>$PROJ_DIR$\..\drivers\fsl_uart.c</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.o</file>
<file>$PROJ_DIR$\Debug\Obj\startup_MKV56F24.o</file>
<file>$PROJ_DIR$\..\startup\startup_MKV56F24.s</file>
<file>$PROJ_DIR$\Debug\Obj\delay.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_uart.xcl</file>
<file>$PROJ_DIR$\..\startup\system_MKV56F24.c</file>
<file>$PROJ_DIR$\..\user\delay.c</file>
<file>$PROJ_DIR$\..\Include\mpu_armv7.h</file>
<file>$PROJ_DIR$\..\user\main.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.__cstat.et</file>
<file>$PROJ_DIR$\..\drivers\fsl_common.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_port.h</file>
<file>$PROJ_DIR$\..\user\uart_Interrupt.h</file>
<file>$PROJ_DIR$\..\startup\MKV56F24.h</file>
<file>$PROJ_DIR$\..\user\delay.c</file>
<file>$PROJ_DIR$\..\user\pin_Init.c</file>
<file>$PROJ_DIR$\..\drivers\fsl_gpio.c</file>
<file>$PROJ_DIR$\..\drivers\fsl_clock.c</file>
<file>$PROJ_DIR$\..\drivers\fsl_common.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\ysizet.h</file>
<file>$PROJ_DIR$\..\Include\core_cm7.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_string.h</file>
<file>$TOOLKIT_DIR$\inc\c\iccarm_builtin.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.xcl</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product.h</file>
<file>$PROJ_DIR$\Debug\Exe\test01.out</file>
<file>$PROJ_DIR$\..\user\uart_Interrupt.c</file>
<file>$PROJ_DIR$\..\Include\cmsis_version.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.xcl</file>
<file>$PROJ_DIR$\..\drivers\fsl_common.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.o</file>
<file>$TOOLKIT_DIR$\inc\c\stdbool.h</file>
<file>$PROJ_DIR$\..\user\delay.h</file>
<file>$PROJ_DIR$\Debug\List\test01.map</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Defaults.h</file>
<file>$TOOLKIT_DIR$\inc\c\math.h</file>
<file>$TOOLKIT_DIR$\inc\c\string.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.o</file>
<file>$PROJ_DIR$\Debug\Obj\main.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\stddef.h</file>
<file>$TOOLKIT_DIR$\inc\c\yvals.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\uart_Interrupt.__cstat.et</file>
<file>$TOOLKIT_DIR$\lib\rt7M_tl.a</file>
<file>$TOOLKIT_DIR$\config\linker\NXP\MKV5xF512xxx24.icf</file>
<file>$PROJ_DIR$\..\user\delay.h</file>
<file>$TOOLKIT_DIR$\inc\c\stdarg.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_debug_console.xcl</file>
<file>$PROJ_DIR$\..\user\main.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_uart.__cstat.et</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console.c</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\iccarm_builtin.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.o</file>
<file>$PROJ_DIR$\Debug\Obj\delay.o</file>
<file>$PROJ_DIR$\..\startup\fsl_device_registers.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.__cstat.et</file>
<file>$PROJ_DIR$\..\drivers\fsl_clock.h</file>
<file>$PROJ_DIR$\Debug\Obj\uart_Interrupt.o</file>
<file>$PROJ_DIR$\..\Include\mpu_armv7.h</file>
<file>$PROJ_DIR$\Debug\Obj\main.o</file>
<file>$TOOLKIT_DIR$\inc\c\stdint.h</file>
<file>$TOOLKIT_DIR$\inc\c\stdlib.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.__cstat.et</file>
<file>$TOOLKIT_DIR$\config\linker\NXP\MKV5xF512xxx24.icf</file>
<file>$TOOLKIT_DIR$\inc\c\ysizet.h</file>
<file>$TOOLKIT_DIR$\lib\m7M_tls.a</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h</file>
<file>$TOOLKIT_DIR$\inc\c\ycheck.h</file>
<file>$PROJ_DIR$\Debug\Obj\test01.pbd</file>
<file>$PROJ_DIR$\..\Include\cmsis_iccarm.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_stdlib.h</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\startup_MKV56F24.o</file>
<file>$PROJ_DIR$\Debug\Obj\main.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.xcl</file>
<file>$PROJ_DIR$\..\Include\cmsis_compiler.h</file>
<file>$TOOLKIT_DIR$\inc\c\stdlib.h</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.xcl</file>
<file>$TOOLKIT_DIR$\inc\c\stddef.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_string.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.o</file>
<file>$PROJ_DIR$\Debug\Obj\test01.pbd</file>
<file>$PROJ_DIR$\..\utilities\str\fsl_str.h</file>
<file>$PROJ_DIR$\Debug\Obj\pin_Init.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\main.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\pin_Init.xcl</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_float_setup.h</file>
<file>$PROJ_DIR$\..\utilities\str\fsl_str.c</file>
<file>$TOOLKIT_DIR$\inc\c\assert.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.__cstat.et</file>
<file>$PROJ_DIR$\..\utilities\str\fsl_str.h</file>
<file>$TOOLKIT_DIR$\lib\dl7M_tln.a</file>
<file>$PROJ_DIR$\..\drivers\fsl_gpio.h</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console.c</file>
<file>$PROJ_DIR$\..\startup\system_MKV56F24.h</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console_conf.h</file>
<file>$PROJ_DIR$\..\utilities\fsl_assert.c</file>
<file>$TOOLKIT_DIR$\inc\c\math.h</file>
<file>$PROJ_DIR$\..\startup\MKV56F24_features.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_gpio.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_str.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_debug_console.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.xcl</file>
<file>$PROJ_DIR$\..\Include\core_cm7.h</file>
<file>$PROJ_DIR$\Debug\Obj\pin_Init.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\ycheck.h</file>
<file>$PROJ_DIR$\Debug\Exe\test01.out</file>
<file>$TOOLKIT_DIR$\inc\c\assert.h</file>
<file>$TOOLKIT_DIR$\inc\c\yvals.h</file>
<file>$TOOLKIT_DIR$\lib\shb_l.a</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.o</file>
<file>$TOOLKIT_DIR$\inc\c\stdint.h</file>
<file>$PROJ_DIR$\..\drivers\fsl_clock.h</file>
<file>$TOOLKIT_DIR$\inc\c\stdarg.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Defaults.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_assert.o</file>
<file>$TOOLKIT_DIR$\lib\dl7M_tln.a</file>
<file>$TOOLKIT_DIR$\inc\c\stdbool.h</file>
<file>$PROJ_DIR$\Debug\Obj\pin_Init.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\pin_Init.o</file>
<file>$PROJ_DIR$\..\utilities\str\fsl_str.c</file>
<file>$PROJ_DIR$\Debug\Obj\main.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\main.__cstat.et</file>
<file>$PROJ_DIR$\..\user\pin_Init.h</file>
<file>$PROJ_DIR$\Debug\Obj\delay.xcl</file>
<file>$PROJ_DIR$\..\drivers\fsl_uart.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_uart.o</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_uart.xcl</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_stdlib.h</file>
<file>$PROJ_DIR$\..\startup\MKV56F24_features.h</file>
<file>$PROJ_DIR$\Debug\Obj\system_MKV56F24.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\uart_Interrupt.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\uart_Interrupt.o</file>
<file>$PROJ_DIR$\..\drivers\fsl_uart.c</file>
<file>$PROJ_DIR$\..\user\uart_Interrupt.c</file>
<file>$PROJ_DIR$\..\user\uart_Interrupt.h</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console_conf.h</file>
<file>$PROJ_DIR$\..\Include\cmsis_compiler.h</file>
<file>$PROJ_DIR$\Debug\Obj\delay.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_uart.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_clock.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\pin_Init.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\uart_Interrupt.__cstat.et</file>
<file>$PROJ_DIR$\..\drivers\fsl_uart.h</file>
<file>$PROJ_DIR$\..\utilities\fsl_assert.c</file>
<file>$PROJ_DIR$\..\startup\system_MKV56F24.h</file>
<file>$PROJ_DIR$\..\Include\cmsis_iccarm.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_common.xcl</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_uart.o</file>
<file>$PROJ_DIR$\..\startup\fsl_device_registers.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_debug_console.o</file>
<file>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console.h</file>
<file>$PROJ_DIR$\Debug\Obj\fsl_debug_console.__cstat.et</file>
<file>$PROJ_DIR$\..\utilities\serial_port_uart.h</file>
<file>$PROJ_DIR$\..\utilities\serial_port_internal.h</file>
<file>$PROJ_DIR$\..\utilities\serial_manager.c</file>
<file>$PROJ_DIR$\..\utilities\generic_list.c</file>
<file>$PROJ_DIR$\..\utilities\serial_port_uart.c</file>
<file>$PROJ_DIR$\..\utilities\uart_adapter.c</file>
<file>$PROJ_DIR$\..\utilities\serial_manager.h</file>
<file>$PROJ_DIR$\..\utilities\generic_list.h</file>
<file>$PROJ_DIR$\Debug\Obj\uart_adapter.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\generic_list.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\serial_manager.o</file>
<file>$PROJ_DIR$\Debug\Obj\serial_port_uart.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\serial_port_uart.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\uart_adapter.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\generic_list.o</file>
<file>$PROJ_DIR$\..\utilities\uart.h</file>
<file>$PROJ_DIR$\Debug\Obj\serial_manager.xcl</file>
<file>$PROJ_DIR$\Debug\Obj\uart_adapter.o</file>
<file>$PROJ_DIR$\Debug\Obj\serial_manager.__cstat.et</file>
<file>$PROJ_DIR$\Debug\Obj\serial_port_uart.o</file>
<file>$PROJ_DIR$\Debug\Obj\generic_list.xcl</file>
</outputs>
<file>
<name>[ROOT_NODE]</name>
<outputs>
<tool>
<name>ILINK</name>
<file> 20 23</file>
<file> 70 24</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\startup\startup_MKV56F24.s</name>
<name>$PROJ_DIR$\..\drivers\fsl_common.c</name>
<outputs>
<tool>
<name>AARM</name>
<file> 42</file>
<name>ICCARM</name>
<file> 56</file>
</tool>
<tool>
<name>__cstat</name>
<file> 48</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 89</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\startup\system_MKV56F24.c</name>
<name>$PROJ_DIR$\..\drivers\fsl_clock.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 40</file>
<file> 21</file>
</tool>
<tool>
<name>__cstat</name>
<file> 48</file>
<file> 41</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 49</file>
<file> 61</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 69 36 28 72 35 19 33 1 15 21 46 38 17 5 59 63</file>
<file> 42 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\user\delay.c</name>
<name>$PROJ_DIR$\..\drivers\fsl_gpio.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 32</file>
<file> 38</file>
</tool>
<tool>
<name>__cstat</name>
<file> 88</file>
<file> 52</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 79</file>
<file> 9</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63 70 31</file>
<file> 65 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\user\main.c</name>
<name>$PROJ_DIR$\..\drivers\fsl_uart.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 51</file>
<file> 91</file>
</tool>
<tool>
<name>__cstat</name>
<file> 26</file>
<file> 34</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 43</file>
<file> 10</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63 70 57 78 31 87</file>
<file> 85 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\startup\startup_MKV56F24.s</name>
<outputs>
<tool>
<name>AARM</name>
<file> 6</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\startup\system_MKV56F24.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 5</file>
</tool>
<tool>
<name>__cstat</name>
<file> 80</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 66</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 46 69 72 25 90 54 92 15 67 19 83 88 37 44 87 79</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\user\delay.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 39</file>
</tool>
<tool>
<name>__cstat</name>
<file> 84</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 8</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42 23</file>
</tool>
</inputs>
</file>
@@ -191,90 +284,90 @@
<outputs>
<tool>
<name>ICCARM</name>
<file> 77</file>
<file> 59</file>
</tool>
<tool>
<name>__cstat</name>
<file> 91</file>
<file> 68</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 76</file>
<file> 62</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63 70 0 57 78 80</file>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42 13 65 77 85</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\drivers\fsl_gpio.c</name>
<name>$PROJ_DIR$\..\user\uart_Interrupt.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 25</file>
<file> 43</file>
</tool>
<tool>
<name>__cstat</name>
<file> 41</file>
<file> 29</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 64</file>
<file> 81</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 57 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63 70</file>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42 14 85 77 65</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\drivers\fsl_clock.c</name>
<name>$PROJ_DIR$\..\user\main.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 44</file>
<file> 45</file>
</tool>
<tool>
<name>__cstat</name>
<file> 90</file>
<file> 76</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 22</file>
<file> 75</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 70 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63</file>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42 65 77 23 14 85</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\drivers\fsl_common.c</name>
<name>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 68</file>
<file> 93</file>
</tool>
<tool>
<name>__cstat</name>
<file> 13</file>
<file> 95</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 18</file>
<file> 32</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63 70</file>
<file> 31 47 69 72 25 90 54 50 78 82 20 71 22 46 27 55 53 92 15 67 19 83 88 37 44 87 79 42 58 102 96 111 94</file>
</tool>
</inputs>
</file>
@@ -283,13 +376,13 @@
<outputs>
<tool>
<name>ILINK</name>
<file> 23</file>
<file> 24</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ILINK</name>
<file> 30 32 44 68 25 81 51 77 42 40 84 67 29 34 74</file>
<file> 49 39 21 56 38 91 45 59 6 5 43 73 30 51 64</file>
</tool>
</inputs>
</file>
@@ -298,105 +391,136 @@
<outputs>
<tool>
<name>ICCARM</name>
<file> 65</file>
<file> 3</file>
</tool>
<tool>
<name>__cstat</name>
<file> 55</file>
<file> 36</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 45</file>
<file> 28</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 62 36 28 72 35 19 52 71 47 14 39 56 8 54 75 69 24 16 27 33 1 15 21 46 38 17 5 59 63 70 60</file>
<file> 26 69 72 25 90 54 63 31 47 50 78 58 20 71 22 46 27 55 53 92 15 67 19 83 88 37 44 87 79 42 82</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\utilities\debug_console\fsl_debug_console.c</name>
<name>$PROJ_DIR$\..\utilities\fsl_assert.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 40</file>
</tool>
<tool>
<name>__cstat</name>
<file> 12</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 66</file>
<file> 60</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 71 47 36 28 72 35 19 14 39 60 8 54 75 69 24 16 27 33 1 15 21 46 38 17 5 59 63 70 56</file>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42 94 102 96 111</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\utilities\fsl_assert.c</name>
<name>$PROJ_DIR$\..\utilities\serial_manager.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 73</file>
<file> 106</file>
</tool>
<tool>
<name>__cstat</name>
<file> 7</file>
<file> 114</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 50</file>
<file> 112</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63 70</file>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42 102 96 111 97</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\drivers\fsl_uart.c</name>
<name>$PROJ_DIR$\..\utilities\generic_list.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 81</file>
<file> 110</file>
</tool>
<tool>
<name>__cstat</name>
<file> 89</file>
<file> 105</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 82</file>
<file> 116</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 80 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63 70</file>
<file> 103 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\user\uart_Interrupt.c</name>
<name>$PROJ_DIR$\..\utilities\serial_port_uart.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 84</file>
<file> 115</file>
</tool>
<tool>
<name>__cstat</name>
<file> 107</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 108</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42 102 96 111 97</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\utilities\uart_adapter.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 113</file>
</tool>
<tool>
<name>__cstat</name>
<file> 92</file>
<file> 109</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 83</file>
<file> 104</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 8 54 36 28 72 35 19 75 69 24 14 16 47 39 27 33 1 15 21 46 38 17 5 59 63 70 87 80 78</file>
<file> 20 71 69 72 25 90 54 22 46 27 50 55 47 78 53 92 15 67 19 83 88 37 44 87 79 42 85 111</file>
</tool>
</inputs>
</file>


+ 1
- 1
IAR/test01.ewd View File

@@ -749,7 +749,7 @@
</option>
<option>
<name>JLinkInitialSpeed</name>
<state>1000</state>
<state>10000</state>
</option>
<option>
<name>CCDoJlinkMultiTarget</name>


+ 19
- 5
user/main.c View File

@@ -4,21 +4,35 @@
#include "pin_Init.h"
#include "delay.h"
#include "uart_Interrupt.h"
#include "fsl_uart.h"
#include "system_MKV56F24.h"
/*********************************************
PTA15——LED灯闪烁
**********************************************/

void main()
{
MCG->C4 = 0x40;
SystemCoreClockUpdate ();
NVIC_SetPriorityGrouping(3u); //设置优先级分组3
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(3u, 3, 2)); //抢占优先级2,子优先级2
NVIC_SetPriority(UART1_RX_TX_IRQn, NVIC_EncodePriority(3u, 1, 2)); //抢占优先级1,子优先级2
NVIC_SetPriority(UART2_RX_TX_IRQn, NVIC_EncodePriority(3u, 2, 2)); //抢占优先级1,子优先级2
Delay_Init(); //延时函数初始化
pin_Init(); //GPIO初始化
UART_InterrputInit(); //UART2初始化
UART1_InterrputInit(); //UART1初始化
UART2_InterrputInit(); //UART2初始化
while (1)
{
GPIO_PinWrite(GPIOA, 15, 0);
Delay_ms(500U);
GPIO_PinWrite(GPIOA, 15, 1);
Delay_ms(500U);
// GPIO_PinWrite(GPIOA, 15, 0);
// Delay_ms(100U);
// GPIO_PinWrite(GPIOA, 15, 1);
// Delay_ms(100U);
UART1_sendData();
Delay_ms(300U);
UART2_sendData();
Delay_ms(300U);
RS485_Recieve_Data();
}

}


+ 25
- 5
user/pin_Init.c View File

@@ -27,14 +27,19 @@ void pin_Init()
};
GPIO_PinInit(GPIOA, 15U, &config); //初始化PTA15
GPIO_PinWrite(GPIOA, 15, 1); //PTA15写1
/*编码器方向PTE3*/
CLOCK_EnableClock(kCLOCK_PortE); //开启PORT时钟
PORT_SetPinConfig(PORTE, 3U, &GPIO_Port_Init); //设置引脚复用方式
GPIO_PinInit(GPIOE, 3U, &config); //初始化PTA15
}

/*****************UART2引脚初始化*************************/
void UART2_InitPins(void)
/*****************UART1引脚初始化*************************/
void UART1_InitPins(void)
{
CLOCK_EnableClock(kCLOCK_PortE); //开启PORT时钟
PORT_SetPinMux(PORTE, 16U, kPORT_MuxAlt3); //PTE16配置为UART2_TX
PORT_SetPinMux(PORTE, 17U, kPORT_MuxAlt3); //PTE17配置为UART2_RX
// CLOCK_EnableClock(kCLOCK_PortE); //开启PORT时钟
PORT_SetPinMux(PORTE, 0U, kPORT_MuxAlt3); //PTE0配置为UART1_TX
PORT_SetPinMux(PORTE, 1U, kPORT_MuxAlt3); //PTE1配置为UART1_RX
SIM->SOPT5 = ((SIM->SOPT5 &
/* UART1收发数据源选择*/
(~(SIM_SOPT5_UART1TXSRC_MASK | SIM_SOPT5_UART1RXSRC_MASK)))
@@ -42,5 +47,20 @@ void UART2_InitPins(void)
| SIM_SOPT5_UART1RXSRC(SOPT5_UART1RXSRC_UART_RX));
}

/*****************UART2引脚初始化*************************/
void UART2_InitPins(void)
{
// CLOCK_EnableClock(kCLOCK_PortE); //开启PORT时钟
PORT_SetPinMux(PORTE, 16U, kPORT_MuxAlt3); //PTE16配置为UART2_TX
PORT_SetPinMux(PORTE, 17U, kPORT_MuxAlt3); //PTE17配置为UART2_RX
// SIM->SOPT5 = ((SIM->SOPT5 &
// /* UART1收发数据源选择*/
// (~(SIM_SOPT5_UART1TXSRC_MASK | SIM_SOPT5_UART1RXSRC_MASK)))
// | SIM_SOPT5_UART1TXSRC(SOPT5_UART1TXSRC_UART_TX)
// | SIM_SOPT5_UART1RXSRC(SOPT5_UART1RXSRC_UART_RX));
}






+ 3
- 0
user/pin_Init.h View File

@@ -4,9 +4,12 @@
/*****************宏定义*************************/
#define SOPT5_UART1RXSRC_UART_RX 0x00u //选择UART1_RX pin模式接收数据
#define SOPT5_UART1TXSRC_UART_TX 0x00u //选择UART1_RT pin模式发送数据
#define SOPT5_UART0RXSRC_UART_RX 0x00u //选择UART0_RX pin模式接收数据
#define SOPT5_UART0TXSRC_UART_TX 0x00u //选择UART0_RT pin模式发送数据

/*****************函数声明*************************/
void pin_Init(); //PTA15引脚初始化
void UART2_InitPins(void); //UART2引脚初始化
void UART1_InitPins(void); //UART1引脚初始化

#endif

+ 117
- 9
user/uart_Interrupt.c View File

@@ -3,16 +3,39 @@
#include "uart_Interrupt.h"
#include "fsl_uart.h"
#include "pin_Init.h"
#include "fsl_gpio.h"

/*****************变量声明*************************/
uint8_t demoRingBuffer[DEMO_RING_BUFFER_SIZE];
uint16_t txIndex; //发送数据计数变量
volatile uint16_t rxIndex; //接收数据计数变量
uint16_t txIndex; //发送数据计数
uint16_t rxIndex; //接收数据计数
uint16_t UART1rxIndex = 0; //接收数据计数
uint8_t RS485_Buf_Arr[DEMO_RS485_ARR_SIZE]; //RS485缓存数据数组
uint16_t UART2_SendData_len; //记录UART2发送数据长度
uint8_t UART2_SendData_OK; //UART2发送结束标志
uint8_t g_tipString1[] = "\r\n\r\n编码器位置\t";
uint8_t g_tipString2[] = "\t圈数\t";
uint32_t BMQ_Location_Num; //编码器位置
uint32_t BMQ_Circle_Num; //编码器圈数
uint8_t UART2_Buf_Arr[DEMO_UART2_ARR_SIZE]; //RS485缓存数据数组
/*****************UART1初始化*************************/
void UART1_InterrputInit()
{
UART1_InitPins(); //UART1引脚初始化
uart_config_t config; //参数设置
UART_GetDefaultConfig(&config);
config.baudRate_Bps = 2500000u; //设置波特率
config.enableTx = true;
config.enableRx = true;
UART_Init(UART1, &config, SystemCoreClock); //初始化配置
UART_EnableInterrupts(UART1, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable); //使能Rx中断
EnableIRQ(UART1_RX_TX_IRQn); //开启中断
}

/*****************UART2初始化*************************/
void UART_InterrputInit()
void UART2_InterrputInit()
{
UART2_InitPins(); //串口引脚初始化
UART2_InitPins(); //UART2引脚初始化
uart_config_t config; //参数设置
UART_GetDefaultConfig(&config);
config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE; //设置波特率
@@ -23,10 +46,33 @@ void UART_InterrputInit()
EnableIRQ(UART2_RX_TX_IRQn); //开启中断
}

uint32_t UART1_IRQ_Count;
/*****************UART1中断服务函数**********************/
void UART1_RX_TX_IRQHandler(void)
{
uint16_t data;
UART1_IRQ_Count ++;
UART1_IRQ_Count %= 1000;
if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(UART1)) //接收到数据标志
{
data = UART_ReadByte(UART1);
if (UART1rxIndex < DEMO_RING_BUFFER_SIZE) //
{
demoRingBuffer[UART1rxIndex] = data;
UART1rxIndex++;
UART1rxIndex %= DEMO_RING_BUFFER_SIZE;
}
}
SDK_ISR_EXIT_BARRIER;
}

uint32_t UART2_IRQ_Count;
/*****************UART2中断服务函数**********************/
void UART2_RX_TX_IRQHandler(void)
{
uint16_t data;
UART2_IRQ_Count ++;
UART2_IRQ_Count %= 1000;
if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(DEMO_UART)) //接收到数据标志
{
data = UART_ReadByte(DEMO_UART);
@@ -39,12 +85,74 @@ void UART2_RX_TX_IRQHandler(void)
}
/*将接收到的数据返回*/
if ((kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(DEMO_UART)) && (rxIndex != txIndex)) //发送中断标志
{
UART_WriteByte(DEMO_UART, demoRingBuffer[txIndex]); //发送一帧数据(一个字节,8个数据位)
txIndex++;
txIndex %= DEMO_RING_BUFFER_SIZE;
}
{
UART_WriteByte(DEMO_UART, demoRingBuffer[txIndex]); //发送一帧数据(一个字节,8个数据位)
txIndex++;
txIndex %= DEMO_RING_BUFFER_SIZE;
}
SDK_ISR_EXIT_BARRIER;
}

/**************发送一帧数据*************/
void UART1_sendData()
{
if (UART2_SendData_OK == 1)
{
return;
}
GPIO_PinWrite(GPIOE, 3, 1); //PTE3写
UART_WriteByte(UART1, 0x1A); //发送一帧数据(一个字节,8个数据位)
UART_WriteByte(UART1, 0x2A); //发送一帧数据(一个字节,8个数据位)
while (!(kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(UART1))); //发送中断标志
UART_ClearStatusFlags(UART1, kUART_TransmissionCompleteFlag);
GPIO_PinWrite(GPIOE, 3, 0); //PTE3写
}

/**************UART2发送数据*******************/
void UART2_sendData()
{
UART2_SendData_OK = 1;
if (UART2_SendData_len != 0)
{
UART_WriteBlocking(DEMO_UART, g_tipString1, sizeof(g_tipString1) / sizeof(g_tipString1[0])-1);
for (uint8_t i = 0; i < 6; i++ )
{
UART_WriteByte(DEMO_UART, UART2_Buf_Arr[i]);
while (!(kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(DEMO_UART))); //等待发送结束
UART_ClearStatusFlags(DEMO_UART, kUART_TransmissionCompleteFlag);
}
UART_WriteBlocking(DEMO_UART, g_tipString2, sizeof(g_tipString2) / sizeof(g_tipString2[0])-1);
for (uint8_t i = 0; i < 5; i++ )
{
UART_WriteByte(DEMO_UART, UART2_Buf_Arr[i+6]);
while (!(kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(DEMO_UART))); //等待发送结束
UART_ClearStatusFlags(DEMO_UART, kUART_TransmissionCompleteFlag);
}
}
UART2_SendData_OK = 0;
}

/***************RS485接收数据*********************/
void RS485_Recieve_Data()
{
for (uint8_t i = 0; i < UART1rxIndex; i++ )
{
RS485_Buf_Arr[i] = demoRingBuffer[i];
}
BMQ_Location_Num = (RS485_Buf_Arr[4] << 16) + (RS485_Buf_Arr[3] << 8) + (RS485_Buf_Arr[2]);
UART2_Buf_Arr[0] = (BMQ_Location_Num / 100000) + '0';
UART2_Buf_Arr[1] = (BMQ_Location_Num % 100000 / 10000) + '0';
UART2_Buf_Arr[2] = (BMQ_Location_Num % 10000 / 1000) + '0';
UART2_Buf_Arr[3] = (BMQ_Location_Num % 1000 / 100) + '0';
UART2_Buf_Arr[4] = (BMQ_Location_Num % 100 / 10) + '0';
UART2_Buf_Arr[5] = (BMQ_Location_Num % 10) + '0';
BMQ_Circle_Num = (RS485_Buf_Arr[7] << 8) + (RS485_Buf_Arr[6]);
UART2_Buf_Arr[6] = (BMQ_Circle_Num % 100000 / 10000) + '0';
UART2_Buf_Arr[7] = (BMQ_Circle_Num % 10000 / 1000) + '0';
UART2_Buf_Arr[8] = (BMQ_Circle_Num % 1000 / 100) + '0';
UART2_Buf_Arr[9] = (BMQ_Circle_Num % 100 / 10) + '0';
UART2_Buf_Arr[10] = (BMQ_Circle_Num % 10) + '0';
UART2_SendData_len = UART1rxIndex;
UART1rxIndex = 0;
}


+ 8
- 2
user/uart_Interrupt.h View File

@@ -5,10 +5,16 @@
/*****************宏定义*************************/
#define DEMO_UART UART2 // 选择串口UART2
#define BOARD_DEBUG_UART_BAUDRATE 115200 //设置波特率115200
#define DEMO_RING_BUFFER_SIZE 16
#define DEMO_RING_BUFFER_SIZE 64 //UART接收缓存
#define DEMO_UART2_ARR_SIZE 64 //UART2发送数组大小
#define DEMO_RS485_ARR_SIZE 64 //RS485缓存数组大小

/*****************函数声明*************************/
void UART_InterrputInit(); //串口初始化
void UART2_InterrputInit(); //UART2串口初始化
void UART1_InterrputInit(); //UART0串口初始化
void UART1_sendData(); //UART1发送1帧数据
void UART2_sendData(); //UART2发送数组
void RS485_Recieve_Data(); //RS485接收数据


#endif

Loading…
Cancel
Save