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

📄 xirq0.c

📁 ADuC系列芯片的源代码事例
💻 C
字号:
/*********************************************************************

 Author        : ADI - Apps            www.analog.com/MicroConverter

 Date          : Sept. 2005

 File          : XIRQ0.c

 Hardware      : Applicable to ADuC702x rev H or I silicon
                 Currently targetting ADuC7026.

 Description   : Complement port 3 in a loop.
				 When XIRQ0 is pressed, complement P4.2	
		
*********************************************************************/

#include <ADuC7026.h>					// 	Include ADuC7026 Header File

void My_IRQ_Function(void);				//	IRQ Funtion Prototype 
void delay(int);
										// 	Memory function macro 
int main (void) {

	IRQ = My_IRQ_Function;				// 	Specify Interrupt Service Rountine 

	IRQEN = XIRQ0_BIT;					//	Enable XIRQ0 in IRQEnable 

	GP4DAT = 0x04000000;				//	Configure P4.2 as output
	GP3DAT = 0xff000000;				//	Configure port 3 as output

	while(1) 	{
		GP3DAT ^= 0x00ff0000;	   		// 	Complement Port 3
		delay(10000);					//	Delay to make blink visible
	}
                   
	return 0 ;
}

/********************************************************************/
/*                                                                  */
/*		Interrupt Service Rountine									*/
/*                                                                  */
/********************************************************************/

void My_IRQ_Function() {
	GP4DAT ^= 0x00040000;				// Complement P4.2
	while(GP0DAT & 0x00010){}			// wait for XIRQ to be low again
	return ;
}

void delay (int length) {
	while (length >=0)
    	length--;
}

⌨️ 快捷键说明

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