示例#1
0
文件: IIC.c 项目: hnulong/C51
void init()
{	
	wela=0;
	dula=0;
	//temp=0;
	TMOD=0x01;
	TH0=(65536-50000)/256;
	TL0=(65536-50000)%256;
	EA=1;
	ET0=1;
	TR0=1;	

	sda=1;
	delay();
	scl=1;
	delay();

	bai=read_add(23);
	delay1(10);
	shi=read_add(24);
	delay1(10);
	ge=read_add(25);
	delay1(10);
	temp=bai*100+shi*10+ge;
}
示例#2
0
//------------------------------------------------------------------------------
u08 AVCLan_Read_ACK()
{
 u08 time = 0;

 AVC_SET_1();
 delay1(19);

 AVC_SET_0();
 delay1(1);


 AVC_OUT_DIS(); // switch to read mode
 timer0_source(CK64);
 timer0_start();
 while(1) {
	time = TCNT0;
	if (INPUT_IS_SET && (time > 1)) break;
	if (time > 20) return 1;
 }
	
 while(INPUT_IS_SET);
 AVC_OUT_EN();// back to write mode
 return 0;

}
示例#3
0
文件: test.c 项目: hnulong/C51
void main()
{
	wei=1;
	P0=0xfe;
	wei=0;

	duan=1;
	P0=0x3f;
	duan=0;

	num=0;
	while(1)
	{	
		//·ÀÖ¹µÍµçƽÓÐÍ»´Ì
		if(!key1)
		{
			delay1();
			if(!key1)
			{
				num++;
				num=num%16;
			}
		//·ÀÖ¹¸ßµçƽÓа¼¹È
			while(!key1);
			delay1();
			while(!key1);
		}
		display();
	}
}
示例#4
0
void spi_write_eeprom(unsigned int addr, unsigned char data_in)
{
	unsigned char temp;

	EE_NCS = 0;
	delay1();
	spi_transfer(WRITE_ENABLE);
	EE_NCS = 1;

	delay_us(300);

	EE_NCS = 0;
	delay1();
	if((addr & 0x0100) == 0x0100)
	{
		temp = (WRITE_DATA | 0x08);
	}
	else
	{
		temp = WRITE_DATA;
	}
	spi_transfer(temp);
	delay1();
	spi_transfer((unsigned char)addr);
	delay1();
	spi_transfer(data_in);
	delay1();
	EE_NCS = 1;
}
示例#5
0
//------------------------------------------------------------------------------
void AVCLan_Send_Bit1()
{
 AVC_SET_1();
 delay1(20);

 AVC_SET_0();
 delay1(16);							// 12-21
}
示例#6
0
//------------------------------------------------------------------------------
void AVCLan_Send_Bit0()
{
 AVC_SET_1();
 delay1(32);							// 28-37
	
 AVC_SET_0();
 delay1(4);								// 00-09
}
示例#7
0
u08 AVCLan_Send_StartBit()
{
 AVC_SET_1();
 delay1(166);
 
 AVC_SET_0();
 delay1(30);

 return 1;
}
示例#8
0
文件: test.c 项目: hnulong/C51
void main()
{
	temp1=0xfe;
	temp2=0x7f;
	//间隔300ms先奇数亮再偶数亮,循环三次
	for(m=0;m<3;m++)
	{
		P1=0xAA;
		delay1();
		P1=0x55;
		delay1();
	}
	//一个灯上下循环三次
	for(m=0;m<3;m++)
	{
		for(n=0;n<8;n++)
		{
			P1=temp1;
			temp1= _crol_(temp1,1);
			delay1();
		}
		for(n=0;n<8;n++)
		{
			P1=temp2;
			temp2= _cror_(temp2,1);
			delay1();
		}
	}
	//两个分别从两边往中间流动三次,再从中间往两边流动三次
	for(m=0;m<3;m++)
	{
		for(n=0;n<4;n++)
		{
			P1=temp1&temp2;
			temp1= _crol_(temp1,1);
			temp2= _cror_(temp2,1);
			delay1();
		}
		for(n=0;n<4;n++)
		{
			P1=temp1&temp2;
			temp1= _crol_(temp1,1);
			temp2= _cror_(temp2,1);
			delay1();
		}
	}
	//8个全部闪烁3次
	for(m=0;m<3;m++)
	{
		P1=0x00;
		delay1();
		P1=0xff;
		delay1();
	}
	//关闭发光管
	P1=0xff;
	delay1();
}
示例#9
0
/*  LCD初始化   */
void init()
{ 
    delay1(1);                   
    lcd_wcmd(0x38);      //16*2显示,5*7点阵,8位数据
    delay1(1);
    lcd_wcmd(0x38);         
    delay1(1);

    lcd_wcmd(0x0c);      //显示开,关光标
    delay(1000);
    lcd_wcmd(0x06);      //移动光标
    delay(1000);
    lcd_wcmd(0x01);      //清除LCD的显示内容
    delay(1000);
}
main()
{
   uchar m;
    
    IRIN=1;                    //I/O口初始化
    BEEP=1;
	  RELAY=1; 
	
    delay1(10);                 //延时
    lcd_init();                //初始化LCD             
        
    lcd_pos(0);                //设置显示位置为第一行的第1个字符

     m = 0;
    while(cdis1[m] != '\0')
     {                         //显示字符
       lcd_wdat(cdis1[m]);
       m++;
     }

    lcd_pos(0x40);             //设置显示位置为第二行第1个字符
     m = 0;
    while(cdis2[m] != '\0')
     {
       lcd_wdat(cdis2[m]);      //显示字符
       m++;
     }


	IE = 0x81;                 //允许总中断中断,使能 INT0 外部中断
	TCON = 0x01;               //触发方式为脉冲负边沿触发

   while(1)	;

} //end main
示例#11
0
void SPI_transfer( unsigned int data)
{
    uint8_t byte2Transmit = data & 0x003F;
    byte2Transmit = byte2Transmit << 2;
    data = data >> 6 ;
    uint8_t byte1Transmit = data & 0x000F;
    byte1Transmit |= 0xF0;
    P3OUT = 0b10111111 & P3OUT;
    delay1();
    UCA0TXBUF = byte1Transmit;
    while(!(IFG2 & UCA0TXIFG));
    UCA0TXBUF=byte2Transmit;
    while((UCB0STAT&BIT0));
    delay1();
    P3OUT += 0x40;
}
	void lcd_init()					//LCD初始化设定
	{ 
    lcd_wcmd_8bit(0x38);                       //16*2显示,5*7点阵,8位数据
	delay1(1);  
	lcd_wcmd_8bit(0x38);                       //16*2显示,5*7点阵,8位数据
	delay1(1);  
	lcd_wcmd_8bit(0x28);     //16*2显示,5*7点阵,8位数据
	delay1(1);  
	lcd_wcmd(0x28);
	delay1(1);
  	lcd_wcmd(0x0c);     //显示开,关光标
	delay1(1);
   	lcd_wcmd(0x02);     //显示开,关光标
	delay1(1);
   	lcd_wcmd(0x01);     //清除LCD的显示内容
	delay1(1);



/*	lcd_wcmd(0x38);     //16*2显示,5*7点阵,8位数据
	delay(1);
	lcd_wcmd(0x08);     //显示开,关光标
	delay(1);
//	lcd_wcmd(0x04);     //移动光标
	delay(1);
	lcd_wcmd(0x02);     // 4位选择
	delay(1);
	lcd_wcmd(0x01);     //清除LCD的显示内容
	delay(1); */
	}
