中断串口程序哪里错了,就是进不去中断,而且灯也不亮
#include"2440addr.h"
void uart0_init(void);
void uart_int_init(void);
void __irq uart_int(void);
void led_init(void);
int Main()
{
uart0_init();
uart_int_init();
led_init();
rGPBDAT&=~(1<<5);
while(1);
return 0;
}
void uart0_init()
{
rGPHCON&=~((3<<4)|(3<<6));
rGPHCON|=((2<<4)|(2<<6));
rGPHUP|=((0<<2)|(0<<3));
rULCON0|=(3<<0);
rUCON0=05;
rUBRDIV0=(int)(50000000/(9600*16))-1;
rURXH0=0;
}
void uart_int_init()
{
rINTMSK&=~(1<<28);
rINTSUBMSK&=~((1<<0)|(1<<1));
pISR_UART0=(unsigned int)uart_int;
}
void __irq uart_int()
{
unsigned char a;
rGPBDAT&=~(1<<5);
if(rSUBSRCPND&(1<<0))
{
a=rURXH0;
rGPBDAT&=~(1<<5);
rSUBSRCPND|=1<<0;
rUTXH0=a;
}
if(rSUBSRCPND&(1<<1))
{
rGPBDAT&=~(1<<6);
rSUBSRCPND|=1<<1;
}
rSRCPND|=1<<28;
rINTPND|=1<<28;
}
void led_init()
{
rGPBCON&=~((3<<10)|(3<<12));
rGPBCON|=((1<<10)|(1<<12));
rGPBUP&=~((1<<5)|(1<<6));
rGPBDAT|=((1<<5)|(1<<6));
}
|