历史上的今天
返回首页

历史上的今天

今天是:2025年03月13日(星期四)

正在发生

2019年03月13日 | STM32F4开发板----ADC(005)

2019-03-13 来源:eefocus

ADC的认识

1 ADC初始化参数

/* Exported types ------------------------------------------------------------*/


/**

  * @brief   ADC Init structure definition  

  */

typedef struct

{

  uint32_t ADC_Resolution;                                 /*!< Configures the ADC resolution dual mode. This parameter can be a value of @ref ADC_resolution */                                   

  FunctionalState ADC_ScanConvMode;             /*!< Specifies whether the conversion is performed in Scan (multichannels)or Single (one channel) mode.

                                                                                   This parameter can be set to ENABLE or DISABLE */

  FunctionalState ADC_ContinuousConvMode;  /*!< Specifies whether the conversion is performed in Continuous or Single mode.

                                                                                   This parameter can be set to ENABLE or DISABLE. */

  uint32_t ADC_ExternalTrigConvEdge;          /*!< Select the external trigger edge and enable the trigger of a regular group.

                                                                           This parameter can be a value of

                                                                       @ref ADC_external_trigger_edge_for_regular_channels_conversion */

  uint32_t ADC_ExternalTrigConv;                  /*!< Select the external event used to trigger the start of conversion of a regular group.

                                                                           This parameter can be a value of

                                                                       @ref ADC_extrenal_trigger_sources_for_regular_channels_conversion */

  uint32_t ADC_DataAlign;                 /*!< Specifies whether the ADC data  alignment is left or right. This parameter can be

                                                                       a value of @ref ADC_data_align */

  uint8_t  ADC_NbrOfConversion;           /*!< Specifies the number of ADC conversions  that will be done using the sequencer for

                                                                       regular channel group.This parameter must range from 1 to 16. */

}ADC_InitTypeDef;


涉及的相关参数:ADC分辨率(6/8/10/12位)、扫描或非扫描模式、连续或不连续转换、触发方式、对齐方式等。 


这里值得注意的是规则组转化序列不能超过16。


2 ADC通用初始化参数

/**

  * @brief   ADC Common Init structure definition  

  */

typedef struct

{

  uint32_t ADC_Mode;                      /*!< Configures the ADC to operate in

                                               independent or multi mode.

                                               This parameter can be a value of @ref ADC_Common_mode */                                              

  uint32_t ADC_Prescaler;                 /*!< Select the frequency of the clock

                                               to the ADC. The clock is common for all the ADCs.

                                               This parameter can be a value of @ref ADC_Prescaler */

  uint32_t ADC_DMAAccessMode;             /*!< Configures the Direct memory access

                                              mode for multi ADC mode.

                                               This parameter can be a value of

                                               @ref ADC_Direct_memory_access_mode_for_multi_mode */

  uint32_t ADC_TwoSamplingDelay;          /*!< Configures the Delay between 2 sampling phases.

                                               This parameter can be a value of

                                               @ref ADC_delay_between_2_sampling_phases */


}ADC_CommonInitTypeDef;


这里涉及相关ADC单独/多重模式选择,两采样阶段采样间隔,DMA使能/失能,ADC分屏系数(注意ADC的时钟频率不超过36Mhz)


3 ADC相关配置库函数

/*  Function used to set the ADC configuration to the default reset state *****/  

void ADC_DeInit(void);


/* Initialization and Configuration functions *********************************/

void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct);

void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);

void ADC_CommonInit(ADC_CommonInitTypeDef* ADC_CommonInitStruct);

void ADC_CommonStructInit(ADC_CommonInitTypeDef* ADC_CommonInitStruct);

void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState);


/* Analog Watchdog configuration functions ************************************/

void ADC_AnalogWatchdogCmd(ADC_TypeDef* ADCx, uint32_t ADC_AnalogWatchdog);

void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, uint16_t HighThreshold,uint16_t LowThreshold);

void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel);


/* Temperature Sensor, Vrefint and VBAT management functions ******************/

void ADC_TempSensorVrefintCmd(FunctionalState NewState);

void ADC_VBATCmd(FunctionalState NewState);


/* Regular Channels Configuration functions ***********************************/

void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);

void ADC_SoftwareStartConv(ADC_TypeDef* ADCx);

FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef* ADCx);

void ADC_EOCOnEachRegularChannelCmd(ADC_TypeDef* ADCx, FunctionalState NewState);

void ADC_ContinuousModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);

void ADC_DiscModeChannelCountConfig(ADC_TypeDef* ADCx, uint8_t Number);

void ADC_DiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);

uint16_t ADC_GetConversionValue(ADC_TypeDef* ADCx);

uint32_t ADC_GetMultiModeConversionValue(void);


/* Regular Channels DMA Configuration functions *******************************/

void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState);

void ADC_DMARequestAfterLastTransferCmd(ADC_TypeDef* ADCx, FunctionalState NewState);

void ADC_MultiModeDMARequestAfterLastTransferCmd(FunctionalState NewState);


/* Injected channels Configuration functions **********************************/

void ADC_InjectedChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);

void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, uint8_t Length);

void ADC_SetInjectedOffset(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset);

void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef* ADCx, uint32_t ADC_ExternalTrigInjecConv);

void ADC_ExternalTrigInjectedConvEdgeConfig(ADC_TypeDef* ADCx, uint32_t ADC_ExternalTrigInjecConvEdge);

void ADC_SoftwareStartInjectedConv(ADC_TypeDef* ADCx);

FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef* ADCx);

void ADC_AutoInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);

