欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: STM32控制HMI串口屏發送指令字符串后,串口屏無響應溫度沒有改變 [打印本頁]

作者: H寶貝    時間: 2020-10-11 16:45
標題: STM32控制HMI串口屏發送指令字符串后,串口屏無響應溫度沒有改變
#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為向串口屏發送的指令
                        delay_ms(500);
                        usart_pm_end();
                        if(x==2)
                {
                        DEBUG_USARTx = USART1;
                        printf("x0.val=a10");    ////x0.val=%d為向串口屏發送的指令
                }
                }

B547E2CBD10FFDFDE66CFA7827CF0A8B.jpg (1.17 MB, 下載次數: 99)

B547E2CBD10FFDFDE66CFA7827CF0A8B.jpg

作者: guimeng    時間: 2020-10-12 15:43
               if(x==1)
                {
                        DEBUG_USARTx = USART1;
                        printf("x0.val=%d",(int)(Temperature*10));   //x0.val=%d為向串口屏發送的指令
                        usart_pm_end();
                        delay_ms(500);
                        if(x==2)
                {
                        DEBUG_USARTx = USART1;
                        //printf("x0.val=a10");    ////x0.val=%d為向串口屏發送的指令
                }
                }
作者: guimeng    時間: 2020-10-12 15:45
用串口調試助手看下你單片機發送的數據是什么




歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1