【STM32】STM32学习笔记-ADC单通道 ADC多通道(22)

00. 目录

文章目录

    • 00. 目录
    • 01. ADC简介
    • 02. ADC相关API
      • 2.1 RCC_ADCCLKConfig
      • 2.2 ADC_RegularChannelConfig
      • 2.3 ADC_Init
      • 2.4 ADC_InitTypeDef
      • 2.5 ADC_Cmd
      • 2.6 ADC_ResetCalibration
      • 2.7 ADC_GetResetCalibrationStatus
      • 2.8 ADC_StartCalibration
      • 2.9 ADC_GetCalibrationStatus
      • 2.10 ADC_SoftwareStartConvCmd
      • 2.11 ADC_GetFlagStatus
      • 2.12 ADC_GetConversionValue
    • 03. ADC单通道接线图
    • 04. ADC单通道示例
    • 05. ADC多通道接线图
    • 06. 热敏传感器
    • 07. 光敏传感器
    • 08. 反射式红外传感器
    • 09. ADC多通道示例
    • 10. 程序下载
    • 11. 附录

01. ADC简介

小容量产品是指闪存存储器容量在16K至32K字节之间的STM32F101xx、STM32F102xx和STM32F103xx微控制器。

中容量产品是指闪存存储器容量在64K至128K字节之间的STM32F101xx、STM32F102xx和STM32F103xx微控制器。

大容量产品是指闪存存储器容量在256K至512K字节之间的STM32F101xx和STM32F103xx微控制器。

互联型产品是指STM32F105xx和STM32F107xx微控制器。

12位ADC是一种逐次逼近型模拟数字转换器。它有多达18个通道,可测量16个外部和2个内部信号源。各通道的A/D转换可以单次、连

续、扫描或间断模式执行。ADC的结果可以左对齐或右对齐方式存储在16位数据寄存器中。

模拟看门狗特性允许应用程序检测输入电压是否超出用户定义的高/低阀值。

ADC的输入时钟不得超过14MHz,它是由PCLK2经分频产生。

02. ADC相关API

2.1 RCC_ADCCLKConfig

/*** @brief  Configures the ADC clock (ADCCLK).* @param  RCC_PCLK2: defines the ADC clock divider. This clock is derived from *   the APB2 clock (PCLK2).*   This parameter can be one of the following values:*     @arg RCC_PCLK2_Div2: ADC clock = PCLK2/2*     @arg RCC_PCLK2_Div4: ADC clock = PCLK2/4*     @arg RCC_PCLK2_Div6: ADC clock = PCLK2/6*     @arg RCC_PCLK2_Div8: ADC clock = PCLK2/8* @retval None*/
void RCC_ADCCLKConfig(uint32_t RCC_PCLK2)
功能:设置 ADC 时钟(ADCCLK)
参数:RCC_ADCCLKSource: 定义 ADCCLK,该时钟源自 APB2 时钟(PCLK2)  
返回值:

2.2 ADC_RegularChannelConfig

/*** @brief  Configures for the selected ADC regular channel its corresponding*         rank in the sequencer and its sample time.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @param  ADC_Channel: the ADC channel to configure. *   This parameter can be one of the following values:*     @arg ADC_Channel_0: ADC Channel0 selected*     @arg ADC_Channel_1: ADC Channel1 selected*     @arg ADC_Channel_2: ADC Channel2 selected*     @arg ADC_Channel_3: ADC Channel3 selected*     @arg ADC_Channel_4: ADC Channel4 selected*     @arg ADC_Channel_5: ADC Channel5 selected*     @arg ADC_Channel_6: ADC Channel6 selected*     @arg ADC_Channel_7: ADC Channel7 selected*     @arg ADC_Channel_8: ADC Channel8 selected*     @arg ADC_Channel_9: ADC Channel9 selected*     @arg ADC_Channel_10: ADC Channel10 selected*     @arg ADC_Channel_11: ADC Channel11 selected*     @arg ADC_Channel_12: ADC Channel12 selected*     @arg ADC_Channel_13: ADC Channel13 selected*     @arg ADC_Channel_14: ADC Channel14 selected*     @arg ADC_Channel_15: ADC Channel15 selected*     @arg ADC_Channel_16: ADC Channel16 selected*     @arg ADC_Channel_17: ADC Channel17 selected* @param  Rank: The rank in the regular group sequencer. This parameter must be between 1 to 16.* @param  ADC_SampleTime: The sample time value to be set for the selected channel. *   This parameter can be one of the following values:*     @arg ADC_SampleTime_1Cycles5: Sample time equal to 1.5 cycles*     @arg ADC_SampleTime_7Cycles5: Sample time equal to 7.5 cycles*     @arg ADC_SampleTime_13Cycles5: Sample time equal to 13.5 cycles*     @arg ADC_SampleTime_28Cycles5: Sample time equal to 28.5 cycles	*     @arg ADC_SampleTime_41Cycles5: Sample time equal to 41.5 cycles	*     @arg ADC_SampleTime_55Cycles5: Sample time equal to 55.5 cycles	*     @arg ADC_SampleTime_71Cycles5: Sample time equal to 71.5 cycles	*     @arg ADC_SampleTime_239Cycles5: Sample time equal to 239.5 cycles	* @retval None*/
void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
功能:设置指定 ADC 的规则组通道,设置它们的转化顺序和采样时间
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2ADC_Channel:被设置的 ADC 通道Rank:规则组采样顺序。取值范围 116。ADC_SampleTime:指定 ADC 通道的采样时间值    
返回值:

2.3 ADC_Init

/*** @brief  Initializes the ADCx peripheral according to the specified parameters*         in the ADC_InitStruct.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @param  ADC_InitStruct: pointer to an ADC_InitTypeDef structure that contains*         the configuration information for the specified ADC peripheral.* @retval None*/
void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct)
功能:根据 ADC_InitStruct 中指定的参数初始化外设 ADCx 的寄存器
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2ADC_InitStruct:指向结构 ADC_InitTypeDef 的指针,包含了指定外设 ADC 的配置信息  
返回值:

2.4 ADC_InitTypeDef

/** * @brief  ADC Init structure definition  */typedef struct
{uint32_t ADC_Mode;                      /*!< Configures the ADC to operate in independent ordual mode. This parameter can be a value of @ref ADC_mode */FunctionalState ADC_ScanConvMode;       /*!< Specifies whether the conversion is performed inScan (multichannels) or Single (one channel) mode.This parameter can be set to ENABLE or DISABLE */FunctionalState ADC_ContinuousConvMode; /*!< Specifies whether the conversion is performed inContinuous or Single mode.This parameter can be set to ENABLE or DISABLE. */uint32_t ADC_ExternalTrigConv;          /*!< Defines the external trigger used to start the analogto digital conversion of regular channels. This parametercan be a value of @ref ADC_external_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_NbrOfChannel;               /*!< Specifies the number of ADC channels that will be convertedusing the sequencer for regular channel group.This parameter must range from 1 to 16. */
}ADC_InitTypeDef;

ADC_mode

/** @defgroup ADC_mode * @{*/#define ADC_Mode_Independent                       ((uint32_t)0x00000000)
#define ADC_Mode_RegInjecSimult                    ((uint32_t)0x00010000)
#define ADC_Mode_RegSimult_AlterTrig               ((uint32_t)0x00020000)
#define ADC_Mode_InjecSimult_FastInterl            ((uint32_t)0x00030000)
#define ADC_Mode_InjecSimult_SlowInterl            ((uint32_t)0x00040000)
#define ADC_Mode_InjecSimult                       ((uint32_t)0x00050000)
#define ADC_Mode_RegSimult                         ((uint32_t)0x00060000)
#define ADC_Mode_FastInterl                        ((uint32_t)0x00070000)
#define ADC_Mode_SlowInterl                        ((uint32_t)0x00080000)
#define ADC_Mode_AlterTrig                         ((uint32_t)0x00090000)

ADC_ExternalTrigConv

