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

標題: 字符液晶1602 [打印本頁]

作者: 一直有個夢    時間: 2018-8-22 10:04
標題: 字符液晶1602
#include <REGX52.H>
#include "LCD1602.h"

unsigned char TempBuffer[10];
void IntToStr(unsigned int t, unsigned char *str, unsigned char n)
{
        unsigned char a[5]; char i, j;                                        
        a[0]=(t/10000)%10;         //取得整數值到數組                
        a[1]=(t/1000)%10;                                            
        a[2]=(t/100)%10;                                             
        a[3]=(t/10)%10;                                              
        a[4]=(t/1)%10;                                               

        for(i=0; i<5; i++)         //轉成ASCII碼                     
                a[i]=a[i]+'0';                                           
        for(i=0; a[i]=='0' && i<=3; i++);                            
        for(j=5-n; j<i; j++)       //填充空格                        
                { *str=' ';  str++; }                                    
        for(; i<5; i++)                                              
                { *str=a[i]; str++; }  //加入有效的數字                  
        *str='\0';
}

void Delay1ms(unsigned int count)
{
        unsigned int i,j;
        for(i=0;i<count;i++)
        for(j=0;j<120;j++);
}

main()
{
        unsigned int Count = 0;
        LCD_Initial();
        GotoXY(0,0);
        Print("The 1602LCD Test");
        GotoXY(0,1);
        Print("GO:       by JJJ");

        while(1)
        {
                IntToStr(Count++,&TempBuffer[0],5);
                GotoXY(3,1);
                Print(&TempBuffer[0]);
                Delay1ms(100);
        }
}


字符液晶1602.zip

19.04 KB, 下載次數: 4, 下載積分: 黑幣 -5






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