void ADC_InjectedDiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);

uint16_t ADC_GetInjectedConversionValue(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel);


/* Interrupts and flags management functions **********************************/

void ADC_ITConfig(ADC_TypeDef* ADCx, uint16_t ADC_IT, FunctionalState NewState);

FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, uint8_t ADC_FLAG);

void ADC_ClearFlag(ADC_TypeDef* ADCx, uint8_t ADC_FLAG);

ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, uint16_t ADC_IT);

void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, uint16_t ADC_IT);


推荐阅读

史海拾趣

Hilscher Gesellschaft für Systemautomation mbH公司的发展小趣事

随着技术实力的增强,HVPSI开始将目光投向国际市场。公司积极参与国际电子展会,与全球各地的客户建立联系,展示其高压电源解决方案的卓越性能。同时,HVPSI也加强了与跨国企业的合作,共同开发定制化的高压电源产品,满足特定行业的需求。这一系列举措极大地拓宽了公司的市场份额,使其在国际舞台上崭露头角。

台湾岱恩(DAIN)公司的发展小趣事

随着在高压电源领域的深入发展,HVPSI逐渐参与到行业标准的制定工作中。公司凭借其在技术上的深厚积累和市场经验,为行业标准的制定提供了宝贵的建议和数据支持。这些标准的出台不仅规范了市场秩序,也进一步巩固了HVPSI在行业内的领先地位。

Global Power Technologies Group公司的发展小趣事
在需要精确控制时间间隔的场合,如定时器、计数器等电路中,集基耦合单稳态电路可以发挥重要作用。
Arcolectric公司的发展小趣事

随着技术的不断进步和市场需求的日益多样化,Arcolectric开始积极拓展其产品线,并逐渐将产品应用于电脑、电源设备及家用电器等多个领域。公司通过不断创新和研发,成功推出了一系列符合市场需求的新产品,进一步扩大了市场份额。

Apx-Crystal公司的发展小趣事

在快速发展的同时,Apx-Crystal公司始终坚持创新驱动的发展理念。公司投入大量资金用于研发创新和技术升级,不断推出具有市场竞争力的新产品。同时,公司还注重品牌建设和市场推广,通过参加行业展会、举办技术研讨会、开展线上线下营销活动等方式,提升品牌知名度和影响力。这些举措使得Apx-Crystal在行业内树立了良好的品牌形象,成为电子元件领域的佼佼者。

敦泰(FOCALTECH)公司的发展小趣事
首先检查电源插头是否牢固插入插座,然后用万用表测量插座是否有电。如果插座有电但冰箱仍不工作,可以检查冰箱内部的电源线路是否有断路或短路现象。注意,在检查电源线路时务必断电操作,以免发生触电事故。

问答坊 | AI 解惑

一种低压程控电源的设计

摘要:随着电力电子技术的发展,将电力电子技术与自动测量技术相结合,便可以使程控电源的设计变得简单可行。介绍了一种用于自动测量的低压程控电源,实现了对电源的实时控制。 关键词:程控电源;单片机   0    引言    ...…

查看全部问答>

RF无线射频电路设计中的常见问题及设计原则

RF无线射频电路设计中的常见问题及设计原则…

查看全部问答>

09控制类的进

本帖最后由 paulhyde 于 2014-9-15 08:58 编辑 09国赛 做控制类的进这个群 74779049 我们来讨论今年 出题内容及要素  …

查看全部问答>

请问有4路24位的TTL电平信号的数据采集怎么设计和选型?

模拟信号都好采集,但是有的传感器是BCD码输出的,每个传感器的引脚是24条线输出,有4个,请问怎么设计和选型? 这里面可能要用到数据选择器或者寄存器;还有USB控制器…

查看全部问答>

用PCI芯片开发PCI接口板及相关驱动,

分到一个任务,要用PCI芯片开发PCI接口板及相关驱动, 我会点c/C++,VC++,硬件会的比较少,只会点 数模电及一些基本电路。 有点没有头绪,不知道您不能根据我的情况给我点指点,能给一个能由浅入深,循序渐进的学习过程。 谢谢,祝一切顺利! …

查看全部问答>

spi串行通信

AT89S53增加了SPI接口,对其的串行通信有什么影响, 在与PC机通信时带来了什么? 做毕业设计,我起初是用的AT98C51 先谢谢各位了…

查看全部问答>

怎样将手机的摄像头作为Wince设备的USB设备

我的手机有一个摄像头,而且可以以USB接口连接到桌面计算机上,作为摄像头使用。请问怎样在WinCE设备里也可以这样用呢?需要怎样开发相关驱动?…

查看全部问答>

★★★★★诚聘【MSP430】单片机设计工程师★★★★★

诚聘单片机设计工程师: 1,会msp430,有设计经验 2,有msp430   C语言开发经验 3,懂信号处理,会用matlab 4,最好有工作经验1年以上 电话:010-81504648 公司网站:www.safezx.com 注:工作地点北京…

查看全部问答>

VS2005调试目标机上应用程序时,用TCP/IP方式连接总是“设备未就绪”??

使用VS2005开发win ce的应用程序,在调试的时间用TCP/IP方式连接到开发板,老说“设备未就绪”,该怎么解决啊?…

查看全部问答>

请教高手,如何通过未定义指令陷阱支持协处理器的软件仿真

本人刚刚接触嵌入式开发,遇到一些问题请各位高手赐教: 1.如何通过未定义指令陷阱支持协处理器的软件仿真 2.ARM处理器如何利用未定义指令的中断机制仿真浮点向量运算…

查看全部问答>