/** @defgroup ADC_external_trigger_sources_for_regular_channels_conversion * @{*/#define ADC_ExternalTrigConv_T1_CC1                ((uint32_t)0x00000000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T1_CC2                ((uint32_t)0x00020000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T2_CC2                ((uint32_t)0x00060000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T3_TRGO               ((uint32_t)0x00080000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_T4_CC4                ((uint32_t)0x000A0000) /*!< For ADC1 and ADC2 */
#define ADC_ExternalTrigConv_Ext_IT11_TIM8_TRGO    ((uint32_t)0x000C0000) /*!< For ADC1 and ADC2 */#define ADC_ExternalTrigConv_T1_CC3                ((uint32_t)0x00040000) /*!< For ADC1, ADC2 and ADC3 */
#define ADC_ExternalTrigConv_None                  ((uint32_t)0x000E0000) /*!< For ADC1, ADC2 and ADC3 */#define ADC_ExternalTrigConv_T3_CC1                ((uint32_t)0x00000000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T2_CC3                ((uint32_t)0x00020000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T8_CC1                ((uint32_t)0x00060000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T8_TRGO               ((uint32_t)0x00080000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T5_CC1                ((uint32_t)0x000A0000) /*!< For ADC3 only */
#define ADC_ExternalTrigConv_T5_CC3                ((uint32_t)0x000C0000) /*!< For ADC3 only */

ADC_data_align

/** @defgroup ADC_data_align * @{*/#define ADC_DataAlign_Right                        ((uint32_t)0x00000000)
#define ADC_DataAlign_Left                         ((uint32_t)0x00000800)

2.5 ADC_Cmd

/*** @brief  Enables or disables the specified ADC peripheral.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @param  NewState: new state of the ADCx peripheral.*   This parameter can be: ENABLE or DISABLE.* @retval None*/
void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState)
功能:使能或者失能指定的 ADC
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2NewState:外设 ADCx 的新状态  
返回值:

2.6 ADC_ResetCalibration

/*** @brief  Resets the selected ADC calibration registers.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @retval None*/
void ADC_ResetCalibration(ADC_TypeDef* ADCx)
功能:重置指定的 ADC 的校准寄存器
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2 
返回值:

2.7 ADC_GetResetCalibrationStatus

/*** @brief  Gets the selected ADC reset calibration registers status.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @retval The new state of ADC reset calibration registers (SET or RESET).*/
FlagStatus ADC_GetResetCalibrationStatus(ADC_TypeDef* ADCx)
功能:获取 ADC 重置校准寄存器的状态
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2 
返回值:ADC 重置校准寄存器的新状态(SET 或者 RESET)    

2.8 ADC_StartCalibration

/*** @brief  Starts the selected ADC calibration process.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @retval None*/
void ADC_StartCalibration(ADC_TypeDef* ADCx)
功能:开始指定 ADC 的校准状态
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2 
返回值:

2.9 ADC_GetCalibrationStatus

/*** @brief  Gets the selected ADC calibration status.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @retval The new state of ADC calibration (SET or RESET).*/
FlagStatus ADC_GetCalibrationStatus(ADC_TypeDef* ADCx)
功能:获取指定 ADC 的校准程序状态
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2 
返回值:ADC 校准的新状态(SET 或者 RESET)    

2.10 ADC_SoftwareStartConvCmd

/*** @brief  Enables or disables the selected ADC software start conversion .* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @param  NewState: new state of the selected ADC software start conversion.*   This parameter can be: ENABLE or DISABLE.* @retval None*/
void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
功能:使能或者失能指定的 ADC 的软件转换启动功能
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2 NewState:指定 ADC 的软件转换启动新状态    
返回值:

2.11 ADC_GetFlagStatus

/*** @brief  Checks whether the specified ADC flag is set or not.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @param  ADC_FLAG: specifies the flag to check. *   This parameter can be one of the following values:*     @arg ADC_FLAG_AWD: Analog watchdog flag*     @arg ADC_FLAG_EOC: End of conversion flag*     @arg ADC_FLAG_JEOC: End of injected group conversion flag*     @arg ADC_FLAG_JSTRT: Start of injected group conversion flag*     @arg ADC_FLAG_STRT: Start of regular group conversion flag* @retval The new state of ADC_FLAG (SET or RESET).*/
FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, uint8_t ADC_FLAG)
功能:检查制定 ADC 标志位置 1 与否
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2 ADC_FLAG:指定需检查的标志位    
返回值:ADC状态(SET 或者 RESET)       

2.12 ADC_GetConversionValue

