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

📄 main.c

📁 LPC2000系列培训课程给的实验代码。 此项目文件演示的是非向量中断。 KEIL CARM 编译。 内含启动配置代码。
💻 C
字号:
/************************************************************/
/* PROJECT NAME: VICnonvector                               */
/* Project:      LPC2100 Training course                    */
/* Engineer:     T Martin       tmartin@hitex.co.uk         */
/* Filename:     main.c                                     */
/* Language:     C                      	                */
/* Compiler:     Keil ARM	V2.00b		                    */
/* Assembler:    				                            */
/*                                                          */
/************************************************************/
/* COPYRIGHT: Hitex UK Ltd 		2005						*/
/* LICENSE:   THIS VERSION CREATED FOR FREE DISTRIBUTION	*/
/************************************************************/
/* Function:                                                */
/*                                                          */
/* Example configuration of VIC for nonvectored interrupt   */
/*															*/
/* Demonstrates serving the external interrupt as a non		*/ 
/* vectored interrupt										*/
/*															*/	
/* Oscillator frequency 12.000 Mhz							*/
/* Target board Keil MCB2100								*/
/************************************************************/

#include <LPC21xx.H>
void NonVectoredIRQ (void)__irq;
unsigned update = 0;

int main (void)
{

IODIR1			= 0x00FF0000;						//Set the LED pins as outputs
IOCLR1			= 0x00FF0000;						//Clear the LED pins

PINSEL0 		= 0x20000000;						//Enable the EXTINT0 interrupt

VICDefVectAddr 	= (unsigned)NonVectoredIRQ;			//pass the address of the IRQ into the VIC slot

VICIntEnable	= 0x8000;							//Enable EXTINT0 in the VIC

while(1)
{
;													//Idle loop
}

}

void NonVectoredIRQ (void)	 __irq
{
if(VICIRQStatus&0x00008000)							//Test for the interrupt source
{
	IOSET1 		= 0x00FF0000;						//Set the LED pins
	EXTINT  	= 0x00000002;						//Clear the peripheral interrupt flag
}
VICVectAddr 	= 0x00000000;						//Dummy write to signal end of interrupt
}

⌨️ 快捷键说明

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