標題: 單片機新手求助LCD1602顯示了亂碼 [打印本頁]

作者: 黃黃黃晃晃    時間: 2022-5-4 19:51
標題: 單片機新手求助LCD1602顯示了亂碼
入手了HX711和52RC以及LCD想做一個小電子秤,結(jié)果在顯示k=后面跳出了亂碼。求大佬幫忙怎么解決.
此處代碼

if( KEY1 == 0 && KEY2 ==0)
    {
           unsigned      int x1;
      unsigned        int x2;
      unsigned        int x3;
      unsigned        int x;
      
   
        Delay_ms(25);
        if( KEY1 == 0 && KEY2 ==0)
        {
            times=0;
            Buzzer =0;
            Delay_ms(25);
            Buzzer =1;
            
            x=0;
            x1=50;
            x2=10;
        
        if(Weight_Shiwu>0)
            
            {
               
                x3=x1/x2;
               
            }
            
            LCD1602_write_com(0x80+0x40+11);
            LCD1602_write_word("K=");
            LCD1602_write_data(x3+0);
      
        }   
    }



51hei圖片_20220504195001.jpg (559.21 KB, 下載次數(shù): 30)

51hei圖片_20220504195001.jpg

作者: wulin    時間: 2022-5-5 06:59
LCD1602_write_data(x3+'0');
作者: 人人學會單片機    時間: 2022-5-5 08:47
http://www.torrancerestoration.com/bbs/dpj-205768-1.html
LCD1602液晶最新資料 說明了具體的時間要求
作者: man1234567    時間: 2022-5-5 11:20
1、不貼全程序,猜不準;
2、無注釋,也搞不懂你想顯示啥。
作者: 張明211    時間: 2022-5-5 14:41
不需要的空間,寫成空字符!
作者: zhxiufan    時間: 2022-5-5 15:57
LCD1602_write_data(x3+0);改為
LCD1602_write_data(x3+0x30);當然要保證X3小于10
作者: w1179benp    時間: 2022-5-5 20:22
猜想lz想在最后顯示的是:“K=5kg”




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