/*** @brief  Returns the last ADCx conversion result data for regular channel.* @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.* @retval The Data conversion value.*/
uint16_t ADC_GetConversionValue(ADC_TypeDef* ADCx)
功能:返回最近一次 ADCx 规则组的转换结果
参数:ADCx:x 可以是 1 或者 2 来选择 ADC 外设 ADC1 或 ADC2   
返回值:转换结果         

03. ADC单通道接线图

在这里插入图片描述

04. ADC单通道示例

单次转换,非扫描模式

adc.h

#ifndef __ADC_H__
#define __ADC_H__#include "stm32f10x.h"                  // Device headervoid adc_init(void);uint16_t adc_getvalue(void);#endif /*__ADC_H__*/

adc.c

#include "adc.h"void adc_init(void)
{GPIO_InitTypeDef GPIO_InitStructure;ADC_InitTypeDef ADC_InitStruct;//开启ADC时钟  PA0 --> ADC1_0RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);//开启GPIOA的时钟RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//设置为6分频  72M / 6 = 12M RCC_ADCCLKConfig(RCC_PCLK2_Div6);//GPIO配置 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;GPIO_InitStructure.GPIO_Speed =   GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStructure);//ADC配置ADC_InitStruct.ADC_ContinuousConvMode = DISABLE;ADC_InitStruct.ADC_ScanConvMode = DISABLE;ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right;ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;ADC_InitStruct.ADC_Mode = ADC_Mode_Independent;ADC_InitStruct.ADC_NbrOfChannel = 1;ADC_Init(ADC1, &ADC_InitStruct);ADC_RegularChannelConfig(ADC1, ADC_Channel_0, 1, ADC_SampleTime_55Cycles5);//使能ADCADC_Cmd(ADC1, ENABLE);//校准ADCADC_ResetCalibration(ADC1);while(ADC_GetResetCalibrationStatus(ADC1));ADC_StartCalibration(ADC1);while(ADC_GetCalibrationStatus(ADC1));}uint16_t adc_getvalue(void)
{ADC_SoftwareStartConvCmd(ADC1, ENABLE);while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) != SET);return ADC_GetConversionValue(ADC1);
}

main.c

#include "stm32f10x.h"#include "delay.h"
#include "oled.h"
#include "adc.h"int main(void){	uint16_t value = 0;float volate = 0;//初始化OLED_Init();adc_init();//显示字符串OLED_ShowString(1, 1, "ADCValue: ");OLED_ShowString(2, 1, "Volate:0.00V");while(1){value = adc_getvalue();volate = (float)value / 4095 * 3.3;OLED_ShowNum(1, 10, value, 4);OLED_ShowNum(2, 8, volate, 1);		 OLED_ShowNum(2, 10, (uint16_t)(volate * 100) % 100, 2);	delay_ms(100);}}

连续转换,非扫描模式

adc.h

#ifndef __ADC_H__
#define __ADC_H__#include "stm32f10x.h"                  // Device headervoid adc_init(void);uint16_t adc_getvalue(void);#endif /*__ADC_H__*/

adc.c

#include "adc.h"void adc_init(void)
{GPIO_InitTypeDef GPIO_InitStructure;ADC_InitTypeDef ADC_InitStruct;//开启ADC时钟  PA0 --> ADC1_0RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);//开启GPIOA的时钟RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//设置为6分频  72M / 6 = 12M RCC_ADCCLKConfig(RCC_PCLK2_Div6);//GPIO配置 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;GPIO_InitStructure.GPIO_Speed =   GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStructure);//ADC配置ADC_InitStruct.ADC_ContinuousConvMode = ENABLE; //连续转换模式ADC_InitStruct.ADC_ScanConvMode = DISABLE;ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right;ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;ADC_InitStruct.ADC_Mode = ADC_Mode_Independent;ADC_InitStruct.ADC_NbrOfChannel = 1;ADC_Init(ADC1, &ADC_InitStruct);ADC_RegularChannelConfig(ADC1, ADC_Channel_0, 1, ADC_SampleTime_55Cycles5);//使能ADCADC_Cmd(ADC1, ENABLE);//校准ADCADC_ResetCalibration(ADC1);while(ADC_GetResetCalibrationStatus(ADC1));ADC_StartCalibration(ADC1);while(ADC_GetCalibrationStatus(ADC1));//启动一次转换即可ADC_SoftwareStartConvCmd(ADC1, ENABLE);}uint16_t adc_getvalue(void)
{while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) != SET);return ADC_GetConversionValue(ADC1);
}

