当前位置:   article > 正文

STM32-5 STM32 ADC通过DMA发送到串口_设置adc开启dma后,使用串口传输

设置adc开启dma后,使用串口传输

DMA是CPU的小助手,负责完成数据转运的任务,一般的数据转运可以在主函数完成,但是如果数据量巨大,就不适合在main函数中转运了,因为那样会占用大量CPU进程。
ADC就是一个例子,ADC需要不断采集模拟信号,交给CPU处理,数据量巨大,所有ADC如果出现了,那一般都会给它配置一个DMA来完成数据转运。

看下要关注的DMA结构体

00066 typedef struct
00067 {
00068   uint32_t Direction;                 /*!< Specifies if the data will be transferred from memory to peripheral, 
00069                                            from memory to memory or from peripheral to memory.
00070                                            This parameter can be a value of @ref DMA_Data_transfer_direction */
00071 
00072   uint32_t PeriphInc;                 /*!< Specifies whether the Peripheral address register should be incremented or not.
00073                                            This parameter can be a value of @ref DMA_Peripheral_incremented_mode */
00074                                
00075   uint32_t MemInc;                    /*!< Specifies whether the memory address register should be incremented or not.
00076                                            This parameter can be a value of @ref DMA_Memory_incremented_mode */
00077   
00078   uint32_t PeriphDataAlignment;       /*!< Specifies the Peripheral data width.
00079                                            This parameter can be a value of @ref DMA_Peripheral_data_size */
00080 
00081   uint32_t MemDataAlignment;          /*!< Specifies the Memory data width.
00082                                            This parameter can be a value of @ref DMA_Memory_data_size */
00083                                
00084   uint32_t Mode;                      /*!< Specifies the operation mode of the DMAy Channelx.
00085                                            This parameter can be a value of @ref DMA_mode
00086                                            @note The circular buffer mode cannot be used if the memory-to-memory
00087                                                  data transfer is configured on the selected Channel */ 
00088 
00089   uint32_t Priority;                   /*!< Specifies the software priority for the DMAy Channelx.
00090                                             This parameter can be a value of @ref DMA_Priority_level */
00091 } DMA_InitTypeDef;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

在这里插入图片描述

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号