• 大小: 9KB
    文件类型: .c
    金币: 1
    下载: 0 次
    发布日期: 2021-05-08
  • 语言: 其他
  • 标签: 单片机  

资源简介

做毕业设计的同学注意 啦 用液晶显示测试值

资源截图

代码片段和文件信息

#include 		   
#define uint unsigned int
#define uchar unsigned char
#define ulong unsigned long
#include 
#define dataport P1

sbit    cd=P3^4;
sbit    read=P3^5;
sbit    write=P3^6;

sbit    r10k=P2^4;
sbit    r100k=P2^5;
sbit    r1m=P2^6;
sbit    r10m=P2^7;

uchar code   tab[10]={0x100x110x120x130x140x150x160x170x180x19};
uint m;
uchar    buf[8]={00000000};

void busy()
{
uchar status;
do{
cd=1;
read=0;
write=1;
_nop_();
_nop_();
_nop_();
status=dataport;
read=1;
}while(status&0x03!=0x03);
}

void write_dat(uchar dat)
{
busy();
cd=0;
read=1;
write=0;
_nop_();
_nop_();
_nop_();
dataport=dat;
write=1;
}

void write_cmd(uchar cmd)
{
busy();
cd=1;
read=1;
write=0;
_nop_();
_nop_();
_nop_();
dataport=cmd;
write=1;
}

void inityejin()
{
write_dat(0x00);
write_dat(0x00);
write_cmd(0x40);//文本首地址
write_dat(0x10);
write_dat(0x00);
write_cmd(0x41);//文本宽度
write_dat(0x00);
write_dat(0x08);
write_cmd(0x42);//图形首地址
write_dat(0x10);
write_dat(0x00);
write_cmd(0x43);//图形宽度
write_cmd(0x80);//或模式
write_cmd(0x9c);//开文本图形显示
}
uchar code table[]={
/*--  文字:  欢  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x000x800x000x800xFC0x800x050xFE0x850x040x4A0x480x280x400x100x40
0x180x400x180x600x240xA00x240x900x410x180x860x0E0x380x040x000x00

/*--  文字:  迎  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x400x000x210x800x360x7C0x240x440x040x440x040x440xE40x440x240x44
0x250x440x260x540x240x480x200x400x200x400x500x000x8F0xFE0x000x00

/*--  文字:  使  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x080x400x0C0x400x1B0xFE0x100x400x370xFC0x640x440xA40x440x270xFC
0x240x440x220x400x210x800x200x800x210x700x220x1E0x2C0x040x000x00

/*--  文字:  用  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x000x000x1F0xFC0x100x840x100x840x100x840x1F0xFC0x100x840x100x84
0x100x840x1F0xFC0x100x840x100x840x200x840x200x840x400x940x800x88

/*--  文字:     --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

/*--  文字:     --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

/*--  文字:     --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

/*--  文字:     --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x000x000

评论

共有 条评论