找回密码
 立即注册

QQ登录

只需一步,快速开始

帖子
查看: 3097|回复: 0
打印 上一主题 下一主题
收起左侧

stm32f103中断查询AD转换结果的程序源码

[复制链接]
跳转到指定楼层
楼主
ID:384504 发表于 2018-8-9 10:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
stm32f103中断查询AD转换结果

单片机源程序如下:
  1. /****************************************************************************
  2. * Copyright (C), 2013 奋斗嵌入式工作室
  3. *
  4. * 本例程在 奋斗版STM32开发板V2,V2.1,V3,V5及MINI上调试通过           
  5. *
  6. * 文件名: main.c
  7. * 内容简述:       
  8. *      
  9. *        演示的是3个蓝色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.         基于官方外设库版本: 3.5
  19. *
  20. * 文件历史:
  21. * 版本号  日期       作者    说明
  22. * v0.2    2011-7-28 sun68  创建该文件
  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. * 功    能:主函数
  51. * 入口参数:无
  52. * 出口参数:无
  53. * 说    明:
  54. * 调用方法:无
  55. ****************************************************************************/
  56. int main(void)
  57. {
  58.         RCC_Configuration( );                                   //系统时钟配置
  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 ) )                    //时钟节拍中断时1ms一次  用于定时
  68. //        {
  69. //                /* Capture error */
  70. //                while (1);
  71. //        }
  72.         if ( SysTick_Config( 72000 ) )                    //时钟节拍中断时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. * 功    能:系统时钟配置为72MHZ
  95. * 入口参数:无
  96. * 出口参数:无
  97. * 说    明:
  98. * 调用方法:无
  99. ****************************************************************************/
  100. void RCC_Configuration(void)
  101. {   
  102.   SystemInit();
  103. }

  104. /****************************************************************************
  105. * 名    称:void Delay(__IO uint32_t nCount)
  106. * 功    能:延时函数
  107. * 入口参数:无
  108. * 出口参数:无
  109. * 说    明:
  110. * 调用方法:无
  111. ****************************************************************************/
  112. void Delay(__IO uint32_t nCount)
  113. {
  114.    for(; nCount != 0; nCount--);
  115. }


  116. /******************* (C) COPYRIGHT 2013 奋斗STM32 *****END OF FILE****/
复制代码

所有资料51hei提供下载:
STM32奋斗板-ADC中断查询结果.rar (291.67 KB, 下载次数: 23)


评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表