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

📄 ia443x_demo.lst

📁 silicon wireless开发套件F920+Si4432原理图,源码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 392   2                              SpiRfWriteAddressData((REG_WRITE | ModulationModeControl2), temp8);
 393   2                              //disable packet handler
 394   2                              rf_param[0] = TX_PACKET_HANDLER_DIS | CRC_DIS;
 395   2                              RFSetParameter(pRfPacketHandler,rf_param,1);    
 396   2                              //start CW mode
 397   2                              RFDirectTransmit();
 398   2                              //next state
 399   2                              DemoStates = sDemoCheckSettingButton;
 400   2                      break;
 401   2      
 402   2              /*Extra function for BER-TEST mode*/
 403   2                      case sDemoStartBER:                     
 404   2                              PerformMenu( sMenuBERStartScreen );                                                     
 405   2                              //GPIO0 - RX_DATA
 406   2                              SpiRfWriteAddressData((REG_WRITE | GPIO0Configuration), GPIO_RX_DATA ); 
 407   2                              //SET direct modulation mode
 408   2                              temp8 = SpiRfReadRegister( ModulationModeControl2 );
 409   2                              temp8 &= 0x0F;
 410   2                              temp8 += TX_CLK_ON_GPIO | MOD_DIRECT_VIA_GPIO; 
 411   2                              SpiRfWriteAddressData((REG_WRITE | ModulationModeControl2), temp8);
 412   2                              //disable packet handler
 413   2                              rf_param[0] = RX_PACKET_HANDLER_DIS | CRC_DIS;
 414   2                              RFSetParameter(pRfPacketHandler, rf_param, 1);
 415   2                              //start receiving
 416   2                              RFDirectReceive();
 417   2                              //next state
 418   2                              DemoStates = sDemoCheckSettingButton;
 419   2                      break;
 420   2      
 421   2              /*Extra function for PER-TEST mode*/
 422   2                      case sDemoStartPER:
 423   2                              //draw screen
 424   2                              PerformMenu( sMenuPERStartScreen );     
 425   2                              //GPIO0 - RX_CLK
 426   2                              SpiRfWriteAddressData((REG_WRITE | GPIO0Configuration), GPIO_RX_DATA ); 
 427   2                              //next state
C51 COMPILER V8.00   IA443X_DEMO                                                           11/17/2008 10:50:31 PAGE 8   

 428   2                              DemoStates = sDemoPERWaitForStart;
 429   2                      break;
 430   2              
 431   2                      case sDemoPERWaitForStart:
 432   2                              //check setting button
 433   2                              if( PB3_PIN == 0 || PB4_PIN == 0 )
 434   2                              {
 435   3                                      while( PB3_PIN == 0 || PB4_PIN == 0 );
 436   3                                      //goto setting page
 437   3                                      MenuSetCursorPosition(0);
 438   3                                      DemoStates = sDemoSettingScreen;
 439   3                                      return;                         
 440   3                              }
 441   2                              if( PB1_PIN == 0 )
 442   2                              {//start receiving
 443   3                                      //wait release the button
 444   3                                      while( PB1_PIN == 0 );
 445   3                                      //draw STOP icon
 446   3                                      PerformMenu( sMenuStopIcon );
 447   3                                      //clear variables
 448   3                                      NmbrOfSentPackets = 0;
 449   3                                      NmbrOfReceivedPackets = 0;
 450   3                                      //next state
 451   3                                      DemoStates = sDemoPERStartReceive;
 452   3                              }
 453   2                      break;
 454   2      
 455   2                      case sDemoPERStartReceive:
 456   2                              RFIdle();
 457   2                              //set variables
 458   2                              if( (NmbrOfSentPackets == v_max_packets[MenuItems.name.max_packets]) || (PB1_PIN == 0) )
 459   2                              {
 460   3                                      //wait for releasing the button
 461   3                                      while( PB1_PIN == 0 );
 462   3                                      //change to CLEAR icon
 463   3                                      PerformMenu( sMenuClearIcon );
 464   3                                      //wait for the push button
 465   3                                      DemoStates = sDemoWaitForClearScreen;
 466   3                                      return;
 467   3                              }
 468   2                              else
 469   2                              {
 470   3                                      NmbrOfSentPackets++;
 471   3      
 472   3                              }
 473   2                              //reset variables
 474   2                              if( PB2_PIN == 0 )
 475   2                              {
 476   3                                      while( PB2_PIN == 0 );
 477   3                                      //reset variables
 478   3                                      //clear variables
 479   3                                      NmbrOfSentPackets = 0;
 480   3                                      NmbrOfReceivedPackets = 0;
 481   3                                      //next state
 482   3                                      DemoStates = sDemoPERStartReceive;
 483   3                              }                       
 484   2                              //start receive
 485   2                              RFReceive(&RxCommand);
 486   2                              //some delay (~20ms)
 487   2                              DemoTimer.U16 = 13400;
 488   2                              StartTmr3(TMR3_12, DemoTimer, FALSE);
 489   2                              while(Tmr3Expired() == FALSE);          
C51 COMPILER V8.00   IA443X_DEMO                                                           11/17/2008 10:50:31 PAGE 9   

 490   2                              StopTmr3();     
 491   2                              //generate trigger
 492   2                              LED1_PIN = 1;
 493   2                              //start timeout 200ms
 494   2                              DemoTimer.U16 = 44450;
 495   2                              LongDelay = 3;
 496   2                              StartTmr3(TMR3_12, DemoTimer, FALSE);
 497   2                              //release trigger
 498   2                              LED1_PIN = 0;
 499   2                              //next state
 500   2                              DemoStates = sDemoWaitForReceive;
 501   2                      break;
 502   2      
 503   2                      case sDemoPERPrintResult:
 504   2                              //calc PER
 505   2                              temp_float = CalcPer(NmbrOfSentPackets,NmbrOfReceivedPackets);
 506   2                              MenuReportTestPer(NmbrOfSentPackets, NmbrOfReceivedPackets, temp_float);
 507   2                              //next state
 508   2                              DemoStates = sDemoPERStartReceive;
 509   2                      break;
 510   2      
 511   2              /*Extra functions for TX-PER demo*/
 512   2                      case sDemoRestartTxDemo:
 513   2                              //draw demo start screen
 514   2                              PerformMenu( sMenuRestartDemo );
 515   2                              //next state
 516   2                              DemoStates = sDemoTxStartTransmit;
 517   2                      break;
 518   2      
 519   2                      case sDemoTxStartTransmit:
 520   2                              //if auto tx on -> check PB / send next packet
 521   2                              if( AutoTx == TRUE )
 522   2                              {
 523   3                                      //set variables
 524   3                                      NmbrOfSentPackets++;
 525   3                                      LongDelay = 1;
 526   3                                      DemoTimer.U16 = 60000;
 527   3                                      StartTmr3(TMR3_12, DemoTimer, FALSE);
 528   3                                      DemoStates = sDemoDelayBeforeTx;
 529   3                                      return;
 530   3                              }
 531   2                              if( SEND_PACKET_INPUT == 0 )
 532   2                              {
 533   3                                      //wait for releasing the push button
 534   3                                      while( SEND_PACKET_INPUT == 0 );
 535   3                                      //reset the RF stack
 536   3                                      RFIdle();
 537   3                                      //set variables
 538   3                                      NmbrOfSentPackets = 1;
 539   3                                      //enable AUTO TX function
 540   3                                      AutoTx = TRUE;
 541   3                                      //change TXON icon to TXOFF icon
 542   3                                      PerformMenu( sMenuStartAutoTx );
 543   3                                      //switch off LEDs
 544   3                                      LED_TX = 0;
 545   3                                      LED_RX = 0;
 546   3                                      BLED_PIN = 0;
 547   3                                      //send PING packets
 548   3                                      LongDelay = 1;
 549   3                                      DemoTimer.U16 = 600;
 550   3                                      StartTmr3(TMR3_12, DemoTimer, FALSE);
 551   3                                      DemoStates = sDemoDelayBeforeTx;
C51 COMPILER V8.00   IA443X_DEMO                                                           11/17/2008 10:50:31 PAGE 10  

 552   3                              }
 553   2                              if( PB3_PIN == 0 || PB4_PIN == 0 )
 554   2                              {
 555   3                                      while( PB3_PIN == 0 || PB4_PIN == 0 );
 556   3                                      //goto setting page
 557   3                                      MenuSetCursorPosition(0);
 558   3                                      DemoStates = sDemoSettingScreen;
 559   3                                      return;                         
 560   3                              }
 561   2                      break;
 562   2      
 563   2              /*Extra functions for the RX-PER demo*/
 564   2                      case sDemoRestartRxDemo:
 565   2                              //draw demo start screen
 566   2                              PerformMenu( sMenuRestartDemo );
 567   2                              PerformMenu( sMenuClearSettingIcon );
 568   2                              //next state
 569   2                              DemoStates = sDemoRxStartReceive;
 570   2                      break;
 571   2      
 572   2                      case sDemoRxStartReceive:
 573   2                              //reset the RF stack
 574   2                              RFIdle();
 575   2                              //set flags -> wait for PING packet and not for ACK
 576   2                              fWaitForPacketOrAck = PING_PACKET;
 577   2                              //start receive
 578   2                              RFReceive(&RxCommand);
 579   2                              //next state
 580   2                              DemoStates = sDemoRxWaitForReceive;
 581   2      
 582   2                      break;
 583   2      
 584   2                      case sDemoRxWaitForReceive:
 585   2                              //check whether the push button is pressed for sending a PING packet
 586   2                              if( fChangeDemoStates == TRUE )
 587   2                              {
 588   3                                      fChangeDemoStates = FALSE;
 589   3                                      DemoStates = NewDemoStates;
 590   3                                      return;
 591   3                              }

⌨️ 快捷键说明

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