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

📄 extint.c

📁 做显示时测试用,可以单个点的显示屏上显示字或其它的图形.
💻 C
字号:
/*****************************************************************************
 *   extint.c:  Target C file for Philips LPC214x Family Microprocessors
 *
 *   Copyright(C) 2006, Philips Semiconductor
 *   All rights reserved.
 *
 *   History
 *   2005.10.01  ver 1.00    Prelimnary version, first Release
 *
*****************************************************************************/
#include "LPC214x.H"                        /* LPC21xx definitions */
#include "type.h"
#include "irq.h"
#include "extint.h"
#include "timer.h"
#include "uart.h"

DWORD eint1_counter;
BYTE fg;
volatile BYTE IR_code;
volatile BYTE IR_newcodeFg;
volatile BYTE remote_receive;

BYTE DEC_to_Str(DWORD Src ,BYTE* pDst)
{ 	
	BYTE nDstLength=0;
	if(Src>=10000)
	{
		*pDst++=(Src/10000)+'0';
		nDstLength++;	
	}
	if(Src>=1000)
	{
		*pDst++=((Src%10000)/1000)+'0';
		nDstLength++;
	}
	if(Src>=100)
	{
		*pDst++=(((Src%10000)%1000)/100)+'0';
		nDstLength++;
	}
	if(Src>=10)
	{
		*pDst++=((((Src%10000)%1000)%100)/10)+'0';
		nDstLength++;
	}
	if(Src>=1)
	{
		*pDst++=((((Src%10000)%1000)%100)%10)+'0';
		nDstLength++;
	}
	if(Src==0)
	{
		*pDst++='0';
		nDstLength++;
	}
	*pDst++='\0';  
	return nDstLength;
}
void printfNUM(DWORD Val)
{
	BYTE   BSS[20];
	U0IER = IER_THRE | IER_RLS;			/* Disable RBR */
	UARTSend( BSS, DEC_to_Str(Val,BSS));
	U0IER = IER_THRE | IER_RLS | IER_RBR;	/* Re-enable RBR */	
}

/*****************************************************************************
** Function name:		EINT1_Handler
**
** Descriptions:		external INT handler
**
** parameters:			None
** Returned value:		None
** 
*****************************************************************************/

void EINT1_Handler (void) __irq 
{

    EXTINT = EINT1;		//clear interrupt 		
    IENABLE;			//handles nested interrupt 

    IDISABLE;
    VICVectAddr = 0;		// Acknowledge Interrupt 
}

/*****************************************************************************
** Function name:		EINTInit
**
** Descriptions:		Initialize external interrupt pin and
**				install interrupt handler
**
** parameters:			None
** Returned value:		true or false, return false if the interrupt
**				handler can't be installed to the VIC table.
** 
*****************************************************************************/
DWORD EINTInit( void )
{
    PINSEL0 |= 0x20000000;		/* set P0.14 as EINT1 */
    PINSEL1 = 0x00000000;		/* P1.16~23 GPIO output */
    SCS	= 0;				/* set GPIOx to use regular I/O */
    IODIR1 = 0x00FF0000;		/* P1.16..23 defined as Outputs */
  
	IOCLR1 = 0x00FF0000;		/* turn off LEDs */
	IOSET1 = 0x00FF0000;		/* turn off LEDs */	

    EXTMODE = EINT1_EDGE;	/* INT1 edge trigger */
    EXTPOLAR = 0;			/* INT1 is falling edge by default */
     
    if ( install_irq( EINT1_INT, (void *)EINT1_Handler ) == FALSE )
    {
	return (FALSE);
    }
        
    return( TRUE );
}

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

⌨️ 快捷键说明

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