main.c

#include "stm32f10x.h"#include "delay.h"
#include "oled.h"
#include "adc.h"int main(void){	uint16_t value = 0;float volate = 0;//初始化OLED_Init();adc_init();//显示字符串OLED_ShowString(1, 1, "ADCValue: ");OLED_ShowString(2, 1, "Volate:0.00V");while(1){value = adc_getvalue();volate = (float)value / 4095 * 3.3;OLED_ShowNum(1, 10, value, 4);OLED_ShowNum(2, 8, volate, 1);		 OLED_ShowNum(2, 10, (uint16_t)(volate * 100) % 100, 2);	delay_ms(100);} }

05. ADC多通道接线图

在这里插入图片描述

06. 热敏传感器

在这里插入图片描述

07. 光敏传感器

在这里插入图片描述

08. 反射式红外传感器

在这里插入图片描述

09. ADC多通道示例

adc.h

#ifndef __ADC_H__
#define __ADC_H__#include "stm32f10x.h"                  // Device headervoid adc_init(void);uint16_t adc_getvalue(uint8_t ADC_Channel);#endif /*__ADC_H__*/

adc.c

#include "adc.h"void adc_init(void)
{GPIO_InitTypeDef GPIO_InitStructure;ADC_InitTypeDef ADC_InitStruct;//开启ADC时钟  PA0 --> ADC1_0RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);//开启GPIOA的时钟RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//设置为6分频  72M / 6 = 12M RCC_ADCCLKConfig(RCC_PCLK2_Div6);//GPIO配置 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;GPIO_InitStructure.GPIO_Speed =   GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStructure);//ADC配置ADC_InitStruct.ADC_ContinuousConvMode = DISABLE; ADC_InitStruct.ADC_ScanConvMode = DISABLE;ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right;ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;ADC_InitStruct.ADC_Mode = ADC_Mode_Independent;ADC_InitStruct.ADC_NbrOfChannel = 1;ADC_Init(ADC1, &ADC_InitStruct);//使能ADCADC_Cmd(ADC1, ENABLE);//校准ADCADC_ResetCalibration(ADC1);while(ADC_GetResetCalibrationStatus(ADC1));ADC_StartCalibration(ADC1);while(ADC_GetCalibrationStatus(ADC1));}uint16_t adc_getvalue(uint8_t ADC_Channel)
{ADC_RegularChannelConfig(ADC1, ADC_Channel, 1, ADC_SampleTime_55Cycles5);ADC_SoftwareStartConvCmd(ADC1, ENABLE);while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) != SET);return ADC_GetConversionValue(ADC1);
}

main.c

#include "stm32f10x.h"#include "delay.h"
#include "oled.h"
#include "adc.h"int main(void){	uint16_t ad0 = 0;uint16_t ad1 = 0;uint16_t ad2 = 0;uint16_t ad3 = 0;float volate = 0;//初始化OLED_Init();adc_init();//显示字符串OLED_ShowString(1, 1, "AD0: ");OLED_ShowString(2, 1, "AD1: ");OLED_ShowString(3, 1, "AD2: ");OLED_ShowString(4, 1, "AD3: ");while(1){ad0 = adc_getvalue(ADC_Channel_0);ad1 = adc_getvalue(ADC_Channel_1);ad2 = adc_getvalue(ADC_Channel_2);ad3 = adc_getvalue(ADC_Channel_3);		 OLED_ShowNum(1, 5, ad0, 4);OLED_ShowNum(2, 5, ad1, 4);OLED_ShowNum(3, 5, ad2, 4);OLED_ShowNum(4, 5, ad3, 4);		 delay_ms(100);}}

10. 程序下载

16-ADC单通道连续转换.rar

17-ADC单通道单次转换.rar

18-ADC多通道.rar

11. 附录

参考: 【STM32】江科大STM32学习笔记汇总

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/600935.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

197.【2023年华为OD机试真题(C卷)】执行时长(模拟题-JavaPythonC++JS实现)

