标题: stm32串口中断接收测试程序 [打印本页]

作者: 756645036    时间: 2018-1-12 15:44
标题: stm32串口中断接收测试程序

单片机源程序如下:
  1. /**
  2.   ******************************************************************************
  3.   * @file    main.c
  4.   * @author  fire
  5.   * @version V1.0
  6.   * @date    2013-xx-xx
  7.   * @brief   串口中断接收测试
  8.   ******************************************************************************
  9.   
  10.   ******************************************************************************
  11.   */


  12. #include "stm32f10x.h"
  13. #include "bsp_usart1.h"
  14. #include "stdio.h"
  15. #include "timer4_cap.h"
  16. #include "UltrasonicWave.h"
  17. #include "delay.h"

  18. /**
  19.   * @brief  主函数
  20.   * @param  无
  21.   * @retval 无
  22.   */
  23. int main(void)
  24. {  
  25.         unsigned char count=0;
  26.         delay_init();
  27.                 /* USART1 配置模式为 115200 8-N-1,中断接收 */
  28.         USART1_Config();
  29.        
  30.         NVIC_Configuration();
  31.   
  32.         TIM4_Cap_Init(0xffff,72-1); //以1Mhz的频率计数

  33.   UltrasonicWave_Configuration();
  34.        
  35.         while(1)
  36.          {
  37.                 switch(count)
  38.                   {case 0:UltrasonicWave_StartMeasure();
  39.               count=1;
  40.                                       break;
  41.                          case 1:UltrasonicWave_StartMeasure2();
  42.              count=2;
  43.                                      break;       
  44.                         case 2:UltrasonicWave_StartMeasure3();
  45.              count=0;
  46.                                      break;               
  47. ……………………

  48. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
Avatar_UltrasonicWave.rar (303.38 KB, 下载次数: 32)



作者: 小灰灰qq    时间: 2018-7-22 21:47
谢谢





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1