关于STM32F405中ADC单通道采样 DAC+DMA产生正弦信号 ADC+DMA高频采样

STM32F405功能优势

----------------------------------------
1、主频最高可达168MHz
2、3个12位AD,最高转换速度可达2.4MSPS
3、最高可达24通道,3通道同步采样可达7.2MSPS

DAC+DMA产生正弦信号程序配置

---------------------------------------------------------------

采用DMA循环传输模式,触发源为TIM2的 DAC_Trigger_T2_TRGO
本程序采用20个数据,2M的转换频率,产生100KHz的正弦信号

const uint16_t Sine12bit[20] =
{  2681,3252,3705,3996,4095,3996,3705,3252,2681,
 2048,1415,844 ,391,100, 0,100, 391 , 844, 1415,2048};

void GPIO_Configuration(void)
{     
    GPIO_InitTypeDef GPIO_InitStructure;   
     /* Enable peripheral clocks ------------------------------------------------*/   
     /* GPIOA Periph clock enable */     
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);    
    /* GPIOC Periph clock enable */  
     RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
    /* DAC channel 1 & 2 (DAC_OUT1 = PA.4)(DAC_OUT2 = PA.5) configuration */   
     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5;   
     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;   
     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;    
     GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;    
     GPIO_Init(GPIOA, &GPIO_InitStructure);
}
void DAC_Configuration(void)
{    
    DAC_InitTypeDef DAC_InitStructure;
    /* DAC Periph clock enable */     
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
    /* DAC channel1 Configuration */     
    DAC_InitStructure.DAC_Trigger = DAC_Trigger_T2_TRGO;    
    DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;  
    DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable;     
    DAC_Init(DAC_Channel_1, &DAC_InitStructure);
     /* Enable DAC Channel1: Once the DAC channel1 is enabled, PA.04 is  
    automatically connected to the DAC converter. */    
    DAC_Cmd(DAC_Channel_1, ENABLE)
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值