🚀点击这里可直接跳转到本专栏,可查阅顶置最新的华为OD机试宝典~ 本专栏所有题目均包含优质解题思路,高质量解题代码(Java&Python&C++&JS分别实现),详细代码讲解,助你深入学习,深度掌握! 文章目录 一. 题目-执行时长二.解题思路三.题解代码Python题解代码…

前端接收后端传的文件流并下载解决乱码问题

因项目需求手写了一个导出&#xff0c;但是前端获取时出现了乱码&#xff0c;搜到一下解决方案&#xff1a; 两种情况&#xff1a; 1.如果这个接口是get的请求&#xff1a; 后端返回文件流&#xff0c;前端可能会导出txt或者excel的时候&#xff0c;里面的中文会出现乱码文章…

java 音乐会售票平台系统Myeclipse开发mysql数据库struts2结构java编程计算机网页项目

一、源码特点 java 音乐会售票平台系统 是一套完善的web设计系统&#xff0c;对理解JSP java编程开发语言有帮助struts2框架开发mvc模式&#xff0c;系统具有完整的源代码和数据库&#xff0c;系统主要采用B/S模式开发。开发 环境为TOCAT7.0,Myeclipse8.5开发&#xff0c;数据…

【投稿优惠|优质会议】2024年材料化学与清洁能源国际学术会议(IACMCCE 2024)

【投稿优惠|优质会议】2024年材料化学与清洁能源国际学术会议(IACMCCE 2024) 2024 International Conference Environmental Engineering and Mechatronics Integration(ICEEMI 2024) 一、【会议简介】 随着全球能源需求的不断增长&#xff0c;清洁能源的研究与应用成为了国际…

三叠云流程制造ERP:构建智慧工厂,实现高效生产管理

在数字化经济的浪潮下&#xff0c;新一代信息技术快速发展&#xff0c;深度整合&#xff0c;引领了工业的创新和变革&#xff0c;推动了企业向智能化发展。解决生产管理、销售管理和技术管理等难题的关键&#xff0c;在于管理者能否及时准确地掌握企业运营信息。三叠云流程制造…

读书之深入理解ffmpeg_简单笔记2(初步)

再回看第一遍通读后的笔记&#xff0c;感觉还有很多的细节需要一一攻克,。 mp4的封装格式&#xff0c;解析方式。 flv的封装格式&#xff0c;解析方式。 ts的封装格式&#xff0c;解析方式。 第四章 封装和解封装 4.2 视频文件转flv &#xff08;头文件和文件内容&#xff0…

Django发送QQ邮件

创建一个表单&#xff0c;供用户填写他们的姓名和电子邮件、电子邮件收件人和可选的注释 创建blog/forms.py from django import formsclass EmailPostForm(forms.Form):name forms.CharField(max_length25)email forms.EmailField()to forms.EmailField()comments forms.…

【ARMv8架构系统安装PySide2】

ARMv8架构系统安装PySide2 Step1. 下载Qt资源包Step2. 配置和安装Qt5Step3. 检查Qt-5.15.2安装情况Step4. 安装PySide2所需的依赖库Step5. 下载和配置PySide2Step6. 检验PySide2是否安装成功 Step1. 下载Qt资源包 if you need the whole Qt5 (~900MB): wget http://master.qt…

密码学(一)

文章目录 前言一、Cryptographic Primitives二、Cryptographic Keys2.1 Symmetric key cryptography2.2 asymmetric key cryptography 三、Confidentiality3.1 Symmetric key encryption algorithms3.2 asymmetric key block ciphers3.3 其他 四、Integrity4.1 symmetric key s…

【C程序设计】C数组

C 语言支持数组数据结构&#xff0c;它可以存储一个固定大小的相同类型元素的顺序集合。数组是用来存储一系列数据&#xff0c;但它往往被认为是一系列相同类型的变量。 数组的声明并不是声明一个个单独的变量&#xff0c;比如 runoob0、runoob1、...、runoob99&#xff0c;而…

Python从入门到网络爬虫(文件I/O详解)

