各位大师帮忙看一下
#include<reg52.h>
//#include<math.h>
#define uint unsigned int
#define uchar unsigned char
sbit DUAN=P2^6;
sbit WEI=P2^7;
uchar i,tt;
uchar code Temp[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
/*void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}*/
void main()
{
i=0;
tt=0;
TMOD=0x01;//设置定时器0为工作方式1
TH0=(65536-50000)/256;//高8位
TL0=(65536-50000)%256;//低8位
EA=1;//开总中断
ET0=1;//开定时器0中断
TR0=1;//起动定时器0
WEI=1;
P0=0;
WEI=0;
DUAN=1;
P0=0x3f;
DUAN=0;
while(1)
{
tt=0;
i++;
if(tt==20)
{
if(i=16)
i=0;
DUAN=1;
P0=Temp;
DUAN=0;
//delay(1000);
}
}
}
void exter0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
tt++;
}
大师们帮忙看一下,我这个让数码管隔一秒钟显示一个数的程序那点出了错。
输出HEX文件时提示Program Size: data=11.0 xdata=0 code=106
creating hex file from "wu13-1"...
"wu13-1" - 0 Error(s), 1 Warning(s).
#include<reg52.h>
//#include<math.h>
#define uint unsigned int
#define uchar unsigned char
sbit DUAN=P2^6;
sbit WEI=P2^7;
uchar i,tt;
uchar code Temp[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
/*void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}*/
void main()
{
i=0;
tt=0;
TMOD=0x01;//设置定时器0为工作方式1
TH0=(65536-50000)/256;//高8位
TL0=(65536-50000)%256;//低8位
EA=1;//开总中断
ET0=1;//开定时器0中断
TR0=1;//起动定时器0
WEI=1;
P0=0;
WEI=0;
DUAN=1;
P0=0x3f;
DUAN=0;
while(1)
{
if(tt==20) / / 原因在这
tt=0;
i++;
if(i=16)
i=0;
DUAN=1;
P0=Temp;
DUAN=0;
//delay(1000);
}
}
}
void exter0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
tt++;
} //你在试试吧
大哥,还是不得行。还是谢谢你!
欢迎光临 (http://www.51hei.com/bbs/) | Powered by Discuz! X3.1 |