系统检测错误是error C202: 'prem': undefined identifier,查了百度说是perm没有定义好,那么该如何定义呢,求大神
- #include"reg52.h"
- #define uchar unsigned char
- #define uint unsigned int
- uchar ram[4]={0,0,0,0};//
- void delaytime(uint time) //
- { uchar a,b;
- for(a=time;a>0;a--)
- { for(b=40;b>0;b--); }
- }
- void rem()interrupt 0 //
- {
- uchar ramc=0; //
- uchar count=0; //
- uint i=0; //
- prem=1;
- for(i=0;i<1100;i++) //
- {
- if(prem) //
- return; //
- }
- while(prem!=1); //
- delaytime(50); //
- //
- for(ramc=0;ramc<4;ramc++)//
- { for(count=0;count<8;count++) //
- {
- while(prem!=1); //
- //
- delaytime(9);//
- if(prem) //
- {ram[ramc]=(ram[ramc]<<1)+1;//
- delaytime(11); //
- }
- else //
- ram[ramc]=ram[ramc]<<1; //
- } //
- }
- if(ram[2]!=(~(ram[3]&0x7f))) //
- { for(i=0;i<4;i++) //
- ram[i]=0;
- returned;}
- main()
- {
- IT0=1; //
- EX0=1; //
- EA=1; //
- while(1)
- {
- switch(dis_num)
- {
- case 0x81: num=0; break;
- case 0xcf: num=1; break;
- case 0x92: num=2; break;
- case 0x86: num=3; break;
- case 0xcc: num=4; break;
- case 0xa4: num=5; break;
- case 0xa0: num=6; break;
- case 0x8f: num=7; break;
- case 0x80: num=8; break;
- case 0x84: num=9; break;
- case 0xb8: num=10;break;
- }
- P2=table[num];
- P1=0x01;
- delaytime(5);
- }
- sbit SRCLK=P3^6;
- sbit RCLK=P3^5;
- sbit SER=P3^4;
- //--¶¨ÒåҪʹÓõÄIO¿Ú--//
- #define COMMONPORTS P0
- //--ÁÐѡͨ¿ØÖÆ--//
- unsigned char code TAB[8] = {0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
- //--µãÕó×ÖÂë--//
- unsigned char code CHARCODE[18][8]=
- {
- {0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00}, //0
- {0x00,0x00,0x00,0x00,0x21,0x7f,0x01,0x00}, //1
- {0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00}, //2
- {0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00}, //3
- {0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00}, //4
- {0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00}, //5
- {0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00}, //6
- {0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00}, //7
- {0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00}, //8
- {0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00}, //9
- };
- void delay(unsigned int time)
- {
- unsigned int i,j;
- for(i=0;i<time;i++)
- for(j=0;j<121;j++);
- }
- /*******************************************************************************
- * º¯ÊýÃû : Hc595SendByte(unsigned char dat)
- * º¯Êý¹¦ÄÜ : Ïë74H595·¢ËÍÒ»¸ö×Ö½ÚµÄÊý¾Ý
- * ÊäÈë : ÎÞ
- * Êä³ö : ÎÞ
- *******************************************************************************/
- void Hc595SendByte(unsigned char dat)
- {
- unsigned char a;
- SRCLK=0;
- RCLK=0;
- for(a=0;a<8;a++)
- {
- SER=dat>>7;
- dat<<=1;
- SRCLK=1;
- _nop_();
- _nop_();
- SRCLK=0;
- }
- RCLK=1;
- _nop_();
- _nop_();
- RCLK=0;
- }
- /*******************************************************************************
- * º¯ÊýÃû : main
- * º¯Êý¹¦ÄÜ : Ö÷º¯Êý
- * ÊäÈë : ÎÞ
- * Êä³ö : ÎÞ
- *******************************************************************************/
- void main()
- {
- unsigned char tab, j;
- unsigned int i;
- while(1)
- {
- for(i= 0; i<50; i++ ) //Á½¸ö×ÖÖ®¼äµÄɨÃè¼ä¸ôʱ¼ä
- {
- for(tab=0;tab<8;tab++)
- {
- Hc595SendByte(0x00); //ÏûÒþ
- COMMONPORTS = TAB[tab]; //Êä³ö×ÖÂë
- Hc595SendByte(CHARCODE[j][tab]);
- delay(2);
- }
-
- }
- j++;
- if(j == 18)
- {
- j = 0;
- }
- }
- }
复制代码 |