基于STM32单片机的ADC与DMA配置的介绍与使用.doc

基于STM32单片机的ADC与DMA配置的介绍与使用.doc

  1. 1、本文档共5页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
基于STM32单片机的ADC与DMA配置的介绍与使用 本文使用 ADC转换 电位器输出的电压值,并用 DMA模式传输转换的结果,每8次采样转换取平均值,做一个简单的数字滤波。 ADC的详细配置与使用 见之前的日记 STM32中ADC的使用,只是最后增加一步配置DMA: DMA f or ADC channels features configura tion ? To enable the DMA mode for ADC channels group, use the ADC_DMACmd()function. ? To configure the DMA transfer request, use ADC_DMAConfig() function. DMA的配置 (摘自STM32F3官方用户手册UM1581User manual) 1. Enable The DMA controller clock using RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE) function for DMA1 orusing RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA2, ENABLE) function forDMA2. 2. Enable and configure the peripheral to be connec ted to the DMA channel (except forinternal S RAM / FLASH memories: no initialization is necessary)。 3. For a given Channel, program the Source and Destination addresses, the transferDirection, the Buffer Size, the Peripheral and Memory Incrementation mode and Data Size, the Circular or Normal mode, the channel transfer Priority and the Memory-to-Memory transfer mode (if needed) using the DMA_Init() function. 4. Enable the NVIC and the corresponding interrupt(s) using the function DMA_ITConfig() if you need to use DMA interrupts. 5. Enable the DMA channel using the DMA_Cmd() function. 6. Activate the needed channel Request using PPP_DMACmd() function for any PPPperipheral except internal SRAM and FLASH (ie. SPI, USART 。..) The functionallowing this operation is provided in each PPP peripheral driver (ie. SPI_DMACmd forSPI peripheral)。 7. Optionally, you can configure the number of data to be transferred when the channel is disabled (ie. after each Transfer Complete event or when a Transfer Error occu rs)using the function DMA_SetCurrDataCounter()。 And you can get the number ofremaining data to be transferred using the function DMA_GetCurrDataCounter() at runtime (when the DMA channel is enabled and running)。 8. To control DMA events you can use one of the following two methods: a. Check on DMA channel flags using the function DMA_GetFlagStat

文档评论(0)

yuzhongao9872 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档