各位大神,下面这个程序为什么老是显示原始数组里边的时间数值,时间不变化?求教大神帮助!!!!
程序:
#include<reg51.h>
#include<intrins.h>
#define LCDDATE P0
#define LCD P0
#define NOP()_nop_()
sbit RW=P2^5;
sbit RS=P2^6;
sbit LCDE=P2^7;
unsigned char string[]="I LOVE COMPUTER!";
unsigned char Time[]="TIME:15:35:42";
unsigned char hou=15,min=32,sec=36,num=0;
void LcdDelay(unsigned int i)
{
unsigned char a;
for(i;i>0;i--)
{
for(a=2;a>0;a--);
}
}
void LcdWriteCommand(unsigned char com)
{
LCDE=0;
RW=0;
RS=0;
LCD=com;
LcdDelay(5);
LCDE=1;
NOP();
NOP();
LCDE=0;
}
void LcdWriteData(unsigned char dat)
{
LCDE=0;
RW=0;
RS=1;
LCD=dat;
LcdDelay(5);
LCDE=1;
NOP();
NOP();
LCDE=0;
}
void LcdInit()
{
LcdWriteCommand(0x38);
LcdWriteCommand(0x0c);
LcdWriteCommand(0x06);
LcdWriteCommand(0x01);
}
void time0()interrupt 1
{
unsigned char num=0;
unsigned char i;
TH0=55536/256;
TL0=55536%256;
num=num+1;
if(num>99)
{
num=0;
sec=sec+1;
if(sec>59)
{
sec=0;
min=+1;
if(min>59)
{
min=0;
hou=+1;
if(hou>23)
{
hou=0;
}
}
}
Time[5]=hou/10+0x30;
Time[6]=hou%10+0x30;
Time[7]=min/10+0x30;
Time[8]=min%10+0x30;
Time[9]=sec/10+0x30;
Time[10]=sec%10+0x30;
LcdWriteCommand(0x80);
for(i=0;i<13;i++)
{
LcdWriteData(Time[i]);
}
}
}
void main()
{
unsigned char i;
TMOD=0x01;
TH0=55536/256;
TL0=55536%256;
ET0=1;
EA=1;
TR0=1;
LcdInit();
LcdDelay(100);
LcdWriteCommand(0xc0);
for(i=0;i<16;i++)
{
LcdWriteData(string[i]);
}
while(1)
{
LcdWriteCommand(0x80);
for(i=0;i<13;i++)
{
LcdWriteData(Time[i]);
}
void time0() interrupt 1;
}
} |