赞
踩
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;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。