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

📄 hello.lst

📁 keil C51 Hello事例
💻 LST
字号:
C51 COMPILER V6.21  HELLO                                                                  12/10/2004 10:37:27 PAGE 1   


C51 COMPILER V6.21, COMPILATION OF MODULE HELLO
OBJECT MODULE PLACED IN Hello.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE Hello.c OPTIMIZE(6,SPEED) BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*------------------------------------------------------------------*-
   2          
   3             Hello.C (v1.00)
   4          
   5            ------------------------------------------------------------------
   6          
   7             A "Hello Embedded World" test program for 8051.
   8          
   9          
  10             COPYRIGHT
  11             ---------
  12          
  13             This code is associated with the book:
  14          
  15             EMBEDDED C by Michael J. Pont 
  16             [Pearson Education, 2002: ISBN: 0-201-79523-X].
  17          
  18             This code is copyright (c) 2001 by Michael J. Pont.
  19           
  20             See book for copyright details and other information.
  21          
  22          -*------------------------------------------------------------------*/
  23          
  24          #include <reg52.h>
  25          
  26          // LED is to be connected to this pin
  27          sbit LED_pin = P1^5;
  28          
  29          // Stores the LED state
  30          bit LED_state_G;
  31          
  32          // Function prototypes
  33          void LED_FLASH_Init(void);
  34          void LED_FLASH_Change_State(void);
  35          void DELAY_LOOP_Wait(const unsigned int);
  36          
  37          /*..................................................................*/
  38          
  39          void main(void)
  40             {
  41   1         LED_FLASH_Init();
  42   1      
  43   1         while(1) 
  44   1            {
  45   2            // Change the LED state (OFF to ON, or vice versa)
  46   2            LED_FLASH_Change_State();
  47   2      
  48   2            // Delay for *approx* 1000 ms
  49   2            DELAY_LOOP_Wait(1000);
  50   2            }   
  51   1         }
  52          
  53          /*------------------------------------------------------------------*-
  54          
  55            LED_FLASH_Init()
C51 COMPILER V6.21  HELLO                                                                  12/10/2004 10:37:27 PAGE 2   

  56          
  57            Prepare for LED_Change_State() function - see below.
  58          
  59          -*------------------------------------------------------------------*/
  60          void LED_FLASH_Init(void)
  61             {
  62   1         LED_state_G= 0;
  63   1         }
  64          
  65          
  66          /*------------------------------------------------------------------*-
  67          
  68            LED_FLASH_Change_State()
  69          
  70            Changes the state of an LED (or pulses a buzzer, etc) on a 
  71            specified port pin.
  72          
  73            Must call at twice the required flash rate: thus, for 1 Hz
  74            flash (on for 0.5 seconds, off for 0.5 seconds),
  75            this function must be called twice a second.
  76          
  77          -*------------------------------------------------------------------*/
  78          void LED_FLASH_Change_State(void)
  79             {
  80   1         // Change the LED from OFF to ON (or vice versa)
  81   1         if (LED_pin == 1)
  82   1            {
  83   2            LED_state_G = 0;
  84   2            LED_pin = 0;
  85   2            }
  86   1         else
  87   1            {
  88   2            LED_state_G = 1;
  89   2            LED_pin = 1;
  90   2            }
  91   1         }
  92          
  93          /*------------------------------------------------------------------*-
  94          
  95            DELAY_LOOP_Wait()
  96          
  97            Delay duration varies with parameter.  
  98          
  99            Parameter is, *ROUGHLY*, the delay, in milliseconds,
 100            on 12MHz 8051 (12 osc cycles).
 101          
 102            You need to adjust the timing for your application!
 103          
 104          -*------------------------------------------------------------------*/
 105          void DELAY_LOOP_Wait(const unsigned int DELAY)
 106             {
 107   1         unsigned int x, y;
 108   1      
 109   1         for (x = 0; x <= DELAY; x++)
 110   1            {
 111   2            for (y = 0; y <= 1200; y++);
 112   2            }
 113   1         }
 114          
 115          /*------------------------------------------------------------------*-
 116            ---- END OF FILE -------------------------------------------------
 117          -*------------------------------------------------------------------*/
C51 COMPILER V6.21  HELLO                                                                  12/10/2004 10:37:27 PAGE 3   



MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     64    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   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 + -