1024手机基地看电影,午夜福利视频导航,国产精品福利在线一区,亚洲欧美日韩另类成人,在线观看午夜日本理论片,成年超爽免费网站,国产精品成人免费,精品动作一级毛片,成人免费观看网站,97精品伊人久久大香蕉

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 2997|回復(fù): 2
收起左側(cè)

STM32控制HMI串口屏發(fā)送指令字符串后,串口屏無(wú)響應(yīng)溫度沒(méi)有改變

[復(fù)制鏈接]
ID:824585 發(fā)表于 2020-10-11 16:45 | 顯示全部樓層 |閱讀模式
5黑幣
#include "stm32f10x.h"
#include "usart.h"
#include "delay.h"
#include "mlx90614.h"
#include "sys.h"

extern uint8_t aRxBuffer[100];
extern uint8_t aRxCounter;
extern uint8_t aReceiveState;

void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_USART_ALL_PERIPH(USARTx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable the Half-Duplex mode by setting the HDSEL bit in the CR3 register */
    USARTx->CR3 |= CR3_HDSEL_Set;
  }
  else
  {
    /* Disable the Half-Duplex mode by clearing the HDSEL bit in the CR3 register */
    USARTx->CR3 &= CR3_HDSEL_Reset;
  }
}


volatile uint8_t aRxBuffer[100]={0x00};
volatile uint8_t aRxCounter=0;
volatile uint8_t aReceiveState=0;
int main(void)
{        

  USART_Config();
//DEBUG_USARTx = USART1;
//        DEBUG_USARTx = USART2;
Temperature = SMBus_ReadTemp();
        delay_ms(500);
    while(1)
        {        
               
                                        Temperature = SMBus_ReadTemp();
        
// ′®¿ú1μÄêy¾Y

               
                if(aReceiveState==1)//èç1û½óêÕμ½1Ö¡êy¾Y
                        
                {
                        aReceiveState=0;

                        
                        if(aRxBuffer[0]=='a')
                        {

                          if(aRxBuffer[2]=='1')
                          { x=1;        }
                          else if(aRxBuffer[2]=='2')
                          { x=0;  }

                   }
                }
                                if(x==1)
                {
                        DEBUG_USARTx = USART1;
                        printf("x0.val=%d",(int)(Temperature*10));   //x0.val=%d為向串口屏發(fā)送的指令
                        delay_ms(500);
                        usart_pm_end();
                        if(x==2)
                {
                        DEBUG_USARTx = USART1;
                        printf("x0.val=a10");    ////x0.val=%d為向串口屏發(fā)送的指令
                }
                }

B547E2CBD10FFDFDE66CFA7827CF0A8B.jpg
回復(fù)

使用道具 舉報(bào)

ID:36656 發(fā)表于 2020-10-12 15:43 | 顯示全部樓層
               if(x==1)
                {
                        DEBUG_USARTx = USART1;
                        printf("x0.val=%d",(int)(Temperature*10));   //x0.val=%d為向串口屏發(fā)送的指令
                        usart_pm_end();
                        delay_ms(500);
                        if(x==2)
                {
                        DEBUG_USARTx = USART1;
                        //printf("x0.val=a10");    ////x0.val=%d為向串口屏發(fā)送的指令
                }
                }
回復(fù)

使用道具 舉報(bào)

ID:36656 發(fā)表于 2020-10-12 15:45 | 顯示全部樓層
用串口調(diào)試助手看下你單片機(jī)發(fā)送的數(shù)據(jù)是什么
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

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

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

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