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

📄 keyboard.lst

📁 at89C51 keyboard example
💻 LST
字号:
C51 COMPILER V7.10   KEYBOARD                                                              06/10/2004 16:51:38 PAGE 1   


C51 COMPILER V7.10, COMPILATION OF MODULE KEYBOARD
OBJECT MODULE PLACED IN keyboard.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE keyboard.c LARGE DEFINE(KEIL) DEBUG OBJECTEXTEND TABS(3)

line level    source

   1          /**
   2           * @file $RCSfile: keyboard.c,v $
   3           *
   4           * Copyright (c) 2004 Atmel.
   5           *
   6           * Please read file license.txt for copyright notice.
   7           *
   8           * @brief This file is an example to use keyboard.
   9           *
  10           * This file can be parsed by Doxygen for automatic documentation
  11           * generation.
  12           * Put here the functional description of this file within the software
  13           * architecture of your program.
  14           *
  15           * @version $Revision: 1.0 $ $Name:  $
  16           */
  17          
  18          /* @section  I N C L U D E S */
  19          #include "reg_C51.h"
  20          
  21          /*_____ D E C L A R A T I O N ______________________________________________*/
  22          unsigned int keypressed;         /* key pressed value */
  23          bit key_flag;                    /* software flag */
  24          
  25          /**
  26           * FUNCTION_PURPOSE:this function setup keyboard.
  27           * A key set idle mode and an other set the power-down mode
  28           * In this two mode the microcontoleur wake up at keyboard event
  29           * FUNCTION_INPUTS:void
  30           * FUNCTION_OUTPUTS:void
  31           */
  32          void  main()
  33          {
  34   1      EA=1; /* enable interrupts */
  35   1      
  36   1      /* init keyboard */
  37   1         KBE=0xFF;                     /*Enable all P1 I/O as keyboard IO */
  38   1         KBF=0x00;                     /* Clear all keyboard flags */
  39   1         IEN1 |=0x01;                  /* Enable keyboard interupt */
  40   1      
  41   1      while(1)                         /* endless */
  42   1      {
  43   2         if (key_flag)                 /* keyboard occur */
  44   2         {
  45   3            if ( keypressed==16)       /*enter Idle mode */
  46   3            {
  47   4               /* Entering Idle Mode */
  48   4               PCON |=0x01;
  49   4               /* Wake up by keypressed value */
  50   4            }
  51   3            if ( keypressed==32)       /* enter powerdown mode */
  52   3            {
  53   4               /* Entering PowerDown Mode */
  54   4               PCON |=0x02;
  55   4               /* Wake up by keypressed value */
C51 COMPILER V7.10   KEYBOARD                                                              06/10/2004 16:51:38 PAGE 2   

  56   4            }
  57   3            key_flag=0;                /* reset softaware flag */
  58   3            }
  59   2         }
  60   1      }
  61          
  62          /**
  63          * FUNCTION_PURPOSE:keyboard_interrupt. Save pressed key
  64          * FUNCTION_INPUTS:void
  65          * FUNCTION_OUTPUTS:void
  66          */
  67          void keyboard_interrupt() interrupt 7 using 1
  68          {
  69   1      keypressed=KBF;                  /* save pressed key */
  70   1      key_flag=1;                      /* set the software flag */
  71   1      KBF=0x00;                        /* clear keyboard flags */ 
  72   1      }
  73          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     78    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =      2    ----
   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 + -