标题:
stm32f103中断查询AD转换结果的程序源码
[打印本页]
作者:
316998491@
时间:
2018-8-9 10:55
标题:
stm32f103中断查询AD转换结果的程序源码
stm32f103中断查询AD转换结果
单片机源程序如下:
/****************************************************************************
* Copyright (C), 2013 奋斗嵌入式工作室
*
* 本例程在 奋斗版STM32开发板V2,V2.1,V3,V5及MINI上调试通过
*
* 文件名: main.c
* 内容简述:
*
* 演示的是3个蓝色LED(LED1-LED3) 轮流闪烁
定义:
LED1-LED3 ---V6——V8
V6----- PB5-LED1
V7----- PD6-LED2(仅V2,V2.1 V3 V5板)
V8----- PD3-LED3(仅V2,V2.1 V3 V5板)
基于MDK版本: 3.8
基于官方外设库版本: 3.5
*
* 文件历史:
* 版本号 日期 作者 说明
* v0.2 2011-7-28 sun68 创建该文件
*
*/
/* Includes peripheral official head ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "stm32f10x_exti.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_it.h"
//#include "misc.h"
/* Includes peripheral user define head ----------------------------------------------------------------------*/
#include "stm32f10x_bitband.h"
#include "exti.h"
#include "nvic.h"
#include "systick.h"
#include "gpio_config.h"
#include "adc1.h"
/* Includes function ----------------------------------------------------------------------*/
/* Includes user head ----------------------------------------------------------------------*/
#include "led.h"
#include "key.h"
#include "ir_recive.h"
#include "bat_lowpower.h"
volatile uint16_t DataValue;
/* Includes function ----------------------------------------------------------------------*/
void RCC_Configuration(void);
void Delay(__IO uint32_t nCount);
/****************************************************************************
* 名 称:int main(void)
* 功 能:主函数
* 入口参数:无
* 出口参数:无
* 说 明:
* 调用方法:无
****************************************************************************/
int main(void)
{
RCC_Configuration( ); //系统时钟配置
LED_Config( ); //LED控制配置
GPOIA_Config( );
IR_GPIO_Config( );
Key_GPIO_Config( );
ADC1_Gpio_Config( );
NVIC_Configuration( );
Exti_Configuration( );
ADC1_Configuration( );
// if ( SysTick_Config( 72000 ) ) //时钟节拍中断时1ms一次 用于定时
// {
// /* Capture error */
// while (1);
// }
if ( SysTick_Config( 72000 ) ) //时钟节拍中断时100us一次 用于定时
{
/* Capture error */
while (1);
}
while ( 1 )
{
if ( f_1ms )
{
f_1ms = 0;
rx_ir( );
ir_rx_fun( );
key_scan( );
blue_fliker( );
// BAT_lowpower( );
ADC_SoftwareStartConvCmd(ADC1, ENABLE);
}
}
}
/****************************************************************************
* 名 称:void RCC_Configuration(void)
* 功 能:系统时钟配置为72MHZ
* 入口参数:无
* 出口参数:无
* 说 明:
* 调用方法:无
****************************************************************************/
void RCC_Configuration(void)
{
SystemInit();
}
/****************************************************************************
* 名 称:void Delay(__IO uint32_t nCount)
* 功 能:延时函数
* 入口参数:无
* 出口参数:无
* 说 明:
* 调用方法:无
****************************************************************************/
void Delay(__IO uint32_t nCount)
{
for(; nCount != 0; nCount--);
}
/******************* (C) COPYRIGHT 2013 奋斗STM32 *****END OF FILE****/
复制代码
所有资料51hei提供下载:
STM32奋斗板-ADC中断查询结果.rar
(291.67 KB, 下载次数: 23)
2018-8-9 16:15 上传
点击文件名下载附件
下载积分: 黑币 -5
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1