STM32F407学习资料

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

使用心得:

STM32F4与STM32F1在ADC方面的区别:

通常,在STM32F1中需要加自动校准的程序,如下:

// 使能ADC1自动校准功能

ADC_ResetCalibration(ADC1);

//检查ADC1自校准的状态位

while(ADC_GetResetCalibrationStatus(ADC1));

//启动ADC1自校准

ADC_StartCalibration(ADC1);

//检查ADC1自校准是否结束

while(ADC_GetCalibrationStatus(ADC1));

// ADC自动校准结束---------------

然而,STM32F4中无需此程序,给出STM32F407的ADC3和DMA方式的官方程序如下:/**

****************************************************************************** * @file ADC3_DMA/main.c

* @author MCD Application Team

* @version V1.0.0

* @date 19-September-2011

* @brief Main program body

****************************************************************************** * @attention

*

* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS A T PROVIDING CUSTOMERS

* WITH CODING INFORMA TION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SA VE

* 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 INFORMA TION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

*

*

© COPYRIGHT 2011 STMicroelectronics

****************************************************************************** */

/* Includes ------------------------------------------------------------------*/

#include "stm32f4_discovery.h"

#include

/** @addtogroup STM32F4_Discovery_Peripheral_Examples

* @{

*/

/** @addtogroup ADC_ADC3_DMA

* @{

*/

/* Private typedef -----------------------------------------------------------*/

/* Private define ------------------------------------------------------------*/

#define ADC3_DR_ADDRESS ((uint32_t)0x4001224C) //ADC转换后存储内存地//址,具体在datasheet中查阅

/* Private macro -------------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/

/* Y ou can monitor the converted value by adding the variable "ADC3ConvertedV alue"

to the debugger watch window */

__IO uint16_t ADC3ConvertedV alue= 0 ; //转换的结果,由于此例程是12的//ADC,转换结果在0-0X0FFF之间

__IO uint32_t ADC3ConvertedV oltage = 0;

/* Private function prototypes -----------------------------------------------*/

/* Private functions ---------------------------------------------------------*/

void ADC3_CH12_DMA_Config(void);

/**

* @brief Main program

* @param None

* @retval None

*/

int main(void)

相关文档
最新文档