标题: TOF10120 stm32串口一直输r6# 求帮助 [打印本页]

作者: zm我我跑到我的    时间: 2019-7-22 23:19
标题: TOF10120 stm32串口一直输r6# 求帮助
/**
  ******************************************************************************
  * @file    main.c
  * @author  kevin_guo
  * @version V1.0.0
  * @date    12-15-2017
  * @brief   This file provides functions to main
  ******************************************************************************
  * @attention   
  ******************************************************************************
  */
  
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"   
#include <stm32f10x_conf.h>

#include "delay.h"
#include "usart.h"   

/* extern variables ----------------------------------------------------------*/
extern unsigned short int length_val;
extern unsigned char rxbuf[16],rxempty, rxcnt,rxflag,waitflag;
extern unsigned int timeout;
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private function ----------------------------------------------------------*/
//void BuzzerInit(voi
/
//  GPIO_InitTypeDef  GPIO_InitStructur
//
//  
//  
//  
//    RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
//    GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE
////    GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENAB
//    GPIO_PinRemapConfig(GPIO_Remap_PD01,ENABLE
//    DBGMCU_Config(DBGMCU_CR_TRACE_IOEN,DISABLE
//
//  /* Enable the GPIO Clock */
//  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE

//    /* Configure the GPIO pin */
//  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_
//  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_P
//  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MH
//  GPIO_Init(GPIOB, &GPIO_InitStructure);
//
//    GPIO_ResetBits(GPIOB, GPIO_Pin_4
////    GPIO_SetBits(GPIOB, GPIO_Pin
/
/*******************************************************************************
* Function Name  : main
* Description    : main program body
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
int main(void)
{            
    unsigned char i;
   
//    BuzzerInit(
    Delay_Init();                 
   
    Uart_Init(9600);            
        
    Send_Data_To_UART1('s');
    Send_Data_To_UART1('5');
    Send_Data_To_UART1('-');
    Send_Data_To_UART1('1');
    Send_Data_To_UART1('#');
    Delay_mS(10);
    waitflag=1;
    while(waitflag==1);
    waitflag=0;
    Delay_mS(1000);
    rxcnt=0;
    while(1)
    {
        
        Send_Data_To_UART1('r');
        Send_Data_To_UART1('6');
        Send_Data_To_UART1('#');
        timeout=10000;
        while((rxflag==0)&&(timeout--));
        
        if(rxflag)
        {
            for(i=0; i<rxcnt; i++)
            {
                if(rxbuf=='m')                {                    if(rxbuf[i+1]=='m')   
/************************END OF FILE*************************/


作者: xiaozhong1314    时间: 2019-7-23 08:47
你下面的代码就是输出r6#啊

作者: zm我我跑到我的    时间: 2019-7-23 09:44
986212146 发表于 2019-7-23 08:47
你下面的代码就是输出r6#啊

如何改让他输出距离值

作者: xiaozhong1314    时间: 2019-7-23 16:04
代码不完整啊




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