中级会员
- 积分
- 313
- 威望
- 161
- 贡献
- 86
- 兑换币
- 46
- 注册时间
- 2012-10-16
- 在线时间
- 33 小时
- 毕业学校
- 海洋大学寸金
|
本帖最后由 陈木梁 于 2012-10-21 13:56 编辑
程序如下:
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
uint num=0,num1=0,n=0;
uint shi,ge,i,j,k,m,l;
uchar code arry[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d};
void delay();
void display(uint,uint);
void circulate();
void main()
{
TMOD=0x01;
TH0=(65536-45872)/256;
TL0=(65536-45872)%256;
EA=1;
ET0=1;
TR0=1;
while(1)
{
display(shi,ge);
if(num==20)
{
num=0;
num1++;
if(num1==60)
{
circulate();
circulate();
P1=0xff;
delay();
for(i=0;i<5;i++)
{
P1=0x00;
delay();
P1=0xff;
delay();
}
num1=0;
}
shi=num1/10;
ge=num1%10;
}
}
}
void circulate()
{
for(j=0;j<8;j++)
{
P1=arry[n++];
delay();
}
for(k=0;k<8;k++)
{
P1=arry[--n];
delay();
}
}
void display()
{
wela=1;
dula=0;
P0=0xfe;
wela=0;
dula=1;
P0=table[shi];
dula=0;
delay();
wela=1;
dula=0;
P0=0xfd;
wela=0;
dula=1;
P0=table[ge];
dula=0;
delay();
}
void delay()
{
uint m,l;
for(m=500;i>0;i--)
for(l=110;j>0;j--);
}
void T0_time() interrupt 1
{
TH0=(65536-45872)/256;
TL0=(65536-45872)%256;
num++;
}
警告如下:
建造目标 '目标 1'
正在编绎 Text1.c...
连接中...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?DISPLAY?TEXT1
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: _DISPLAY
MODULE: Text1.obj (TEXT1)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: _DISPLAY
MODULE: Text1.obj (TEXT1)
ADDRESS: 00B2H
Program Size: data=33.0 xdata=0 code=607
正在从 "1" 产生 HEX文件...
"1" - 0 错误 (s), 3 警告 (s).
|
|