Browse Source

2022/8/10实现编码器位置读取

div1
QQyyblithe 2 years ago
parent
commit
82ba71d0b4
11 changed files with 478 additions and 259 deletions
  1. +1
    -1
      IAR/settings/test01.Debug.driver.xcl
  2. +33
    -18
      IAR/settings/test01.dbgdt
  3. +1
    -1
      IAR/settings/test01.dnx
  4. +31
    -34
      IAR/settings/test01.wsdt
  5. +269
    -145
      IAR/test01.dep
  6. +1
    -1
      IAR/test01.ewd
  7. +14
    -9
      user/main.c
  8. +22
    -15
      user/pin_Init.c
  9. +1
    -1
      user/pin_Init.h
  10. +98
    -32
      user/uart_Interrupt.c
  11. +7
    -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"



+ 33
- 18
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>3711880284</Checksum>
<Checksum>2353942654</Checksum>
</DebugChecksum>
<Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught>


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


+ 269
- 145
IAR/test01.dep View File

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


+ 14
- 9
user/main.c View File

@@ -14,20 +14,25 @@ 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初始化
UART0_InterrputInit(); //UART0初始化
UART1_InterrputInit(); //UART1初始化
UART2_InterrputInit(); //UART2初始化
while (1)
{
GPIO_PinWrite(GPIOA, 15, 0);
Delay_ms(500U);
GPIO_PinWrite(GPIOA, 15, 1);
Delay_ms(500U);
UART_WriteByte(UART0, 0x1A); //发送一帧数据(一个字节,8个数据位)
UART_WriteByte(UART0, 0x62); //发送一帧数据(一个字节,8个数据位)
UART_WriteByte(UART0, 0xc2); //发送一帧数据(一个字节,8个数据位)
UART_WriteByte(UART0, 0x40); //发送一帧数据(一个字节,8个数据位)
// 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();
}

}


+ 22
- 15
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,18 +47,20 @@ void UART2_InitPins(void)
| SIM_SOPT5_UART1RXSRC(SOPT5_UART1RXSRC_UART_RX));
}

/*****************UART0引脚初始化*************************/
void UART0_InitPins(void)
/*****************UART2引脚初始化*************************/
void UART2_InitPins(void)
{
CLOCK_EnableClock(kCLOCK_PortB); //开启PORT时钟
PORT_SetPinMux(PORTB, 0U, kPORT_MuxAlt7); //PTB0配置为UART0_RX
PORT_SetPinMux(PORTB, 1U, kPORT_MuxAlt7); //PTB1配置为UART0_TX
SIM->SOPT5 = ((SIM->SOPT5 &
/* UART0收发数据源选择*/
(~(SIM_SOPT5_UART0TXSRC_MASK | SIM_SOPT5_UART0RXSRC_MASK)))
| SIM_SOPT5_UART0TXSRC(SOPT5_UART0TXSRC_UART_TX)
| SIM_SOPT5_UART0RXSRC(SOPT5_UART0RXSRC_UART_RX));
// 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));
}






+ 1
- 1
user/pin_Init.h View File

@@ -10,6 +10,6 @@
/*****************변鑒�츠*************************/
void pin_Init(); //PTA15多신놓迦뺏
void UART2_InitPins(void); //UART2多신놓迦뺏
void UART0_InitPins(void); //UART0多신놓迦뺏
void UART1_InitPins(void); //UART1多신놓迦뺏

#endif

+ 98
- 32
user/uart_Interrupt.c View File

@@ -3,24 +3,33 @@
#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; //接收数据计数

/*****************UART0初始化*************************/
void UART0_InterrputInit()
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()
{
UART0_InitPins(); //UART0引脚初始化
UART1_InitPins(); //UART1引脚初始化
uart_config_t config; //参数设置
UART_GetDefaultConfig(&config);
config.baudRate_Bps = 2500000u; //设置波特率
config.enableTx = true;
config.enableRx = true;
UART_Init(UART0, &config, SystemCoreClock); //初始化配置
UART_EnableInterrupts(UART0, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable); //使能Rx中断
EnableIRQ(UART0_RX_TX_IRQn); //开启中断
UART_Init(UART1, &config, SystemCoreClock); //初始化配置
UART_EnableInterrupts(UART1, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable); //使能Rx中断
EnableIRQ(UART1_RX_TX_IRQn); //开启中断
}

/*****************UART2初始化*************************/
@@ -35,40 +44,35 @@ void UART2_InterrputInit()
UART_Init(DEMO_UART, &config, SystemCoreClock); //初始化配置
UART_EnableInterrupts(DEMO_UART, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable); //使能Rx中断
EnableIRQ(UART2_RX_TX_IRQn); //开启中断
UART_WriteByte(DEMO_UART, demoRingBuffer[txIndex]); //发送一帧数据(一个字节,8个数据位)
}

uint16_t UART0_IRQ_Count = 0;
/*****************UART0中断服务函数**********************/
void UART0_RX_TX_IRQHandler(void)
uint32_t UART1_IRQ_Count;
/*****************UART1中断服务函数**********************/
void UART1_RX_TX_IRQHandler(void)
{
uint16_t data;
UART0_IRQ_Count ++;
UART0_IRQ_Count %= 1000;
if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(UART0)) //接收到数据标志
UART1_IRQ_Count ++;
UART1_IRQ_Count %= 1000;
if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(UART1)) //接收到数据标志
{
data = UART_ReadByte(UART0);
if (((rxIndex + 1) % DEMO_RING_BUFFER_SIZE) != txIndex) //
data = UART_ReadByte(UART1);
if (UART1rxIndex < DEMO_RING_BUFFER_SIZE) //
{
demoRingBuffer[rxIndex] = data;
rxIndex++;
rxIndex %= DEMO_RING_BUFFER_SIZE;
demoRingBuffer[UART1rxIndex] = data;
UART1rxIndex++;
UART1rxIndex %= DEMO_RING_BUFFER_SIZE;
}
}
/*将接收到的数据返回*/
if ((kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(DEMO_UART)) && (rxIndex != txIndex)) //发送中断标志
{
UART_WriteByte(DEMO_UART, demoRingBuffer[txIndex]); //发送一帧数据(一个字节,8个数据位)
txIndex++;
txIndex %= 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);
@@ -81,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;
}


+ 7
- 2
user/uart_Interrupt.h View File

@@ -5,11 +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 UART2_InterrputInit(); //UART2串口初始化
void UART0_InterrputInit(); //UART0串口初始化
void UART1_InterrputInit(); //UART0串口初始化
void UART1_sendData(); //UART1发送1帧数据
void UART2_sendData(); //UART2发送数组
void RS485_Recieve_Data(); //RS485接收数据


#endif

Loading…
Cancel
Save