eint_test.c

来自「IARSOURCECODE是基于LPC2478嵌入式软件IAR EWARM V4」· C语言 代码 · 共 52 行

C
52
字号
/*****************************************************************************
 *   einttest.c:  main C entry file for NXP LPC23xx/24xx Family Microprocessors
 *
 *   Copyright(C) 2006, NXP Semiconductor
 *   All rights reserved.
 *
 *   History
 *   2006.07.13  ver 1.00    Prelimnary version, first Release
 *
******************************************************************************/
#include "LPC2468.h"				/* LPC23xx/24xx definitions */
#include "type.h"
#include "irq.h"
#include "extint.h"

#include "fio.h"

extern volatile DWORD eint0_counter;
/*****************************************************************************
**   Main Function  main()
******************************************************************************/
int main (void)
{	    		
  TargetResetInit();

  /* initialize GPIO pins as external interrupts */
  EINTInit();
  GPIOInit(3,1,1);
  LedsInit();

  /****** It's an endless loop waiting for external interrupt ******/
  while( 1 )
  {
    if ( eint0_counter == (eint0_counter / 2) * 2)  // 根据中断服务函数返回的计数值进行处理
    {
      LedOn(0);LedOn(1);
      LedOff(2);LedOff(3);
    }
    else
    {
      LedOn(2);LedOn(3);
      LedOff(0);LedOff(1);
    }
  }

  return 0;
}

/******************************************************************************
**                            End Of File
******************************************************************************/

⌨️ 快捷键说明

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