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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

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

基于c51單片機(jī)的lcd屏LM016L顯示字符的設(shè)計(jì)

[復(fù)制鏈接]
ID:339405 發(fā)表于 2018-12-5 18:08 | 顯示全部樓層 |閱讀模式
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
lcd.PNG

單片機(jī)源程序如下:
  1. #include <REGX52.H>
  2. #include "LCD1602.h"

  3. unsigned char TempBuffer[10];
  4. void IntToStr(unsigned int t, unsigned char *str, unsigned char n)
  5. {
  6.         unsigned char a[5]; char i, j;                                        
  7.         a[0]=(t/10000)%10;         //取得整數(shù)值到數(shù)組                
  8.         a[1]=(t/1000)%10;                                            
  9.         a[2]=(t/100)%10;                                             
  10.         a[3]=(t/10)%10;                                              
  11.         a[4]=(t/1)%10;                                               
  12.                                                       
  13.         for(i=0; i<5; i++)         //轉(zhuǎn)成ASCII碼                     
  14.                 a[i]=a[i]+'0';                                           
  15.         for(i=0; a[i]=='0' && i<=3; i++);                            
  16.         for(j=5-n; j<i; j++)       //填充空格                        
  17.                 { *str=' ';  str++; }                                    
  18.         for(; i<5; i++)                                              
  19.                 { *str=a[i]; str++; }  //加入有效的數(shù)字                  
  20.         *str='\0';
  21. }

  22. void Delay1ms(unsigned int count)
  23. {
  24.         unsigned int i,j;
  25.         for(i=0;i<count;i++)
  26.         for(j=0;j<120;j++);
  27. }

  28. main()
  29. {
  30.         unsigned int Count = 0;
  31.         LCD_Initial();
  32.         GotoXY(0,0);
  33.         Print("The 1602LCD Test");
  34.         GotoXY(0,1);
  35.         Print("GO:       by JJJ");

  36.         while(1)
  37.         {
  38.                 IntToStr(Count++,&TempBuffer[0],5);
  39.                 GotoXY(3,1);
  40.                 Print(&TempBuffer[0]);
  41.                 Delay1ms(100);
  42.         }
  43. }
復(fù)制代碼
0.png
所有資料51hei提供下載:
0015、字符液晶1602仿真測試.zip (74.23 KB, 下載次數(shù): 41)


回復(fù)

使用道具 舉報(bào)

ID:651220 發(fā)表于 2019-11-27 23:21 | 顯示全部樓層
程序復(fù)制下來說有錯(cuò)誤呀
回復(fù)

使用道具 舉報(bào)

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

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

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

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