示例#13
0
int kbdtest(void)
{
int i;
printf("keyboard test\n");
printf("check keyboard...");
if(kbd_initialize())
{
	printf("failed\n");
 }
else
{
	printf("ok\n");
	printf("test kbd leds\n");
	
	printf("num Lock off");
	for(i=0;i<3;i++)
	{
	printf("\b\b\b on");
	pckbd_leds(2);
	delay1(1000);
	pckbd_leds(0);
	printf("\b\b\boff");
	delay1(1000);
	}
	printf("\ncaps Lock off");
	for(i=0;i<3;i++)
	{
	printf("\b\b\b on");
	pckbd_leds(4);
	delay1(1000);
	pckbd_leds(0);
	printf("\b\b\boff");
	delay1(1000);
	}
	printf("\nscroll Lock off");
	for(i=0;i<3;i++)
	{
	printf("\b\b\b on");
	pckbd_leds(1);
	delay1(1000);
	pckbd_leds(0);
	printf("\b\b\boff");
	delay1(1000);
	}
	printf("\n");
	printf("press key test,wait 10s to quit\n");
	while(1)
	{
	kbd_test=1;
	kbd_test_hit=0;
	delay1(10000);
	if(!kbd_test_hit){
		kbd_test=0;
		break;
	}
	}
	
}
return 0;
}
示例#14
0
void spi_write_sensor(unsigned char addr, unsigned char data_in)
{
	NCS = 0;
	delay1();
	spi_transfer(addr | 0x80);
	delay_us(50);
	spi_transfer(data_in);
	delay_us(30);
	NCS = 1;
}
示例#15
0
//------------------------------------------------------------------------------
u08 AVCLan_Send_ACK()
{	
 timer0_source(CK64);						//update every 1us
 timer0_start();	
 while (INPUT_IS_CLEAR)	{
 	if (TCNT0 >= 25) return 0;			// max wait time
 }

 AVC_OUT_EN();

 AVC_SET_1();
 delay1(32);								//28-37

 AVC_SET_0();
 delay1(4);									//00-09

 AVC_OUT_DIS();

 return 1;		
}
示例#16
0
文件: test.c 项目: kisom/pmon
static int printticks(int n,int d)
{
int i;
char c[4]={'\\','|','/','-'};
for(i=0;i<n;i++)
{
	printf("%c",c[i%4]);
	delay1(d);	
	printf("\b");
}
return 0;
}
main()
{
 uchar m;
    P2=0xff;
    IRIN=1;                    //I/O口初始化
    BEEP=1;
    RELAY=1; 
	
    delay1(10);                 //延时
    lcd_init();                //初始化LCD             
        
    lcd_pos(0);                //设置显示位置为第一行的第1个字符

     m = 0;
    while(cdis1[m] != '\0')
     {                         //显示字符
       lcd_wdat(cdis1[m]);
       m++;
     }

    lcd_pos(0x40);             //设置显示位置为第二行第1个字符
     m = 0;
    while(cdis2[m] != '\0')
     {
       lcd_wdat(cdis2[m]);      //显示字符
       m++;
     }


	IE = 0x81;                 //允许总中断中断,使能 INT0 外部中断
	TCON = 0x01;               //触发方式为脉冲负边沿触发
  while(1)
	{
	
		keyscan();
 
	delay(10);
    	switch(key)								   //读出对应值
		{
					
			case 1:P1= 0x08;break;
			case 2:P1= 0x3f;break;
			case 3:P1= 0x2d;break;
			case 4:P1= 0x08;break;
			case 5:P1= 0x10;break;
			case 6:P1= 0x20;break;
			case 7:P1= 0x40;break;
			case 8:P1= 0x80;break;
			default:break; 
		 
		}  
}
}//end main
示例#18
0
文件: IIC.c 项目: hnulong/C51
void main()
{	
	init();//初始化子程序
	while(1)
	{
		if(aa==10)
		  {
			aa=0;
			temp++;
			if(temp==1000)
			   {
					temp=0;
			   }
			bai=temp/100;
			shi=temp%100/10;
			ge=temp%10;
			write_add(23,bai);
			delay1(10);
			write_add(24,shi);
			delay1(10);
			write_add(25,ge);
			delay1(10);
		  }
		  bai=read_add(23);
		  delay1(10);
		  shi=read_add(24);
		  delay1(10);
		  ge=read_add(25);
		  delay1(10);
		  display(bai,shi,ge);
	}
}
示例#19
0
文件: tasking.c 项目: vinoh/Aqeous
void tasking_initiator()
{
  current_task = (uint32_t)Idle_task;
  printf("\n\n\n\t-------------MISSION ACCOMPLISHED-------------\n\n-------------Welcome to the MultiThreading World!!!-------------\n");
  printf("\n----Spawning 5 Immortal Idle Tasks, each would print a unique number----\n\tStarting in 3...2...1... GO...\n\n");
  delay1(20);
  init_shell();
  //init_hpet();
  apic_start_timer();       //The respective Timer initialization function of the timer of choice
//  for(int i=0;i<1000000;i++)
  asm volatile("sti");
  while(1);
}
示例#20
0
unsigned char spi_read_sensor(unsigned char addr)
{
	unsigned char temp;
	NCS = 0;
	delay1();
	spi_transfer(addr);
	delay_us(100);
	temp = spi_transfer(0xff);
	delay_us(120);
	NCS = 1;

	return temp;
}
示例#21
0
void main()
{    
    IRIN=1;                    //I/O口初始化
    delay1(5);                 //延时

    init();                //初始化LCD             
        
	IE = 0x81;                 //允许总中断中断,使能 INT0 外部中断
	TCON = 0x01;               //触发方式为脉冲负边沿触发
	lcd_wcmd(0x0c);
	delay(2);
	shizhong();
    while(1)
		{
			while(keynum==17)	
	
			{init();
			lcd_wcmd(0x80+0x40);
			write_data(table[1]);
			delay(70);
			write_data(table[2]);
			}

			while(keynum==18)	
	
			{init();
			lcd_wcmd(0x80+0x40);
			write_data(table[3]);
			delay(70);
			write_data(table[4]);
			}
			while(keynum==0)
			shizhong();
			while(keynum==1)
			wendu();
		}
			

}
示例#22
0
void lcd_init()
{ 
    delay1(15);   
    lcd_wcmd(0x01);      //清除LCD的显示内容            
    lcd_wcmd(0x38);      //16*2显示,5*7点阵,8位数据
    delay1(5);
    lcd_wcmd(0x38);         
    delay1(5);
    lcd_wcmd(0x38);         
    delay1(5);

    lcd_wcmd(0x0c);      //显示开,关光标
    delay1(5);
    lcd_wcmd(0x06);      //移动光标
    delay1(5);
    lcd_wcmd(0x01);      //清除LCD的显示内容
    delay1(5);

	writetab();               //自定义字符写入CGRAM
}
示例#23
0
void tasking_initiator()
{
  Kernel_task = create_task("Main_Kernel",kernel_main, 0, 0x202, kernel_proc);
  Kernel_task->special = 2;
  current_task = (uint32_t)Kernel_task;
  printf("\n\n\n\t\t--------------MISSION ACCOMPLISHED--------------\n\n\t--------------Welcome to the MultiThreading World!!!--------------\n");
  printf("\n\t-----------Launching the Shell and input/output processes-----------\n\t\t\t\tStarting in 3...2...1... GO...\n\n");
  delay1(1);
  kb_io_init();
  init_shell();
  multitasking_ON = 1;
  //setVesa(0x110); //TEXT MODE VESA :v
  //init_hpet();
  apic_start_timer();       //The respective Timer initialization function of the timer of choice

  clearIRQMask(1);
//  init_timer(1000);
  //Here it goes, The entry to the multitasking world.
  asm volatile("sti;\
   int $50");
  kill();
  while(1);
}
示例#24
0
void step()
{

  const int start = 7045;
	int adj = 0;
	
	TMOD=0x11;
	IEN0 = 0x00;
	
  while(bt9)
  {
		spkr = ~spkr;
		if(~bt2)
			adj++;
		if(~bt3)
			adj--;
		delay1(adj - start);
		
		if (adj / start != 0 )
			adj = 0;
			
	}
	return; 
}
示例#25
0
文件: serial.c 项目: kisom/pmon
inline void  UART16550_WRITE(int line,int y, uint8 z){
delay1(100);
((*((volatile uint8*)(serialbase[line] + y))) = z);
}
示例#26
0
static int net_looptest()
{
	unsigned char buf[1500];
	int len;
	int i,j,idx;
	int s;
	struct sockaddr addr;
	fd_set ifds;
	struct timeval timo;
	int errors=0;
	struct device *dev, *next_dev;
struct ifreq *ifr;
struct in_aliasreq *ifra;
struct in_aliasreq data;

	for (dev  = TAILQ_FIRST(&alldevs); dev != NULL; dev = next_dev) {
		next_dev = TAILQ_NEXT(dev, dv_list);
		if(dev->dv_class == DV_IFNET) {
		printf("%-12s %s\n", &dev->dv_xname, devclass[dev->dv_class]);
		}
	}

	for (dev  = TAILQ_FIRST(&alldevs); dev != NULL; dev = next_dev) {
		next_dev = TAILQ_NEXT(dev, dv_list);
		if(dev->dv_class != DV_IFNET) {
		continue;
		}

		errors=0;
	
	s = socket (AF_INET, SOCK_DGRAM, 0);
		ifr=(void *)&data;
		ifra=(void *)&data;
		bzero (ifra, sizeof(*ifra));
		strcpy(ifr->ifr_name,&dev->dv_xname);
		setsin (SIN(ifra->ifra_addr), AF_INET, inet_addr("0.0.0.0"));
		(void) ioctl(s, SIOCSIFADDR, ifra);
		close(s);


		delay1(8000);
		printf("test %s ...", &dev->dv_xname);


	addr.sa_len=sizeof(addr);
	strcpy(addr.sa_data,&dev->dv_xname);

	s= socket (AF_UNSPEC, SOCK_RAW, 0);
	if(s==-1){
	printf("please select raw_ether\n");
	return -1;
	}
		bind(s,&addr,sizeof(addr));
		for(j=0;j<3;j++)
		{
			memset(buf,0xff,12);
			buf[12]=8;buf[13]=0;
			for(i=14;i<TEST_LEN;i++) buf[i]=i-14+j;
			memset(buf+TEST_LEN,0,4);//crc
			sendto(s,buf,TEST_LEN+4,0,&addr,sizeof(addr));
		FD_ZERO(&ifds);
		FD_SET(s, &ifds);
		timo.tv_sec = 1; timo.tv_usec = 0;
		switch (select (s + 1, &ifds, 0, 0, &timo)) {
			case -1:
    			fprintf (stderr, "error,cannot select\n");
				goto error;
			case 0:
    			fprintf (stderr, "error,receive timeout,maybe no connection\n");
				goto error;
		}
			len=recv(s,buf,1500,0);
			for(i=14;i<len-4;i++) 
			{
			if(buf[i]!=i-14+j)break;
			}

			if(i<TEST_LEN)
			{
			errors++;
			printf("error,received data miscompare,maybe wrong connection\n");
			if(getenv("verbose"))
			{
				for(i=0;i<len;i++)
				{
					if((i&15)==0)printf("\n%02x: ",i);
					printf("%02x ",buf[i]);
				}
			printf("\n");
			}
			}
			delay1(500);
		}
		if(errors==0)printf("ok\n");
error:
	close(s);
		s = socket (AF_INET, SOCK_DGRAM, 0);
		(void) ioctl(s,SIOCGIFFLAGS,ifr);
		ifr->ifr_flags &=~(IFF_UP|IFF_OACTIVE);
		(void) ioctl(s,SIOCSIFFLAGS,ifr);
		close(s);
	}

	return 0;
}
示例#27
0
void main()

