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

📄 menu_a.lst

📁 时间触发嵌入式系统设计模式:使用8051系列微控制器开发可靠应用
💻 LST
字号:
C51 COMPILER V6.10  MENU_A                                                                 04/18/2001 16:09:36 PAGE 1   


C51 COMPILER V6.10, COMPILATION OF MODULE MENU_A
OBJECT MODULE PLACED IN .\MENU_A.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE .\MENU_A.C OPTIMIZE(6,SIZE) BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*------------------------------------------------------------------*-
   2          
   3             Menu.C (v1.01)
   4          
   5            ------------------------------------------------------------------
   6          
   7             Simple framework for interactive operation (e.g. data downloads) 
   8             to / from desktop / notebook PC (etc) via serial (UART) link.
   9          
  10             Use 'Hyperterminal' (under Windows 95, 98, 2000) or similar 
  11             terminal emulator program on other operating systems.
  12          
  13             Terminal options: 
  14          
  15             - Data bits    = 8
  16             - Parity       = None
  17             - Stop bits    = 1
  18             - Flow control = Xon / Xoff
  19          
  20          
  21             COPYRIGHT
  22             ---------
  23          
  24             This code is from the book:
  25          
  26             PATTERNS FOR TIME-TRIGGERED EMBEDDED SYSTEMS by Michael J. Pont 
  27             [Pearson Education, 2001; ISBN: 0-201-33138-1].
  28          
  29             This code is copyright (c) 2001 by Michael J. Pont.
  30           
  31             See book for copyright details and other information.
  32          
  33          -*------------------------------------------------------------------*/
  34          
  35          #include "Main.h"
  36          #include "2_01_10i.h"
  37          #include "Menu_A.h"
  38          #include "PC_IO_in.h"
  39          
  40          /*------------------------------------------------------------------*-
  41          
  42            MENU_Command_Processor()
  43          
  44            This function is the main menu 'command processor' function.  
  45          
  46            Schedule this (say) once every 10 ms (approx.).
  47          
  48          -*------------------------------------------------------------------*/
  49          void MENU_Command_Processor(void)
  50             {
  51   1         static bit First_time_only;
  52   1         char Ch;
  53   1      
  54   1         if (First_time_only == 0)
  55   1            {
C51 COMPILER V6.10  MENU_A                                                                 04/18/2001 16:09:36 PAGE 2   

  56   2            First_time_only = 1;
  57   2            MENU_Show_Menu();
  58   2            }
  59   1      
  60   1         // Check for user inputs
  61   1         PC_LINK_IO_Update();
  62   1      
  63   1         Ch = PC_LINK_IO_Get_Char_From_Buffer();
  64   1            
  65   1         if (Ch != PC_LINK_IO_NO_CHAR)
  66   1            {
  67   2            MENU_Perform_Task(Ch);
  68   2            MENU_Show_Menu();
  69   2            }
  70   1         }
  71          
  72          
  73          /*------------------------------------------------------------------*-
  74          
  75            MENU_Show_Menu()
  76          
  77            Display menu options on PC screen (via serial link)
  78            - edit as required to meet the needs of your application.
  79          
  80          -*------------------------------------------------------------------*/
  81          void MENU_Show_Menu(void)
  82             {
  83   1         PC_LINK_IO_Write_String_To_Buffer("Menu:\n"); 
  84   1         PC_LINK_IO_Write_String_To_Buffer("a - x\n");
  85   1         PC_LINK_IO_Write_String_To_Buffer("b - x\n");
  86   1         PC_LINK_IO_Write_String_To_Buffer("c - x\n\n");
  87   1         PC_LINK_IO_Write_String_To_Buffer("? : ");
  88   1         }
  89          
  90          
  91          /*------------------------------------------------------------------*-
  92          
  93            MENU_Perform_Task()
  94          
  95            Perform the required user task
  96            - edit as required to match the needs of your application.
  97          
  98          -*------------------------------------------------------------------*/
  99          void MENU_Perform_Task(char c)
 100             {
 101   1         // Echo the menu option
 102   1         PC_LINK_IO_Write_Char_To_Buffer(c);
 103   1         PC_LINK_IO_Write_Char_To_Buffer('\n');
 104   1      
 105   1         // Perform the task
 106   1         switch (c)
 107   1            {
 108   2            case 'a':
 109   2            case 'A':
 110   2               {
 111   3               Function_A();
 112   3               break;
 113   3               }
 114   2            
 115   2            case 'b':
 116   2            case 'B':
 117   2               {
C51 COMPILER V6.10  MENU_A                                                                 04/18/2001 16:09:36 PAGE 3   

 118   3               Function_B();
 119   3               break;
 120   3               }
 121   2      
 122   2            case 'c':
 123   2            case 'C':
 124   2               {
 125   3               Function_C();
 126   3               }
 127   2            } 
 128   1         }
 129          
 130          /*------------------------------------------------------------------*-
 131          
 132            Placeholder function
 133          
 134          -*------------------------------------------------------------------*/
 135          void Function_A(void)
 136             {
 137   1         PC_LINK_IO_Write_String_To_Buffer("\n* Doing A *\n\n");
 138   1         }
 139          
 140          /*------------------------------------------------------------------*-
 141          
 142            Placeholder function
 143          
 144          -*------------------------------------------------------------------*/
 145          void Function_B(void)
 146             {
 147   1         PC_LINK_IO_Write_String_To_Buffer("\n* Doing B *\n\n");
 148   1         }
 149          
 150          /*------------------------------------------------------------------*-
 151          
 152            Placeholder function
 153          
 154          -*------------------------------------------------------------------*/
 155          void Function_C(void)
 156             {
 157   1         PC_LINK_IO_Write_String_To_Buffer("\n* Doing C *\n\n");
 158   1         P1 = 'C';
 159   1         }
 160          
 161          /*------------------------------------------------------------------*-
 162            ---- END OF FILE -------------------------------------------------
 163          -*------------------------------------------------------------------*/
 164          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    150    ----
   CONSTANT SIZE    =     79    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       1
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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