专家
公告
财富商城
电子网
旗下网站
首页
问题库
专栏
标签库
话题
专家
NEW
门户
发布
提问题
发文章
求stm32无线NRF带双通道ADC程序
2019-03-23 20:20
发布
×
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
站内问答
/
STM32/STM8
2233
5
1640
急求于基于STM32F103C8BT的无线传输带双通道ADC的源程序,手上有无线NRF转USB通讯的程序,也有ADC的程序,但是缺少将他们融合在一起的程序……那位高手能指点一下 此帖出自
小平头技术问答
友情提示:
此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答
daicheng
2019-03-24 09:06
简单说一下吧 参考一下
GPIO 配置
// AD1 AD2 AD3 AD4
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 |GPIO_Pin_5|GPIO_Pin_6 |GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
void ADC_Configuration(void)
{
ADC_InitTypeDef ADC_InitStructure;
/* Initializes the ADC1 peripheral configuration*/
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; //ADC_Mode value
ADC_InitStructure.ADC_ScanConvMode = ENABLE; //ADC_ScanConvMode value
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; //ADC_ContinuousConvMode value
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T2_CC2; //ADC_ExternalTrigConv value
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //ADC_DataAlign value
ADC_InitStructure.ADC_NbrOfChannel = ADC_ScanCh; //ADC_NbrOfChannel value
ADC_Init(ADC1, &ADC_InitStructure);
ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 1, ADC_SampleTime_13Cycles5); //pin: PC4
ADC_RegularChannelConfig(ADC1, ADC_Channel_15, 2, ADC_SampleTime_13Cycles5); //pin: PC5
ADC_RegularChannelConfig(ADC1, ADC_Channel_8, 3, ADC_SampleTime_13Cycles5); //pin: PB0
ADC_RegularChannelConfig(ADC1, ADC_Channel_9, 4, ADC_SampleTime_13Cycles5); //pin: PB1
ADC_RegularChannelConfig(ADC1, ADC_Channel_16, 5, ADC_SampleTime_55Cycles5); //temperature
ADC_TempSensorVrefintCmd(ENABLE);
ADC_DMACmd(ADC1, ENABLE);
ADC_ExternalTrigConvCmd(ADC1, ENABLE);
ADC_Cmd(ADC1, ENABLE);
ADC_ResetCalibration(ADC1);
while(ADC_GetResetCalibrationStatus(ADC1));
ADC_StartCalibration(ADC1);
while(ADC_GetCalibrationStatus(ADC1));
}
void DMA_Configuration(void)
{
DMA_DeInit(DMA1_Channel1);
DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address; //DMA_PeripheralBaseAddr value
DMA_InitStructure.DMA_MemoryBaseAddr = (u32)ADC_ConvertValueTab; //DMA_MemoryBaseAddr value
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; //DMA_DIR value
DMA_InitStructure.DMA_BufferSize = ADC_ScanCh*ADC_ConvertNum;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //DMA_PeripheralInc value
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; //DMA_MemoryInc value
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; //DMA_PeripheralDataSize value
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; //DMA_MemoryDataSize value
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; //DMA_Mode value
DMA_InitStructure.DMA_Priority = DMA_Priority_High; //DMA_Priority value
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; //DMA_M2M value
DMA_Init(DMA1_Channel1, &DMA_InitStructure);
//DMA_Cmd(DMA1_Channel1, ENABLE);
}
注意关DMA与AD的顺序
}
加载中...
查看其它5个回答
一周热门
更多
>
相关问题
相关文章
嵌入式编译生成的HEX文件和BIN文件内容详解
0个评论
ST公司第一款无线低功耗单片机模块有效提高物联网设计生产效率
0个评论
单片机中把部分Flash虚拟成Eeprom使用时,如何延长使用寿命
0个评论
如何实现对单片机寄存器的访问
0个评论
通过USB用STM32片内自带Bootloader下载程序及注意事项
0个评论
欲练此功必先自宫之STM32汇编启动,放慢是为了更好的前行
0个评论
敢问路在何方,STM32迈出的第一步,却注定了它非凡的一生
0个评论
年工作时间真的就等于3年工作经验?也许你就不配
0个评论
×
关闭
采纳回答
向帮助了您的知道网友说句感谢的话吧!
非常感谢!
确 认
×
关闭
编辑标签
最多设置5个标签!
保存
关闭
×
关闭
举报内容
检举类型
检举内容
检举用户
检举原因
广告推广
恶意灌水
回答内容与提问无关
抄袭答案
其他
检举说明(必填)
提交
关闭
×
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
×
付费偷看金额在0.1-10元之间
确定
×
关闭
您已邀请
0
人回答
查看邀请
擅长该话题的人
回答过该话题的人
我关注的人
GPIO 配置
// AD1 AD2 AD3 AD4
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 |GPIO_Pin_5|GPIO_Pin_6 |GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
void ADC_Configuration(void)
{
ADC_InitTypeDef ADC_InitStructure;
/* Initializes the ADC1 peripheral configuration*/
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; //ADC_Mode value
ADC_InitStructure.ADC_ScanConvMode = ENABLE; //ADC_ScanConvMode value
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; //ADC_ContinuousConvMode value
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T2_CC2; //ADC_ExternalTrigConv value
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //ADC_DataAlign value
ADC_InitStructure.ADC_NbrOfChannel = ADC_ScanCh; //ADC_NbrOfChannel value
ADC_Init(ADC1, &ADC_InitStructure);
ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 1, ADC_SampleTime_13Cycles5); //pin: PC4
ADC_RegularChannelConfig(ADC1, ADC_Channel_15, 2, ADC_SampleTime_13Cycles5); //pin: PC5
ADC_RegularChannelConfig(ADC1, ADC_Channel_8, 3, ADC_SampleTime_13Cycles5); //pin: PB0
ADC_RegularChannelConfig(ADC1, ADC_Channel_9, 4, ADC_SampleTime_13Cycles5); //pin: PB1
ADC_RegularChannelConfig(ADC1, ADC_Channel_16, 5, ADC_SampleTime_55Cycles5); //temperature
ADC_TempSensorVrefintCmd(ENABLE);
ADC_DMACmd(ADC1, ENABLE);
ADC_ExternalTrigConvCmd(ADC1, ENABLE);
ADC_Cmd(ADC1, ENABLE);
ADC_ResetCalibration(ADC1);
while(ADC_GetResetCalibrationStatus(ADC1));
ADC_StartCalibration(ADC1);
while(ADC_GetCalibrationStatus(ADC1));
}
void DMA_Configuration(void)
{
DMA_DeInit(DMA1_Channel1);
DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address; //DMA_PeripheralBaseAddr value
DMA_InitStructure.DMA_MemoryBaseAddr = (u32)ADC_ConvertValueTab; //DMA_MemoryBaseAddr value
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; //DMA_DIR value
DMA_InitStructure.DMA_BufferSize = ADC_ScanCh*ADC_ConvertNum;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //DMA_PeripheralInc value
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; //DMA_MemoryInc value
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; //DMA_PeripheralDataSize value
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; //DMA_MemoryDataSize value
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; //DMA_Mode value
DMA_InitStructure.DMA_Priority = DMA_Priority_High; //DMA_Priority value
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; //DMA_M2M value
DMA_Init(DMA1_Channel1, &DMA_InitStructure);
//DMA_Cmd(DMA1_Channel1, ENABLE);
}
注意关DMA与AD的顺序
}
一周热门 更多>