编译不通过,求大神指教
时间:10-02
整理:3721RD
点击:
- #include<reg51.h>
- #include<intrins.h>
- #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 NUM[]="THE 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)
- {
- RW=0;
- RS=0;
- LCD=com;
- LcdDelay(5);
- LCDE=1;
- NOP();
- NOP();
- LCDE=0;
- }
- void LcdWriteData(unsigned char dat)
- {
- RW=0;
- RS=1;
- LCD=dat;
- LcdDelay(5);
- LCDE=1;
- NOP();
- NOP();
- LCDE=0;
- }
- void LcdInit()
- {
- LcdWriteCommand(0x28);
- LcdWriteCommand(0x0c);
- LcdWriteCommand(0x06);
- LcdWriteCommand(0x01);
- }
- void time0()interrupt 1
- {
- unsigned char i;
- TH0=55536/256;
- TL0=55536%256;
- num=+1;
- if(num>99)
- {
- num=0;
- sec=+1;
- if(sec>59)
- {
- sec=0;
- min=+1;
- if(min>59)
- {
- min=0;
- hou=+1;
- if(hou>23)
- {
- hou=0;
- }
- }
- }
- NUM[9]=hou/10+0x30;
- NUM[10]=hou%10+0x30;
- NUM[11]=min/10+0x30;
- NUM[12]=min%10+0x30;
- NUM[13]=sec/10+0x30;
- NUM[14]=sec%10+0x30;
- for(i=0;i<17;i++)
- {
- LcdWriteData(NUM); } }}void main(){ unsigned char i; TMOD=0x01; TH0=55536/256; TL0=55536%256; ET0=1; EA=1; TR0=1; LcdInit(); LcdDelay(100); LcdWriteCommand(0x80); for(i=0;i<17;i++) { LcdWriteData(NUM); } LcdWriteCommand(0xc1); for(i=0;i<16;i++) { LcdWriteData(string); } while(1);}