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

📄 main.lst

📁 time triggered 时间触发嵌入式系统的开发实例3
💻 LST
字号:
C51 COMPILER V6.10  MAIN                                                                   04/19/2001 11:17:44 PAGE 1   


C51 COMPILER V6.10, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Main.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE .\Main.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*------------------------------------------------------------------*-
   2          
   3             Main.C (v1.00)
   4          
   5            ------------------------------------------------------------------
   6          
   7             Test program for pattern PORT I-O
   8           
   9             Illustrating the use of bitwise operators
  10          
  11             Reading and writing individual bits
  12             NOTE: Both bits on same port
  13          
  14             COPYRIGHT
  15             ---------
  16          
  17             This code is from the book:
  18          
  19             PATTERNS FOR TIME-TRIGGERED EMBEDDED SYSTEMS by Michael J. Pont 
  20             [Pearson Education, 2001; ISBN: 0-201-33138-1].
  21          
  22             This code is copyright (c) 2001 by Michael J. Pont.
  23           
  24             See book for copyright details and other information.
  25          
  26          -*------------------------------------------------------------------*/
  27          
  28          // File Main.H is detailed in Appendix A
  29          // This generic code may be used with any 8051 device
  30          // The code is independent of oscillator frequency
  31          #include <Main.H>  
  32          
  33          void Write_Bit_P1(unsigned char, bit);
  34          bit Read_Bit_P1(unsigned char);
  35          
  36          /* ............................................................... */
  37          
  38          void main (void)
  39             {
  40   1         bit x;
  41   1         
  42   1         for(;;) // Forever...
  43   1           {
  44   2           x = Read_Bit_P1(0);   // Read Port 1, Pin 0
  45   2           Write_Bit_P1(1,x);    // Write to Port 1, Pin 1
  46   2           }
  47   1         }
  48          
  49          /* --------------------------------------------------------------- */
  50          
  51          void Write_Bit_P1(unsigned char Pin, bit Value)
  52             {
  53   1         unsigned char p = 1;
  54   1         p <<= Pin;  // Left shift
  55   1         
C51 COMPILER V6.10  MAIN                                                                   04/19/2001 11:17:44 PAGE 2   

  56   1         // If we want 1 output at this pin
  57   1         if (Value)
  58   1            {
  59   2            P1 |= p;  // Bitwise OR
  60   2            return;
  61   2            }
  62   1         
  63   1         // If we want 0 output at this pin
  64   1         p = ~p;  // Complement
  65   1         P1 &= p; // Bitwise AND  
  66   1         }
  67          
  68          /* --------------------------------------------------------------- */
  69          
  70          bit Read_Bit_P1(unsigned char Pin)
  71             {
  72   1         unsigned char p = 1;
  73   1         p <<= Pin;  // Left shift
  74   1         
  75   1         // Write a 1 to the pin (to set up for reading)
  76   1         Write_Bit_P1(Pin, 1);
  77   1         return (P1 & p); // Read the pin
  78   1         }
  79          
  80          /*------------------------------------------------------------------*-
  81            ---- END OF FILE -------------------------------------------------
  82          -*------------------------------------------------------------------*/


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     68    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       2
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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