| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2372 人关注过本帖
标题:LCD显示怎么用
取消只看楼主 加入收藏
kk权
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2016-5-20
结帖率:0
收藏
 问题点数:0 回复次数:0 
LCD显示怎么用
#include <reg52.h>
#define uchar unsigned char
sbit CS1=P2^0;
sbit CS2=P2^1;
sbit E=P2^2;
sbit RW=P2^3;
sbit DI=P2^4;
sbit RET=P2^5;
uchar code hanzi[2][32]={{0x80,0x90,0x8c,0x84,0x84,0xF4,0xA5,0x86,0x84,0x84,0x84,0x84,0x94,0x8C,0x84,0x00,
                          0x80,0x80,0x80,0x40,0x47,0x28,0x28,0x10,0x28,0x24,0x43,0xC0,0x40,0x00,0x00,0x00},
                        {0x90,0x48,0xE7,0x1A,0xB0,0xEE,0xA8,0xAF,0xA8,0x4E,0xF8,0x17,0x12,0xF0,0x10,0x00,
                        0x00,0x00,0xFF,0x20,0x54,0x86,0x7D,0x04,0x14,0xA4,0x40,0x27,0x1C,0xE3,0x40,0x00
                        }};
    void delay1()
    {
        uchar x,y,z;
        for(z=0;z<4;z++)
        for(x=0;x<200;x++)
        for(y=0;y<200;y++);
    }
    void wc(uchar a)
    {
        E=0;
        DI=0;
        RW=0;
        P0=a;
        E=1;
        E=0;
    }
    void wd(uchar a)
    {
        E=0;
        DI=1;
        RW=0;
        P0=a;
        E=1;
        E=0;
    }
    void tuxing1(uchar cs,uchar ye,uchar lie,uchar shu)
    {
        uchar i,t,d,f,y;
        if(cs==0)
        {
            CS2=0;
            CS1=1;
        }
        else
        {
            CS1=0;
            CS2=1;
        }
        wc(0x3f);
        wc(0xc0);
        f=0xb8+ye;
        y=0x42+lie;
      是什么意思
        for(i=0;i<2;i++)
        {
            wc(f);
            wc(y);
            for(t=0;t<16;t++)
            {
                d=hanzi[shu][t+i*16];
                wd(d);
            }
            f++;
         }
    }
    void clear()
    {
    uchar i,j,d;
    wc(0xc0);
    d=0xb8;
    for(i=0;i<8;i++)
    {
        wc(d);
        wc(0x40);
        for(j=0;j<64;j++)
        {
            wd(0x00);
        }
        d++;
        }
    }
    void INI()
    {
        RET=0;
        delay1();
        RET=1;
        CS2=0;
        CS1=1;
        wc(0x3f);
        wc(0xc0);
        clear();
        CS1=0;
        CS2=1;
        wc(0x3f);
        wc(0xc0);
        clear();
    }
    main()
    {
        uchar key,keyget;
        INI();
        tuxing1(0,2,16,0);
        tuxing1(1,2,16,1);
        while(1);
    }



搜索更多相关主题的帖子: include 
2016-09-27 20:09
快速回复:LCD显示怎么用
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017592 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved