main.c

来自「< C语言嵌入式系统开发>>一书配套源代码,C51代码,对于5」· C语言 代码 · 共 53 行

C
53
字号
/*------------------------------------------------------------------*-

   Main.C (v1.00)

  ------------------------------------------------------------------

   A more reliable switch interface program for the 8051.


   COPYRIGHT
   ---------

   This code is associated with the book:

   EMBEDDED C by Michael J. Pont 
   [Pearson Education, 2002: ISBN: 0-201-79523-X].

   This code is copyright (c) 2001 by Michael J. Pont.
 
   See book for copyright details and other information.

-*------------------------------------------------------------------*/

#include "Main.H"
#include "Port.H"

#include "Switch_wait_TimeoutL.H"
#include "Display_count.H"

/* ---------------------------------------------------------------- */
void main(void)
   {
   tByte Switch_presses = 0;

   // Init functions
   SWITCH_Init();
   DISPLAY_COUNT_Init();
  
   while(1) 
      {
      if (SWITCH_Get_Input(30) == SWITCH_PRESSED)
         {
         Switch_presses++;
         }
       
      DISPLAY_COUNT_Update(Switch_presses);
      }
   }

/*------------------------------------------------------------------*-
  ---- END OF FILE -------------------------------------------------
-*------------------------------------------------------------------*/

⌨️ 快捷键说明

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