资源简介
工程是基于STM32F207的ADC_DMA的整体程序
#define ADC1_DR_Address ((u32)0x4001204C) //ADC1数据寄存器地址=ADC1基准地址(0x40012000)+数据寄存器偏移地址(0x4c)
GPIO_InitTypeDef GPIO_InitStructure;
ADC_InitTypeDef ADC_InitStructure;
ADC_CommonInitTypeDef ADC_CommonInitStructure;
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);// 使能 GPIO 时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 , ENABLE);// 开启ADC时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE); // 开启DMA时钟
DMA_DeInit(DMA2_Stream0);
DMA_InitStructure.DMA_Channel=DMA_Channel_0;
DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address;// 外设基址为:ADC 数据寄存器地址
DMA_InitStructure.DMA_Memory0BaseAddr = (u32)&ad;_start;// 存储器地址,实际上就是一个内部SRAM的变量
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;// 数据传输方向为外设到存储器
DMA_InitStructure.DMA_BufferSize = 1;// 缓冲区大小为,指一次传输的数据量
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; // 外设寄存器只有一个,地址不用递增
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;// 存储器地址
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;// 外设数据大小为半字,即两个字节
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; // 存储器数据大小也为半字,跟外设数据大小相同
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; // 循环传输模式
DMA_InitStructure.DMA_Priority = DMA_Priority_High;// DMA 传输通道优先级为高,当使用一个DMA通道时,优先级设置不影响
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; // 禁止DMA FIFO ,使用直连模式
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
代码片段和文件信息
/**
******************************************************************************
* @file USART/USART_Printf/main.c
* @author MCD Application Team
* @version V1.0.0
* @date 30-September-2011
* @brief Main program body
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* © COPYRIGHT 2011 STMicroelectronics
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include “stm32f2xx.h“
//#include “stm324xg_eval.h“
#include
#include “delay.h“
#define ADC1_DR_Address ((u32)0x4001204C) //ADC1数据寄存器地址=ADC1基准地址(0x40012000)+数据寄存器偏移地址(0x4c)
/** @addtogroup STM32F4xx_StdPeriph_Examples
* @{
*/
/** @addtogroup USART_Printf
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
USART_InitTypeDef USART_InitStructure;
void GPIO_Configuration(void);
void NVIC_Configuration(void);
void ADC_DMA_Init(void);
u8 Uart_PutChar(u8 ch);
u8 ( *ch)(u8);
void Uart_PutString(u8 buf[]u16 len);
unsigned int j;
unsigned char rx_buf[300];
unsigned int rx_num = 0;
unsigned int tx_num = 0;
unsigned char rx_state = 0;
vu16 ad_start[2];
/* Private function prototypes -----------------------------------------------*/
#ifdef __GNUC__
/* With GCC/RAISONANCE small printf (option LD linker->Libraries->Small printf
set to ‘Yes‘) calls __io_putchar() */
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch FILE *f)
#endif /* __GNUC__ */
/* Private functions ---------------------------------------------------------*/
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
SystemInit();
delay_init();
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
NVIC_Configuration();
ADC_DMA_Init();
GPIO_Configuration();
ADC_SoftwareStartConv(ADC1); //开始adc转换,软件触发
while (1)
{
printf(“ADC_DMA实验\n“);
delay_ms(1000); //从正点原子例程移植的延时函数
}
}
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1Periph
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7930 2018-08-26 20:39 STM32F207 ADC_DMA\delay\delay.c
文件 1995 2018-11-20 10:27 STM32F207 ADC_DMA\delay\delay.h
文件 47442 2012-04-04 20:39 STM32F207 ADC_DMA\EWARM\Project.dep
文件 26223 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\Project.ewd
文件 30376 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\Project.ewp
文件 161 2011-04-21 18:54 STM32F207 ADC_DMA\EWARM\Project.eww
文件 3011 2011-04-21 18:54 STM32F207 ADC_DMA\EWARM\readme.txt
文件 1356 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\settings\Project.cspy.bat
文件 63 2012-04-04 20:39 STM32F207 ADC_DMA\EWARM\settings\Project.dbgdt
文件 258 2012-04-04 20:39 STM32F207 ADC_DMA\EWARM\settings\Project.dni
文件 2480 2012-04-04 20:39 STM32F207 ADC_DMA\EWARM\settings\Project.wsdt
文件 234464 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Exe\Project.out
文件 41766 2012-04-04 20:39 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\List\Project.map
文件 22420 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\core_cm3.o
文件 20060 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\main.o
文件 15168 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\misc.o
文件 67448 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\startup_stm32f2xx.o
文件 23568 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm322xg_eval_fsmc_sram.o
文件 136448 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm322xg_eval_ioe.o
文件 192448 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm322xg_eval_lcd.o
文件 78704 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_adc.o
文件 57352 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_can.o
文件 15704 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_crc.o
文件 35940 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_cryp.o
文件 40696 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_cryp_aes.o
文件 18560 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_cryp_des.o
文件 18752 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_cryp_tdes.o
文件 39312 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_dac.o
文件 14404 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_dbgmcu.o
文件 33352 2012-04-04 20:38 STM32F207 ADC_DMA\EWARM\STM322xG_EVAL\Obj\stm32f2xx_dcmi.o
............此处省略401个文件信息
相关资源
- WS2812B全彩LED灯PWM+DMA控制
- STM32的ADC1的三路通道数据采集(STM3
- STM32F103用串口空闲中断+DMA实现modbus通
- STM8单片机3通道ADC数据采集及串口波形
- STM32无刷无感电机驱动
- WCDMA切换原理 包括硬切换、软切换、
- BCM 56XX SDK 编程手册
- 3dmax制作广场
- stm32f407 利用DAC产生sin波形通过DMA
- stm32f407ADC高速采样并进行CFFT变换
- goodman名著:光学中的散斑现象:理论和
- 多路ADC
- stm32f1控制电磁阀+舵机+ADC推杆
- CDMA2000_1X_EV-DO网络技术电子版(珍藏版
- 按键触发ADC采集串口发送
- 基于STM32F103的RS485通信采用DMA方式发送
- Driver开发工具
- OFDM and MC-CDMA
- WS2812.zip
- 3Dmax 导出virtools插件
- sendmail相关的rpm包
- dma_performance_demo
- eclipse4.4 jadclipse插件
- Jadclipse For Eclipse 4.x
- STM32的SPI通信总结(含DMA).pdf
- F407的ADC多通道采样+DMA
- 基于STM32的ADC采样(双通道)
- FPGA控制告诉ADC程序
- STM32-函数信号发生器
- STM32的ADC模数转换(STM32神舟IV号-库函
评论
共有 条评论