main.c

来自「Embedded C 这本书的范例光碟程式」· C语言 代码 · 共 53 行

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

   Main.C (v1.00)

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

   A 'goat counting' program for the 8051 (re-structured version).


   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.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 + -
显示快捷键?