{
x=0;
counter = 0;
fw=0;
ew=0;
bz=0;


 TMOD=0x20; //Enable Timer 1

 TH1=0XFD;

 SCON=0x50;

 TR1=1; // Triggering Timer 1

 lcd_init();

lcd_cmd(0x81); //Place cursor to second position of first line 
lcd_cmd(0x01); //clear screen
lcd_string("SoS App");

 delay(200);
//recieve();
//SBUF=" ";
lcd_init();
lcd_cmd(0x81); //Place cursor to second position of first line 
//lcd_cmd(0x01); //clear screen
lcd_cmd(0xC1); //Place cursor to second position of second line
//lcd_string("UNIQUE ID:");
//recieve();
 while(1)

 {
 int l;


if (fw == 1 && counter == 0)
{
counter = 1;
bz = 1;
 for(l=0;l<12;l++)

 { 
 
 lcd_data(flood[l]);

 }

  // Mobile communication start
          		
          		serial_init();                                                                                                 //serial initialization
           // LED = 0x00; 
            printf("AT+CMGF=1%c",13);                                        
             delay2(20);  //Text Mode            | hex value of 13 is 0x0D (CR )
            printf("AT+CMGS=\"8939965828\"%c",13); delay2(20);           //Type your mobile number Eg : "9884467058"
           // led_left();                 //scroll left
                        delay1(20);
            printf("Sos-Warning:");                   
              delay2(20);  //Type text as u want
                printf(flood);                   
              delay2(20);  //Type text as u want
            printf("%c",0x1A);                                                             
            delay2(20);  //line feed command

          		// Mobile Communication end
}

if (ew == 1 && counter == 0)
{

counter = 1;
bz =1;
 for(l=0;l<17;l++)

 { 
 
 lcd_data(earthquake[l]);

 }
  // Mobile communication start
          		
          		serial_init();                                                                                                 //serial initialization
           // LED = 0x00; 
            printf("AT+CMGF=1%c",13);                                        
             delay2(20);  //Text Mode            | hex value of 13 is 0x0D (CR )
            printf("AT+CMGS=\"8939965828\"%c",13); delay2(20);           //Type your mobile number Eg : "9884467058"
           // led_left();                 //scroll left
                        delay1(20);
            printf("Sos-Warning:");                   
              delay2(20);  //Type text as u want
                printf(earthquake);                   
              delay2(20);  //Type text as u want
            printf("%c",0x1A);                                                             
            delay2(20);  //line feed command

          		// Mobile Communication end
}
 

 
}
 } 
