stm32_adc

所属分类单片机开发
开发工具:C-C++
文件大小:4KB
下载次数:173
上传日期:2009-09-24 17:38:56
上 传 者韩武纪
说明:  此程序是基于STM32的AD应用程序,我们在这里设置ADC为连续转换模式,常规转换序列中有两路转换通道,分别是ADC_CH10(PC0)和ADC_CH16(片内温度传感器)。因为使用了自动多通道转换,数据的取出工作最适合使用DMA方式取出,so,我们在内存里开辟了一个u16 AD_Value[2]数组,并设置了相应的DMA模块,使ADC在每个通道转换结束后启动DMA传输,其缓冲区数据量为2个HalfWord,使两路通道的转换结果自动的分别落到AD_Value[0]和AD_Value[1]中。   然后,在主函数里,就无需手动启动AD转换,等待转换结束,再取结果了。我们可以在主函数里随时取AD_Value中的数值,那里永远都是最新的AD转换结果。   如果我们定义一个更大的AD_Value数组,并调整DMA的传输数据量(BufferSize)可以实现AD结果的循环队列存储,从而可以进行各种数字滤波算法。
(This program is based on the STM32 processor AD debugging applications, we are here to set the ADC for continuous conversion mode, conventional two-way conversion sequence are converted channels, respectively ADC_CH10 (PC0) and ADC_CH16 (on-chip temperature sensors). Since the use of an automatic multi-channel conversion, data, work out the most appropriate way to use DMA out, so, we have opened up in memory of a u16 AD_Value [2] array, and set the corresponding DMA module, so that each channel ADC conversion After the start the DMA transfer, the buffer data for the two HalfWord, so that the conversion results of two-way channels were automatically fall AD_Value [0], and AD_Value [1] in the. Then, in the main function, where is no need to manually start the AD conversion, to wait for the end of conversion, and then take the result. We can readily accessible in the main function where the value of AD_Value, there is always the latest AD conversion results. If we define a larger arra)

文件列表:[举报垃圾]

近期下载者

相关文件

评论我要评论

收藏者