基于STM32的超声波测距程序


该程序是基于stm32f103zet6和HC-SR04的超声波测距程序,测距范围在4m内,通过串口通讯在串口助手上显示障碍物的距离。
资源截图
代码片段和文件信息
/**************************************************************************//**
 * @file     core_cm3.c
 * @brief    CMSIS Cortex-M3 Core Peripheral Access layer Source File
 * @version  V1.30
 * @date     30. October 2009
 *
 * @note
 * Copyright (C) 2009 ARM Limited. All rights reserved.
 *
 * @par
 * ARM Limited (ARM) is supplying this software for use with Cortex-M 
 * processor based microcontrollers.  This file can be freely distributed 
 * within development tools that are supporting such ARM based processors. 
 *
 * @par
 * THIS SOFTWARE IS PROVIDED “AS IS“.  NO WARRANTIES WHETHER EXPRESS IMPLIED
 * OR STATUTORY INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
 * ARM SHALL NOT IN ANY CIRCUMSTANCES BE LIABLE FOR SPECIAL INCIDENTAL OR
 * CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER.
 *
 ******************************************************************************/

#include 

/* define compiler specific symbols */
#if defined ( __CC_ARM   )
  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */

#elif defined ( __ICCARM__ )
  #define __ASM           __asm                                       /*!< asm keyword for IAR Compiler          */
  #define __INLINE        inline                                      /*!< inline keyword for IAR Compiler. Only avaiable in High optimization mode! */

#elif defined   (  __GNUC__  )
  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */

#elif defined   (  __TASKING__  )
  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */

#endif


/* ###################  Compiler specific Intrinsics  ########################### */

#if defined ( __CC_ARM   ) /*------------------RealView Compiler -----------------*/
/* ARM armcc specific functions */

/**
 * @brief  Return the Process Stack Pointer
 *
 * @return ProcessStackPointer
 *
 * Return the actual process stack pointer
 */
__ASM uint32_t __get_PSP(void)
{
  mrs r0 psp
  bx lr
}

/**
 * @brief  Set the Process Stack Pointer
 *
 * @param  topOfProcStack  Process Stack Pointer
 *
 * Assign the value ProcessStackPointer to the MSP 
 * (process stack pointer) Cortex processor register
 */
__ASM void __set_PSP(uint32_t topOfProcStack)
{
  msr psp r0
  bx lr
}

/**
 * @brief  Return the Main Stack Pointer
 *
 * @return Main Stack Pointer
 *
 * Return the curren

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-11-26 10:41  超声波测距程序
     目录           0  2018-11-26 10:41  超声波测距程序CORE
     文件       17273  2010-06-07 10:25  超声波测距程序COREcore_cm3.c
     文件       85714  2011-02-09 14:59  超声波测距程序COREcore_cm3.h
     文件       15503  2011-03-10 10:52  超声波测距程序COREstartup_stm32f10x_hd.s
     目录           0  2018-11-26 10:41  超声波测距程序HARDWARE
     目录           0  2018-11-26 10:41  超声波测距程序HARDWARELED
     文件         808  2018-09-05 11:38  超声波测距程序HARDWARELEDled.c
     文件         136  2018-11-04 11:06  超声波测距程序HARDWARELEDled.h
     目录           0  2018-11-26 10:41  超声波测距程序HARDWARETIMER
     文件        3178  2018-11-13 21:38  超声波测距程序HARDWARETIMER imer.c
     文件         149  2018-11-14 10:37  超声波测距程序HARDWARETIMER imer.h
     目录           0  2018-11-26 10:41  超声波测距程序OBJ
     文件      549212  2018-11-16 17:33  超声波测距程序OBJTemplate.axf
     文件        1517  2018-11-16 17:33  超声波测距程序OBJTemplate.build_log.htm
     文件       27665  2018-11-16 17:33  超声波测距程序OBJTemplate.hex
     文件       67047  2018-11-16 17:33  超声波测距程序OBJTemplate.htm
     文件        1125  2018-11-16 17:33  超声波测距程序OBJTemplate.lnp
     文件       68103  2018-11-16 17:33  超声波测距程序OBJTemplate_Template.dep
     文件        3962  2018-11-15 17:25  超声波测距程序OBJcore_cm3.crf
     文件         124  2018-11-15 17:25  超声波测距程序OBJcore_cm3.d
     文件       11320  2018-11-15 17:25  超声波测距程序OBJcore_cm3.o
     文件      349975  2018-11-15 17:25  超声波测距程序OBJdelay.crf
     文件        1689  2018-11-15 17:25  超声波测距程序OBJdelay.d
     文件      385688  2018-11-15 17:25  超声波测距程序OBJdelay.o
     文件      349547  2018-11-15 17:25  超声波测距程序OBJled.crf
     文件        1621  2018-11-15 17:25  超声波测距程序OBJled.d
     文件      382476  2018-11-15 17:25  超声波测距程序OBJled.o
     文件      354707  2018-11-16 17:33  超声波测距程序OBJmain.crf
     文件        1816  2018-11-16 17:33  超声波测距程序OBJmain.d
     文件      390000  2018-11-16 17:33  超声波测距程序OBJmain.o
............此处省略164个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)