📄 lcm061a完成.txt
字号:
#include<reg52.h>
#include<intrins.h>
sbit cs=P2^0;
sbit da=P2^1;
sbit wr=P2^2;
unsigned char u=0;//控制地址显示
unsigned char j=0;//控制数字显示
unsigned char p, w=0;
unsigned char shuzi[10]={0xb7,0x06,0xe5,0xc7,0x56,0xd3,0xf3,0x07,0xf7,0xd7};
unsigned char sibu[4]={0x29,0x18,0x01,0x03};
unsigned char wei[7]={0xff,0x28,0x20,0x18,0x10,0x08,0x00 };
unsigned char h=0;
unsigned char i,y, z,k=0,t=1;
unsigned char bdata e;
sbit s=e^7;
void yanshi(unsigned a)//延时函数
{
unsigned char b;
for(b=0;b<a;b++);
}
void xieshu(unsigned char c)//写数据函数
{
yanshi(6);
wr=0;
yanshi(6);
da=c;
yanshi(6);
wr=1;
}
void moshi(unsigned char d)//写模式 d=1写101 d=0写100
{
yanshi(200);
cs=1;
yanshi(6);
cs=0;
xieshu(1);
xieshu(0);
xieshu(d);
}
void wr_command(y,z)//写命令函数///y控制要送的的数 z控制送的次数是几就送几位数
{
unsigned char g=0;
e=y;
while(g<z)
{
wr=0;
yanshi(6);
da=s;
yanshi(6);
wr=1;
yanshi(4);
g++;
e=_crol_(e,1);
}
}
void chushihua()//初使化函数
{
unsigned char m=0;
while(m<4)
{
y=sibu[h];
moshi(0);
yanshi(6);
wr_command(y,9);
h++;
m++;
}
}
void qingling()//清零函数//出使化专用函数
{
unsigned char q=0;
moshi(1);
while(q<6)
{
q++;
xieshu(0);
}
q=0;
while(q<150)
{q++;
xieshu(0);
}
}
void dizhi(t)//地址函数
{
unsigned char bdata n;
y=0;
n=wei[t];
y=n;
moshi(1);
yanshi(6);
wr_command(y,6);
}
void songshu(k)//送要选择的数
{
unsigned char bdata v;
y=0;
v=shuzi[k];
y=v;
wr_command(y,8);
}
void lianxun(u,j)
{
dizhi(u);
songshu(j);
}
void xianshi(u,j)
{
chushihua(); //unsigned char j=0;//控制数字显示
qingling();
lianxun(u,j);
}
void main() //主函数 unsigned char u=0;//控制地址显示
{unsigned l=0;
xianshi(1,j);
while(l<9)
{j++;
yanshi(2000);
l++;
}
l=0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -