標(biāo)題:
stm32f103中斷查詢AD轉(zhuǎn)換結(jié)果的程序源碼
[打印本頁]
作者:
316998491@
時(shí)間:
2018-8-9 10:55
標(biāo)題:
stm32f103中斷查詢AD轉(zhuǎn)換結(jié)果的程序源碼
stm32f103中斷查詢AD轉(zhuǎn)換結(jié)果
單片機(jī)源程序如下:
/****************************************************************************
* Copyright (C), 2013 奮斗嵌入式工作室
*
* 本例程在 奮斗版STM32開發(fā)板V2,V2.1,V3,V5及MINI上調(diào)試通過
*
* 文件名: main.c
* 內(nèi)容簡(jiǎn)述:
*
* 演示的是3個(gè)藍(lán)色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
基于官方外設(shè)庫版本: 3.5
*
* 文件歷史:
* 版本號(hào) 日期 作者 說明
* v0.2 2011-7-28 sun68 創(chuàng)建該文件
*
*/
/* 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)
* 功 能:主函數(shù)
* 入口參數(shù):無
* 出口參數(shù):無
* 說 明:
* 調(diào)用方法:無
****************************************************************************/
int main(void)
{
RCC_Configuration( ); //系統(tǒng)時(shí)鐘配置
LED_Config( ); //LED控制配置
GPOIA_Config( );
IR_GPIO_Config( );
Key_GPIO_Config( );
ADC1_Gpio_Config( );
NVIC_Configuration( );
Exti_Configuration( );
ADC1_Configuration( );
// if ( SysTick_Config( 72000 ) ) //時(shí)鐘節(jié)拍中斷時(shí)1ms一次 用于定時(shí)
// {
// /* Capture error */
// while (1);
// }
if ( SysTick_Config( 72000 ) ) //時(shí)鐘節(jié)拍中斷時(shí)100us一次 用于定時(shí)
{
/* 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)
* 功 能:系統(tǒng)時(shí)鐘配置為72MHZ
* 入口參數(shù):無
* 出口參數(shù):無
* 說 明:
* 調(diào)用方法:無
****************************************************************************/
void RCC_Configuration(void)
{
SystemInit();
}
/****************************************************************************
* 名 稱:void Delay(__IO uint32_t nCount)
* 功 能:延時(shí)函數(shù)
* 入口參數(shù):無
* 出口參數(shù):無
* 說 明:
* 調(diào)用方法:無
****************************************************************************/
void Delay(__IO uint32_t nCount)
{
for(; nCount != 0; nCount--);
}
/******************* (C) COPYRIGHT 2013 奮斗STM32 *****END OF FILE****/
復(fù)制代碼
所有資料51hei提供下載:
STM32奮斗板-ADC中斷查詢結(jié)果.rar
(291.67 KB, 下載次數(shù): 23)
2018-8-9 16:15 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1