Python提供了强大而灵活的文件I/O&#xff08;输入/输出&#xff09;工具&#xff0c;能够读取、写入和处理各种文件类型。本文将深入介绍Python文件I/O的技巧和示例代码&#xff0c;帮助大家更好地理解如何在Python中处理文件。 打开文件 在Python中&#xff0c;可以使用open…

【安全篇 / FortiGuard】(7.4) ❀ 01. FortiGuard服务到期后会怎么样?❀ FortiGate 防火墙

【简介】很多企业为了网络的安全&#xff0c;都会购买FortiGuard服务&#xff0c;但是FortiGuard服务都是有期限的&#xff0c;由于各种原因&#xff0c;企业在超过服务期限后没有继续购买FortiGuard服务&#xff0c;那么会出现什么情况&#xff1f;防火墙还能继续工作吗&#…

61.网游逆向分析与插件开发-游戏增加自动化助手接口-游戏红字公告功能的逆向分析

内容来源于&#xff1a;易道云信息技术研究院VIP课 上一节内容&#xff1a;游戏公告功能的逆向分析与测试-CSDN博客 码云地址&#xff08;master分支&#xff09;&#xff1a;https://gitee.com/dye_your_fingers/sro_-ex.git 码云版本号&#xff1a;63e04cc40f649d10ba2f4f…

【卡梅德生物】制备兔单抗常见问题及解决方法

在制备兔单抗的过程中&#xff0c;可能会遇到一些常见问题&#xff0c;以下是一些可能的问题和相应的解决方法&#xff1a; 1、低抗体产量&#xff1a; 问题原因&#xff1a;免疫兔子后&#xff0c;可能出现抗体产量较低的情况。 解决方法&#xff1a;提高抗原免疫方案、增加…

参加CTF比赛不会这些技术点,过去也是当炮灰!【CTF要掌握哪些技术点】

文章目录 0.前言1. Web技术2. 逆向工程3. 密码学4. 网络分析5. 系统编程6. 二进制分析7. 密码破解8. 隐写术9. 社会工程学10. 日志分析 0.前言 很多人学了很久网络安全方面的技术出来还是找不到工作&#xff0c;这到底是为什么&#xff1f;其实是没弄清楚现在企业在网络安全方…

伦茨科技Apple Find My认证芯片-ST17H6x芯片

深圳市伦茨科技有限公司&#xff08;以下简称“伦茨科技”&#xff09;发布ST17H6x Soc平台。成为继Nordic之后全球第二家取得Apple Find My「查找」认证的芯片厂家&#xff0c;该平台提供可通过Apple Find My认证的Apple查找&#xff08;Find My&#xff09;功能集成解决方案。…

Docker网络相关操作

文章目录 网络相关操作1 网络模式1.1 bridge模式1.2 host模式1.3 Container网络模式1.4 none模式1.5 overlay网络模式1.6 macvlan网络模式 2 bridge网络2.1 通过link的方式2.2 新建bridge网络 3 none网络4 host网络5 网络命令汇总5.1 查看网络5.2 创建网络5.3 删除网络5.4 查看…

(适趣AI)Vue笔试题

&#x1f4d1;前言 本文主要是【Vue】——&#xff08;适趣AI&#xff09;Vue笔试题的文章&#xff0c;如果有什么需要改进的地方还请大佬指出⛺️ &#x1f3ac;作者简介&#xff1a;大家好&#xff0c;我是听风与他&#x1f947; ☁️博客首页&#xff1a;CSDN主页听风与他 …

C++——类型转换

在文章的开始&#xff0c;先祝大家牢大年快乐 C语言中的类型转换 在C语言中&#xff0c;如果赋值运算两边类型不同&#xff0c;则会发生类型转换。一般来说&#xff0c;C语言有两种形式的类型转换&#xff1a;隐式转换和显式转换。 隐式转换&#xff0c;就是编译器自动根据其…

YOLOv8改进 | 主干篇 | EfficientNetV2均衡缩放网络改进特征提取层

一、本文介绍 这次给大家带来的改进机制是EfficientNetV2,其在其V1版本通过均衡地缩放网络的深度、宽度和分辨率,以提高卷积神经网络的性能的基础上,又提出了一种改进的渐进式学习方法,通过在训练过程中逐步增加图像尺寸并适应性调整正则化来加快训练速度,同时保持准确性…