找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2129|回復(fù): 4
打印 上一主題 下一主題
收起左側(cè)

各位大神有沒有關(guān)于液晶動態(tài)顯示數(shù)字的相關(guān)程序 求分享

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:301821 發(fā)表于 2018-4-4 08:40 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
各位大神有沒有關(guān)于液晶動態(tài)顯示數(shù)字的相關(guān)程序,給小弟參考一下呀!
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

沙發(fā)
ID:278892 發(fā)表于 2018-4-4 11:32 | 只看該作者
1602的要嗎
回復(fù)

使用道具 舉報

板凳
ID:278892 發(fā)表于 2018-4-4 11:32 | 只看該作者
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit lcden=P3^4;
sbit rs=P3^5;
sbit rw=P3^6;       
sbit dula=P2^6;
sbit wela=P2^7;
uchar table1[]="xingming:xxxxxxxxxxxx";
uchar table2[]="xuehao:11111111111  ";
void delay(uint x)
{
        uint a,b;
        for(a=x;a>0;a--)
                for(b=10;b>0;b--);
}

void delay1(uint x)
{
        uint a,b;
        for(a=x;a>0;a--)
                for(b=100;b>0;b--);
}

void write_com(uchar com)   
{
        P0=com;
        rs=0;
        lcden=0;
       
        lcden=1;
       
        lcden=0;
       
}

void write_date(uchar date)
{
        P0=date;
        rs=1;
        lcden=0;
        delay(10);
        lcden=1;
        delay(10);
        lcden=0;
       
}

void init()
{
   rw=0;
        dula=0;
        wela=0;
        write_com(0x38);   //顯示模式設(shè)置:16×2顯示,5×7點陣,8位數(shù)據(jù)接口
        delay(20);
        write_com(0x0c);   //顯示模式設(shè)置
        delay(20);
        write_com(0x07);   //顯示模式設(shè)置:光標右移,字符不移
        delay(20);
        write_com(0x01);   //清屏幕指令,將以前的顯示內(nèi)容清除
        delay(20);       
}

void main()
{
        uchar a;
        init();

        write_com(0x80);         
        delay(50);
        for(a=0;a<18;a++)
        {
        write_date(table1[a]);
        delay(40);               
        }

        write_com(0x80+0x40);
        delay(50);
        for(a=0;a<18;a++)
        {
        write_date(table2[a]);
        delay(40);               
        }

        for(a=0;a<16;a++)
        {
                write_com(0x18); //左移
                delay1(1000);
        }
        while(1);
}
回復(fù)

使用道具 舉報

地板
ID:278892 發(fā)表于 2018-4-4 11:34 | 只看該作者
1602


#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit lcden=P3^4;
sbit rs=P3^5;
sbit rw=P3^6;       
sbit dula=P2^6;
sbit wela=P2^7;
uchar table1[]="xingming:xxxxxxxxxxxx";
uchar table2[]="xuehao:11111111111  ";
void delay(uint x)
{
        uint a,b;
        for(a=x;a>0;a--)
                for(b=10;b>0;b--);
}

void delay1(uint x)
{
        uint a,b;
        for(a=x;a>0;a--)
                for(b=100;b>0;b--);
}

void write_com(uchar com)   
{
        P0=com;
        rs=0;
        lcden=0;
       
        lcden=1;
       
        lcden=0;
       
}

void write_date(uchar date)
{
        P0=date;
        rs=1;
        lcden=0;
        delay(10);
        lcden=1;
        delay(10);
        lcden=0;
       
}

void init()
{
   rw=0;
        dula=0;
        wela=0;
        write_com(0x38);   //顯示模式設(shè)置:16×2顯示,5×7點陣,8位數(shù)據(jù)接口
        delay(20);
        write_com(0x0c);   //顯示模式設(shè)置
        delay(20);
        write_com(0x07);   //顯示模式設(shè)置:光標右移,字符不移
        delay(20);
        write_com(0x01);   //清屏幕指令,將以前的顯示內(nèi)容清除
        delay(20);       
}

void main()
{
        uchar a;
        init();

        write_com(0x80);         
        delay(50);
        for(a=0;a<18;a++)
        {
        write_date(table1[a]);
        delay(40);               
        }

        write_com(0x80+0x40);
        delay(50);
        for(a=0;a<18;a++)
        {
        write_date(table2[a]);
        delay(40);               
        }

        for(a=0;a<16;a++)
        {
                write_com(0x18); //左移
                delay1(1000);
        }
        while(1);
}
回復(fù)

使用道具 舉報

5#
ID:301821 發(fā)表于 2018-4-5 10:56 | 只看該作者
qq347336987 發(fā)表于 2018-4-4 11:32
#include
#define uchar unsigned char
#define uint unsigned int

謝謝
回復(fù)

使用道具 舉報

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

本版積分規(guī)則

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

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

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