示例#28
0
文件: serial.c 项目: kisom/pmon
/* memory-mapped read/write of the port */
inline uint8 UART16550_READ(int line,int y){
delay1(100);
return (*((volatile uint8*)(serialbase[line] + y)));
}
void send_data(int *receive)	//send command to LCD ports
{
	FILE *fp;
	int i,pin,value;
	char gpio_value[50];
	int data[8];
	for (i=0;i<8;i++)
	{
		data[i]=*(receive+i);
	}
	
	
	// Send data to port pins
	pin=0;
	for (i=77;i>69;i--)
	{
		sprintf(gpio_value, "/sys/class/gpio/gpio%d/value",i);
		
		fp=fopen(gpio_value, "w");
		fprintf (fp,"%d",data[pin]);
		fclose (fp);
		pin++;
	}

	//RS high for data	
		value=1;
		sprintf(gpio_value, "/sys/class/gpio/gpio%d/value",RS);
		fp=fopen(gpio_value, "w");
		fprintf (fp,"%d",value);
		fclose (fp);

	//RW low for write
		value=0;
		sprintf(gpio_value, "/sys/class/gpio/gpio%d/value",RW);
		fp=fopen(gpio_value, "w");
		fprintf (fp,"%d",value);
		fclose (fp);

	//EN high to low pulse
		value=1;
		sprintf(gpio_value, "/sys/class/gpio/gpio%d/value",EN);
		fp=fopen(gpio_value, "w");
		fprintf (fp,"%d",value);
		fclose (fp);

	delay1();	
		
	//Pull EN low
		value=0;
		sprintf(gpio_value, "/sys/class/gpio/gpio%d/value",EN);
		fp=fopen(gpio_value, "w");
		fprintf (fp,"%d",value);
		fclose (fp);
		
	delay1();
	
	/*
	printf("\n data is: ");
	for (i=0;i<8;i++)
	{
		printf("%d",data[i]);
	}
	*/
}
示例#30
0
文件: MAIN.C 项目: buzai/MFRC522----
void main( )
{    
     unsigned char status,i;
	 unsigned int str[4]={0xD5,0x5E,0x2A,0xD9};
	 unsigned int temp,j;
	  
     InitializeSystem( );
     PcdReset();
     PcdAntennaOff(); 
     PcdAntennaOn(); 

     while ( 1 )
     {   


//		if(RI == 1) {  //如果收到.
//	
//	      RI = 0;      //清除标志.
//	
//	      UART_buff = SBUF;  //接收.
//	
//		  printf("rec id %x",UART_buff);
//	
//	    }
			

	 		


         status = PcdRequest(PICC_REQALL, g_ucTempbuf);//寻卡
         if (status != MI_OK)
         {    
             InitializeSystem( );
		     PcdReset();
		     PcdAntennaOff(); 
		     PcdAntennaOn(); 
		     continue;
         }
			     
			
         status = PcdAnticoll(g_ucTempbuf);//防冲撞
         if (status != MI_OK)
         {    continue;    }


        //D55E2AD9
		
//		printf("开始: %d \n",array_cmp(g_ucTempbuf,str));


		////////以下为超级终端打印出的内容////////////////////////
		if(array_cmp(g_ucTempbuf,str)==0){

	   		LED_GREEN = 0;
			delay1(100);
			LED_GREEN = 1;
			delay1(100);
			LED_GREEN = 0;
			delay1(200);
			LED_GREEN = 1;

			printf("卡号是 :");
				for(i=0;i<4;i++)
				{
					temp=g_ucTempbuf[i];
					printf("%X",temp);
					
	        	}
			printf("\n");
		}
		else{
			printf("卡号错误 错误的卡号是 :");
				for(i=0;i<4;i++)
				{
					temp=g_ucTempbuf[i];
					printf("%X",temp);
					
	        	}
			printf("\n");
		}

		////////////////////////////////////////////////////////


	    for(i=0;i<250;i++)//先输出一种频率的声音
        {
         for(j=0;j<80;j++);
         Speaker=~Speaker;
        }

		
						 		         
		PcdHalt();

    }
}