⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ledtest.lst

📁 单片机开发源代码,单片机开发源代码,单片机开发源代码.
💻 LST
📖 第 1 页 / 共 3 页
字号:

 304   1      							    ow_reset();
 305   1      				                tx_str("read crc error!");
 306   1      					           }
 307   1                               else{
 308   1      	                          tx_str("read crc correct!");
 309   1      			                 }
 310   1      							   if (test==0xff)
 311   1      							       {
 312   1      								     tx_str("read_byte=0xff!");
 313   1      									 tx_lfbs();
 314   1      									}
 315   1      							   else {	
 316   1      	         				         tx_str("read_byte=");
 317   1      									 tx_char((test+55));
 318   1      									  tx_lfbs();
 319   1      									}
 320   1      							   wdelay(10000);
 321   1                                  }
 322   1                                  break;
 323   1                case '5':
 324   1                         tx_str("read status  from ds2406!");
 325   1                         tx_lfbs();
 326   1      		          for (y=0x00;y<0x08;y++)
 327   1      					      {
 328   1      					       ow_reset();                
 329   1      					       write_byte(0xCC);   //LSB address
 330   1      	                       write_byte(0xaa);   //MSB address
 331   1      					       write_byte(y);   //LSB address
 332   1      	                       write_byte(0x00);   //MSB address
 333   1                                 test=read_byte();  //LSB address
 334   1                                 temp1=read_byte();
 335   1      						   temp2=read_byte();
 336   1      						  // crcbit=read_bit();
 337   1      						   setcrc16(0x0000);     //
 338   1                                 docrc16(0xaa);
 339   1                                 docrc16(y);
 340   1                                 docrc16(0x00);
 341   1      						   docrc16(test);
 342   1                                   // read and calculate the read crc
 343   1                                 docrc16(temp1);
 344   1                                 lastcrc16 = docrc16(temp2);
 345   1                                 // crc should now be 0xB001
 346   1                                 if (lastcrc16 != 0xB001)
 347   1                                     {
 348   1      							    ow_reset();
 349   1      				                tx_str("read status crc error!");
 350   1      					           }
 351   1                               else{
 352   1      	                          tx_str("read status crc correct!");
 353   1      			                 }
 354   1                                  tx_lfbs(); 
 355   1                     			     if (test==0xff)
 356   1      							       {
 357   1      								     tx_str("read_byte=0xff!");
 358   1      									 tx_lfbs();
 359   1      									}
 360   1      							   else {	
 361   1      	         				         tx_str("read_byte=");
 362   1      									 tx_char((test+48));
 363   1      									  tx_lfbs();
 364   1      									}
 365   1      							 delay(5000);
C51 COMPILER V6.12  LEDTEST                                                                04/08/2009 16:14:06 PAGE 7   

 366   1      
 367   1      						 }
 368   1      						 break;
 369   1      		    case '6':
 370   1      			         tx_str("setup search  conditional");
 371   1      					 tx_lfbs();
 372   1                           tx_str("make PIOA high start!");
 373   1                           tx_lfbs();
 374   1      					       ow_reset();                
 375   1      					       write_byte(0xCC);   //LSB address
 376   1      	                       write_byte(0x55);   //MSB address
 377   1      					       write_byte(0x07);   //LSB address
 378   1      	                       write_byte(0x00);   //MSB address
 379   1                                 write_byte(0x56);  //LSB address
 380   1                                 temp1=read_byte();
 381   1      						   temp2=read_byte();
 382   1      						  // crcbit=read_bit();
 383   1      						   setcrc16(0x0000);     //
 384   1                                 docrc16(0x55);
 385   1                                 docrc16(0x07);
 386   1                                 docrc16(0x00);
 387   1      						   docrc16(0x56);
 388   1                                   // read and calculate the read crc
 389   1                                 docrc16(temp1);
 390   1                                 lastcrc16 = docrc16(temp2);
 391   1                                 // crc should now be 0xB001
 392   1                                 if (lastcrc16 != 0xB001)
 393   1                                     {
 394   1      							    ow_reset();
 395   1      				                tx_str("make PIOB Low crc error!");
 396   1      					           }
 397   1                               else{
 398   1      	                          tx_str("make PIOB low crc correct!");
 399   1      			                 }
 400   1                                  tx_lfbs(); 
 401   1      							 delay(5000);
 402   1      			         tx_str("Performing search rom CODE");
 403   1      					 tx_lfbs();
 404   1      					 ow_reset();
 405   1      					 first(TRUE);
 406   1                           if (ROM_NO[0]==0x12)
 407   1      					       {
 408   1      						       tx_str("conditional search Correct find Ds2406 family ROM code");
 409   1      							   tx_lfbs();
 410   1      							   }
 411   1                             tx_str("Performing send Match Rom");
 412   1      					   tx_lfbs();
 413   1      					  if(Send_MatchRom())
 414   1      					      {
 415   1      						    
 416   1       						   write_byte(0x55);   //write status
 417   1      					       write_byte(0x07);   //LSB address
 418   1      	                       write_byte(0x00);   //MSB address
 419   1                                 write_byte(0x0e);  //LSB address
 420   1                                 temp1=read_byte();
 421   1      						   temp2=read_byte();
 422   1      						  // crcbit=read_bit();
 423   1      						   setcrc16(0x0000);     //
 424   1                                 docrc16(0x55);
 425   1                                 docrc16(0x07);
 426   1                                 docrc16(0x00);
 427   1      						   docrc16(0x0e);
C51 COMPILER V6.12  LEDTEST                                                                04/08/2009 16:14:06 PAGE 8   

 428   1                                   // read and calculate the read crc
 429   1                                 docrc16(temp1);
 430   1                                 lastcrc16 = docrc16(temp2);
 431   1                                 // crc should now be 0xB001
 432   1                                 if (lastcrc16 != 0xB001)
 433   1                                     {
 434   1      							    ow_reset();
 435   1      				                tx_str("make PIOA high crc error!");
 436   1      					           }
 437   1                               else{
 438   1      	                          tx_str("make PIOA high crc correct!");
 439   1      			                 }
 440   1                                  tx_lfbs(); 
 441   1      						  }
 442   1      						 break;
 443   1                 case '7':
 444   1                         tx_str("make PIOA high start!");
 445   1                         tx_lfbs();
 446   1      					       ow_reset();                
 447   1      					       write_byte(0xCC);   //LSB address
 448   1      	                       write_byte(0x55);   //MSB address
 449   1      					       write_byte(0x07);   //LSB address
 450   1      	                       write_byte(0x00);   //MSB address
 451   1                                 write_byte(0x0e);  //LSB address
 452   1                                 temp1=read_byte();
 453   1      						   temp2=read_byte();
 454   1      						  // crcbit=read_bit();
 455   1      						   setcrc16(0x0000);     //
 456   1                                 docrc16(0x55);
 457   1                                 docrc16(0x07);
 458   1                                 docrc16(0x00);
 459   1      						   docrc16(0x0e);
 460   1                                   // read and calculate the read crc
 461   1                                 docrc16(temp1);
 462   1                                 lastcrc16 = docrc16(temp2);
 463   1                                 // crc should now be 0xB001
 464   1                                 if (lastcrc16 != 0xB001)
 465   1                                     {
 466   1      							    ow_reset();
 467   1      				                tx_str("make PIOA high crc error!");
 468   1      					           }
 469   1                               else{
 470   1      	                          tx_str("make PIOA high crc correct!");
 471   1      			                 }
 472   1                                  tx_lfbs(); 
 473   1      							 
 474   1                                   /*  ow_reset();                
 475   1      					       write_byte(0xCC);   //LSB address
 476   1      	                       write_byte(0x55);   //MSB address
 477   1      					       write_byte(0x07);   //LSB address
 478   1      	                       write_byte(0x00);   //MSB address
 479   1                                 write_byte(0x6d);  //
 480   1                                 temp1=read_byte();
 481   1      						   temp2=read_byte();
 482   1      						  // crcbit=read_bit();
 483   1      						   setcrc16(0x0000);     //
 484   1                                 docrc16(0x55);
 485   1                                 docrc16(0x07);
 486   1                                 docrc16(0x00);
 487   1      						   docrc16(0x6d);
 488   1                                   // read and calculate the read crc
 489   1                                 docrc16(temp1);
C51 COMPILER V6.12  LEDTEST                                                                04/08/2009 16:14:06 PAGE 9   

 490   1                                 lastcrc16 = docrc16(temp2);
 491   1                                 // crc should now be 0xB001
 492   1                                 if (lastcrc16 != 0xB001)
 493   1                                     {
 494   1      							    ow_reset();
 495   1      				                tx_str("make PIOA low crc error!");
 496   1      					           }
 497   1                               else{
 498   1      	                          tx_str("make PIOA low crc correct!");
 499   1      			                 }
 500   1                                  tx_lfbs(); 
 501   1      							 delay(10000);
 502   1      							 ow_reset();                
 503   1      					       write_byte(0xCC);   //LSB address
 504   1      	                       write_byte(0xaa);   //MSB address
 505   1      					       write_byte(0x07);   //LSB address
 506   1      	                       write_byte(0x00);   //MSB address
 507   1                                 test=read_byte();  //LSB address
 508   1                                 temp1=read_byte();
 509   1      						   temp2=read_byte();
 510   1      						  // crcbit=read_bit();
 511   1      						   setcrc16(0x0000);     //
 512   1                                 docrc16(0xaa);
 513   1                                 docrc16(0x07);
 514   1                                 docrc16(0x00);
 515   1      						   docrc16(test);
 516   1                                   // read and calculate the read crc
 517   1                                 docrc16(temp1);
 518   1                                 lastcrc16 = docrc16(temp2);
 519   1                                 // crc should now be 0xB001
 520   1                                 if (lastcrc16 != 0xB001)
 521   1                                     {
 522   1      							    ow_reset();
 523   1      				                tx_str("read status crc error!");
 524   1      					           }
 525   1                               else{
 526   1      	                          tx_str("read status crc correct!");
 527   1      			                 }
 528   1                                  tx_lfbs(); 
 529   1                     			     if (test==0xff)
 530   1      							       {
 531   1      								     tx_str("read_byte=0xff!");
 532   1      									 tx_lfbs();
 533   1      									}
 534   1      							   else if(test<=48) {	
 535   1      	         				         tx_str("read_byte=");
 536   1      									 tx_char((test+48));
 537   1      									  tx_lfbs();
 538   1      									}
 539   1      									else {  tx_str("read_byte=");
 540   1      									 tx_char((test));
 541   1      									  tx_lfbs();
 542   1      									}*/
 543   1      						/* break;
 544   1      		   case '8':
 545   1                                 ow_reset();                
 546   1      					       write_byte(0xCC);   //skip command
 547   1      	                       write_byte(0x55);   //write status command
 548   1      					       write_byte(0x07);   //LSB address
 549   1      	                       write_byte(0x00);   //MSB address
 550   1                                 write_byte(0x6d);  //data
 551   1                                 temp1=read_byte();
C51 COMPILER V6.12  LEDTEST                                                                04/08/2009 16:14:06 PAGE 10  

 552   1      						   temp2=read_byte();
 553   1      						  // crcbit=read_bit();
 554   1      						   setcrc16(0x0000);     //
 555   1                                 docrc16(0x55);
 556   1                                 docrc16(0x07);
 557   1                                 docrc16(0x00);
 558   1      						   docrc16(0x6d);
 559   1                                   // read and calculate the read crc
 560   1                                 docrc16(temp1);
 561   1                                 lastcrc16 = docrc16(temp2);
 562   1                                 // crc should now be 0xB001
 563   1                                 if (lastcrc16 != 0xB001)
 564   1                                     {
 565   1      							    ow_reset();
 566   1      				                tx_str("make PIOA low(Channel FF = 1 transistor off) crc error!");
 567   1      					           }
 568   1                               else{
 569   1      	                          tx_str("make PIOA low(Channel FF = 1 transistor off) crc correct!");
 570   1      			                 }
 571   1                                  tx_lfbs(); 
 572   1      						//	 delay(10000);
 573   1      						 break;
 574   1                default:   
 575   1      		            tx_str("default break!");
 576   1      					break;
 577   1      		 }
 578   1      		 }*/
 579   1         while(1);
 580   1        }
 581          
 582           /*unsigned char rx_char(void)
 583              {
 584          	   while(!RI)
 585          	      {;}
 586          	   RI=0;
 587          	   return SBUF;
 588          	 }*/
 589          
 590          void tx_str(unsigned char *str)
 591              {int i;
 592   1            for (i=0;i<strlen(str);i++)
 593   1      	        {
 594   2      			  tx_char(str[i]);
 595   2      	        }
 596   1      	}
 597          void tx_char(unsigned char c)
 598             {
 599   1          while(!TI)
 600   1      	  {
 601   2      	   ;
 602   2      	   }
 603   1      	   TI=0;
 604   1      	   SBUF=c;
 605   1      	 }
 606          
 607          void tx_lfbs(void)
 608              {int y;
 609   1      		 tx_char(0x0A);
 610   1      	 	for (y=0;y<70;y++)
 611   1      			 {
 612   2                    tx_char(0x08);
 613   2      			}
C51 COMPILER V6.12  LEDTEST                                                                04/08/2009 16:14:06 PAGE 11  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -