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

📄 ia443x_demo.lst

📁 silicon wireless开发套件F920+Si4432原理图,源码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 592   2                              if( PB2_PIN == 0 ) 
 593   2                              {       /*RESET OPERATION*/
 594   3                                      //stop receiving
 595   3                                      RFIdle();
 596   3                                      //wait for release the push button
 597   3                                      while(PB2_PIN == 0);
 598   3                                      //clear counters and variables
 599   3                                      NmbrOfReceivedPackets = 0;
 600   3                                      NmbrOfMissedPackets = 0;
 601   3                                      LastPacketId = 0;
 602   3                                      //switch off LEDs
 603   3                                      LED_TX = 0;
 604   3                                      LED_RX = 0;
 605   3                                      BLED_PIN = 0;
 606   3                                      //next state
 607   3                                      DemoStates = sDemoRxStartReceive;
 608   3                                      return;
 609   3                              }
 610   2                              if( PB3_PIN == 0 || PB4_PIN == 0 )
 611   2                              {
 612   3                                      while( PB3_PIN == 0 || PB4_PIN == 0 );
 613   3                                      //goto setting page
C51 COMPILER V8.00   IA443X_DEMO                                                           11/17/2008 10:50:31 PAGE 11  

 614   3                                      MenuSetCursorPosition(0);
 615   3                                      DemoStates = sDemoSettingScreen;
 616   3                                      return;                         
 617   3                              }
 618   2                      break;
 619   2      
 620   2              /*Start the TRX-PER demo*/
 621   2                      case sDemoRestartDemo:
 622   2                              //draw demo start screen
 623   2                              PerformMenu( sMenuRestartDemo );
 624   2                              //next state
 625   2                              DemoStates = sDemoStartReceive;
 626   2                      break;
 627   2      
 628   2                      case sDemoStartReceive:
 629   2                              //reset the RF stack
 630   2                              RFIdle();
 631   2                              StopTmr3();
 632   2                              //set variables
 633   2                              NmbrOfSentPackets++;
 634   2                              //set flags -> wait for PING packet and not for ACK
 635   2                              fWaitForPacketOrAck = PING_PACKET;
 636   2                              
 637   2                              //if auto tx on -> check PB / send next packet
 638   2                              if( AutoTx == TRUE )
 639   2                              {
 640   3                                      LongDelay = 1;
 641   3                                      DemoTimer.U16 = 60000;
 642   3                                      StartTmr3(TMR3_12, DemoTimer, FALSE);
 643   3                                      DemoStates = sDemoDelayBeforeTx;
 644   3                                      return;
 645   3                              }
 646   2                              //start receive
 647   2                              
 648   2                              RFReceive(&RxCommand);
 649   2                              //next state
 650   2                              DemoStates = sDemoWaitForReceive;
 651   2                      break;
 652   2      
 653   2                      case sDemoDelayBeforeTx:
 654   2                              //check the push buttons
 655   2                              if( (SEND_PACKET_INPUT == 0) || (NmbrOfSentPackets == v_max_packets[MenuItems.name.max_packets]+1) )
 656   2                              {       /*AUTO TRANSMIT FUNCTION IS STOPPED*/
 657   3                                      //wait for release the button
 658   3                                      while(SEND_PACKET_INPUT == 0);
 659   3                                      AutoTx = FALSE;
 660   3                                      //change TXON icon to CLEAR icon
 661   3                                      PerformMenu( sMenuClearIcon );
 662   3                                      //wait for the push button
 663   3                                      DemoStates = sDemoWaitForClearScreen;
 664   3                                      return;
 665   3                              }
 666   2                              if( PB3_PIN == 0 || PB4_PIN == 0 )
 667   2                              {       /*SETTING BUTTON IS PRESSED*/
 668   3                                      //wait for release the button
 669   3                                      while( PB3_PIN == 0 || PB4_PIN == 0 );
 670   3                                      //goto setting page
 671   3                                      MenuSetCursorPosition(0);
 672   3                                      DemoStates = sDemoSettingScreen;
 673   3                                      return;                         
 674   3                              }
 675   2                              if( Tmr3Expired() == TRUE )
C51 COMPILER V8.00   IA443X_DEMO                                                           11/17/2008 10:50:31 PAGE 12  

 676   2                              {//TMR expired
 677   3                                      StopTmr3();
 678   3                                      DemoStates = sDemoSendPing;
 679   3                                      return;
 680   3                              }
 681   2                      break;
 682   2      
 683   2                      case sDemoWaitForClearScreen:
 684   2                              if( PB2_PIN == 0 )
 685   2                              {//CLEAR the screen -> restart the demo
 686   3                                      //wait for release the push button
 687   3                                      while( PB2_PIN == 0 );
 688   3                                      DemoStates = sDemoDefineDemoOrTest;
 689   3                              }
 690   2                      break;
 691   2      
 692   2                      case sDemoWaitForReceive:
 693   2                              if( fChangeDemoStates == TRUE )
 694   2                              {
 695   3                                      fChangeDemoStates = FALSE;
 696   3                                      DemoStates = NewDemoStates;
 697   3                                      return;
 698   3                              }
 699   2                              if( MenuItems.name.system_function == LAB_MODE )
 700   2                              {
 701   3                                      if( Tmr3Expired() == TRUE )
 702   3                                      {//packet didn't receive within timeout
 703   4                                              if( --LongDelay == 0 )
 704   4                                              {
 705   5                                                      //stop timer & RF Stack
 706   5                                                      StopTmr3();
 707   5                                                      RFIdle();
 708   5                                                      //next state
 709   5                                                      DemoStates = sDemoPERPrintResult;
 710   5                                              }
 711   4                                              else
 712   4                                              {//restart timer
 713   5                                                      DemoTimer.U16 = 44450;
 714   5                                                      StartTmr3(TMR3_12, DemoTimer, FALSE);
 715   5                                              }
 716   4                                      }
 717   3                                      return;
 718   3                              }
 719   2                              //check whether the push button is pressed for sending a PING packet
 720   2                              if( (SEND_PACKET_INPUT == 0) && (fWaitForPacketOrAck == PING_PACKET) && (AutoTx == FALSE) ) 
 721   2                              {       /*AUTO TX FUNCTION IS ENABLED*/
 722   3                                      //stop receiving
 723   3                                      RFIdle();
 724   3                                      StopTmr3();
 725   3                                      //wait for release TX push button
 726   3                                      while(SEND_PACKET_INPUT == 0);
 727   3                                      //switch on auto tx
 728   3                                      AutoTx = TRUE;
 729   3                                      //change TXON icon to TXOFF icon
 730   3                                      PerformMenu( sMenuStartAutoTx );
 731   3                                      //clear counters and variables
 732   3                                      NmbrOfSentPackets = 1;
 733   3                                      NmbrOfReceivedPackets = 0;
 734   3                                      //switch off LEDs
 735   3                                      LED_TX = 0;
 736   3                                      LED_RX = 0;
 737   3                                      BLED_PIN = 0;
C51 COMPILER V8.00   IA443X_DEMO                                                           11/17/2008 10:50:31 PAGE 13  

 738   3                                      //next state
 739   3                                      DemoStates = sDemoSendPing;
 740   3                                      return;
 741   3                              }
 742   2                              if( PB3_PIN == 0 || PB4_PIN == 0 )
 743   2                              {
 744   3                                      while( PB3_PIN == 0 || PB4_PIN == 0 );
 745   3                                      //goto setting page
 746   3                                      MenuSetCursorPosition(0);
 747   3                                      DemoStates = sDemoSettingScreen;
 748   3                                      return;                         
 749   3                              }
 750   2                      break;
 751   2      
 752   2                      case sDemoPacketReceived:
 753   2                              //stop timer
 754   2                              StopTmr3();
 755   2                              //get received packet and put it into the buffer 
 756   2                              MessageBuffer.payload = &RxTxBuffer[0];
 757   2                              ReceivedData.message = MessageBuffer;
 758   2                              RFGetBuffer(&ReceivedData);
 759   2                              //stop RF stack
 760   2                              RFIdle();
 761   2                              if( MenuItems.name.system_function == LAB_MODE )
 762   2                              {
 763   3                                      NmbrOfReceivedPackets++;
 764   3                                      DemoStates = sDemoPERPrintResult;
 765   3                                      return;
 766   3                              }
 767   2                              //RX only demo -> show the result
 768   2                              if( MenuItems.name.demo_mode == DEMO_MODE_RX )
 769   2                              {
 770   3                                      if( RxTxBuffer[1] == MenuItems.name.self_id )
 771   3                                      {
 772   4                                              //check how many packet received and missed (calculation is based on the received packet ID
 773   4                                              temp16 = ((uint16)(RxTxBuffer[2] << 8) + (uint16)RxTxBuffer[3]);
 774   4                                              if( (temp16 == 1) || (NmbrOfReceivedPackets == 0) || (NmbrOfMissedPackets >= NmbrOfReceivedPackets) )
 775   4                                              {//First valid packet received or error -> reset variables
 776   5                                                      NmbrOfReceivedPackets = 1;
 777   5                                                      NmbrOfMissedPackets = 0;
 778   5                                                      LastPacketId = temp16;
 779   5                                              }
 780   4                                              else
 781   4                                              {//calculate the missed packets
 782   5                                                      NmbrOfReceivedPackets++;
 783   5                                                      NmbrOfMissedPackets += (temp16-1) - LastPacketId;
 784   5                                                      LastPacketId = temp16;
 785   5                                              }
 786   4                                              MenuReportPer( (NmbrOfReceivedPackets + NmbrOfMissedPackets), NmbrOfReceivedPackets, CalcPer((NmbrOfR
             -eceivedPackets + NmbrOfMissedPackets),NmbrOfReceivedPackets) );                               
 787   4                                      }       
 788   3                                      else
 789   3                                      {
 790   4                                              printf("%x\r\n",RxTxBuffer[1]);

⌨️ 快捷键说明

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