rup.c

来自「是在不好意思」· C语言 代码 · 共 47 行

C
47
字号
#include "inc\44b.h"
#include "inc\option.h"



#define pISR_EINT4567	(*(unsigned *)(0xc7fff00+0x74))

void Eint4567isr(void)
{
	unsigned char which_int;
	which_int = rEXTINTPND;
	rEXTINTPND = 0x0;
	rI_ISPC = BIT_EINT4567;
	rPDATC=0x06;
	while(1);	//All IO is low
}

void init_ext4567(void)
{
	rINTMOD = 0x0;
	rINTCON = 0x1;
	
	rINTMSK = ~(BIT_GLOBAL|BIT_EINT4567);
	pISR_EINT4567 = (int)Eint4567isr;
	rPCONG = 0xffff;
	rPUPG = 0x0;
	rEXTINT=0x22220000;
	
	rI_ISPC=0x3ffffff;
	rEXTINTPND=0x0;
	
}


void Main(void)
{
	rPCONC=0x00000055;	
	rPDATC=0x0000;
	
	rPUPC=0x0;	//PULL UP RESISTOR should be enabled to I/O
	
	init_ext4567();
	
	while(1);
	
}

⌨️ 快捷键说明

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