找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3128|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

stm32f103中斷查詢AD轉(zhuǎn)換結(jié)果的程序源碼

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:384504 發(fā)表于 2018-8-9 10:55 | 只看該作者 回帖獎勵 |倒序?yàn)g覽 |閱讀模式
stm32f103中斷查詢AD轉(zhuǎn)換結(jié)果

單片機(jī)源程序如下:
  1. /****************************************************************************
  2. * Copyright (C), 2013 奮斗嵌入式工作室
  3. *
  4. * 本例程在 奮斗版STM32開發(fā)板V2,V2.1,V3,V5及MINI上調(diào)試通過           
  5. *
  6. * 文件名: main.c
  7. * 內(nèi)容簡述:       
  8. *      
  9. *        演示的是3個藍(lán)色LED(LED1-LED3) 輪流閃爍
  10.    
  11.         定義:       
  12.         LED1-LED3 ---V6——V8
  13.         V6----- PB5-LED1
  14.         V7----- PD6-LED2(僅V2,V2.1 V3  V5板)
  15.         V8----- PD3-LED3(僅V2,V2.1 V3  V5板)
  16.    
  17.         基于MDK版本:        3.8
  18.         基于官方外設(shè)庫版本: 3.5
  19. *
  20. * 文件歷史:
  21. * 版本號  日期       作者    說明
  22. * v0.2    2011-7-28 sun68  創(chuàng)建該文件
  23. *
  24. */
  25. /* Includes peripheral official head ------------------------------------------------------------------*/
  26. #include "stm32f10x.h"
  27. #include "stm32f10x_exti.h"
  28. #include "stm32f10x_rcc.h"
  29. #include "stm32f10x_it.h"
  30. //#include "misc.h"
  31. /* Includes  peripheral user define head ----------------------------------------------------------------------*/
  32. #include "stm32f10x_bitband.h"
  33. #include "exti.h"
  34. #include "nvic.h"
  35. #include "systick.h"
  36. #include "gpio_config.h"
  37. #include "adc1.h"
  38. /* Includes function ----------------------------------------------------------------------*/
  39. /* Includes user head ----------------------------------------------------------------------*/
  40. #include "led.h"
  41. #include "key.h"
  42. #include "ir_recive.h"
  43. #include "bat_lowpower.h"
  44. volatile uint16_t DataValue;
  45. /* Includes function ----------------------------------------------------------------------*/
  46. void RCC_Configuration(void);
  47. void Delay(__IO uint32_t nCount);
  48. /****************************************************************************
  49. * 名    稱:int main(void)
  50. * 功    能:主函數(shù)
  51. * 入口參數(shù):無
  52. * 出口參數(shù):無
  53. * 說    明:
  54. * 調(diào)用方法:無
  55. ****************************************************************************/
  56. int main(void)
  57. {
  58.         RCC_Configuration( );                                   //系統(tǒng)時鐘配置
  59.         LED_Config( );                                                        //LED控制配置
  60.         GPOIA_Config( );
  61.         IR_GPIO_Config( );
  62.         Key_GPIO_Config( );
  63.         ADC1_Gpio_Config( );

  64.         NVIC_Configuration( );
  65.         Exti_Configuration( );
  66.         ADC1_Configuration( );
  67. //        if ( SysTick_Config( 72000 ) )                    //時鐘節(jié)拍中斷時1ms一次  用于定時
  68. //        {
  69. //                /* Capture error */
  70. //                while (1);
  71. //        }
  72.         if ( SysTick_Config( 72000 ) )                    //時鐘節(jié)拍中斷時100us一次  用于定時
  73.         {
  74.                 /* Capture error */
  75.                 while (1);
  76.         }


  77.         while ( 1 )
  78.         {
  79.                 if ( f_1ms )
  80.                 {
  81.                         f_1ms = 0;
  82.                         rx_ir( );
  83.                         ir_rx_fun( );
  84.                         key_scan( );
  85.                         blue_fliker( );
  86.                 //        BAT_lowpower( );
  87.                         ADC_SoftwareStartConvCmd(ADC1, ENABLE);
  88.                 }
  89.        
  90.         }
  91. }

  92. /****************************************************************************
  93. * 名    稱:void RCC_Configuration(void)
  94. * 功    能:系統(tǒng)時鐘配置為72MHZ
  95. * 入口參數(shù):無
  96. * 出口參數(shù):無
  97. * 說    明:
  98. * 調(diào)用方法:無
  99. ****************************************************************************/
  100. void RCC_Configuration(void)
  101. {   
  102.   SystemInit();
  103. }

  104. /****************************************************************************
  105. * 名    稱:void Delay(__IO uint32_t nCount)
  106. * 功    能:延時函數(shù)
  107. * 入口參數(shù):無
  108. * 出口參數(shù):無
  109. * 說    明:
  110. * 調(diào)用方法:無
  111. ****************************************************************************/
  112. void Delay(__IO uint32_t nCount)
  113. {
  114.    for(; nCount != 0; nCount--);
  115. }


  116. /******************* (C) COPYRIGHT 2013 奮斗STM32 *****END OF FILE****/
復(fù)制代碼

所有資料51hei提供下載:
STM32奮斗板-ADC中斷查詢結(jié)果.rar (291.67 KB, 下載次數(shù): 23)


評分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表