⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yj12864.c

📁 液晶显示程序
💻 C
字号:
#include<reg51.h>
#include<stdio.h>
#include"SHUZU.H"
//#include"dushu.h"


unsigned char xdata *di;
unsigned char n1,n2,n3,n4,y1,y2,r1,r2,x1,s1,s2,f1,f2,m1,m2,d1;

sbit cs1=P3^1;
sbit cs2=P3^2;
sbit e=P3^4;
sbit rw=P3^5;
sbit d=P3^6;


delay(unsigned int w)
{
 unsigned int i,j;
 for(i=w;i>0;i--)
  for(j=10;j>0;j--);
}

writem(unsigned char x)
{
 e=1;
 rw=0;
 d=0;
 P0=x;
 e=0;
}

writes(unsigned char y)
{
 e=1;
 rw=0;
 d=1;
 P0=y;
 e=0;
}

cleanout()
{
 unsigned char i,j,h;
 cs1=1;
 cs2=0;
 for(h=2;h>0;h--)
 {
  writem(0x3f);
  for(i=0xb8;i<=0xbf;i++)
  {
    writem(i);
    writem(0x40);
    for(j=64;j>0;j--)
     writes(0x00);
  }
  cs1=0;
  cs2=1;
 }
  cs1=1;
  cs2=1;
}


chushihua()
{
 cs1=0;
 cs2=0;
 writem(0x3f);
 cleanout();
}

datat(unsigned char w,unsigned char x,unsigned char y)
{
 unsigned char i,j;
  writem(x);
  writem(y);
  for(j=2;j>0;j--){
 for(i=w;i<w+16;i++)
  {
   writes(a1[i]);
  }
   x++;
   writem(x);
   writem(y);
   w=w+16;
  }
}
datas(unsigned char w,unsigned char x,unsigned char y)
{
 unsigned char i,j,k,h;
  k=w;
  h=0;
  writem(x);
  writem(y);
  for(j=2;j>0;j--){
 for(i=h;i<h+8;i++)
  {
   writes(s[k][i]);
  }
   x++;
   writem(x);
   writem(y);
   h=h+8;
  }
}

xian()
{
  cs1=0;
  cs2=1;
 datas(n1,0xb8,0x40);delay(1);
 datas(n2,0xb8,0x48);delay(1);
 datas(n3,0xb8,0x50);delay(1);
 datas(n4,0xb8,0x58);delay(1);
 datat(0,0xb8,0x60); delay(1);    //年
 datas(y1,0xb8,0x70);delay(1);
 datas(y2,0xb8,0x78);delay(1);
 cs1=1;cs2=0;
 datat(32,0xb8,0x40); delay(1);   //月
 datas(r1,0xb8,0x50);delay(1);
 datas(r2,0xb8,0x58);delay(1);
 datat(64,0xb8,0x60); delay(1);   //日
 cs1=0;
 cs2=1;
 datat(96,0xba,0x40); delay(1);   //星
 datat(128,0xba,0x50); delay(1);  //期
 datas(x1,0xba,0x68);delay(1);
 datas(s1,0xbc,0x40);delay(1);
 datas(s2,0xbc,0x48);delay(1);
 datas(f1,0xbc,0x58);delay(1);
 datas(f2,0xbc,0x60);delay(1);
 datas(m1,0xbc,0x70);delay(1);
 datas(m2,0xbc,0x78);delay(1);
 cs1=1;cs2=1;
 }

main()
{
 chushihua();
 cleanout();
 while(1)
 {
  dushu();
  xian();
 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -