最近使用中断嵌套,以前没怎么是用过5509的外部中断,这几天试了试5509的外部中断嵌套结果相当不理想阿,要不就是没有办法嵌套,只能等待中断执行,后来我在中断服务子程序理面再次使用了打开全局中断的函数,但是却变成了可以进行相互嵌套,部分优先级了。这里很令人郁闷阿。5509的优先级不是已经由内部规定好了吗?
# include "csl.h"
# include "csl_chip.h"
# include "csl_pll.h"
# include "csl_irq.h"
# include "csl_emif.h"
# include "stdio.h"
PLL_Config PLL_SETTING={
0,
1,
12,
2
};
EMIF_Config EMIF_SETTING={
0x0221,
0xffff,
0xffff,
0xffff,
0xffff,
0x1fff,//CPLD使用了CE1
0x0fff,
0x00ff,
0xffff,
0xffff,
0xffff,
0xffff,
0xffff,
0xffff,
0xffff,
0xffff,
0xffff,
};
void VECSTART(void);
interrupt void yxq1 ();
interrupt void yxq2 ();
void delay (int t);
# define LED *((unsigned int*)0x200001)
# define SMG *((unsigned int*)0x200002)
# define BELL *((unsigned int*)0x200004)
static unsigned char SEG[]={
0x3F, //"0"
0x06, //"1"
0x5B, //"2"
0x4F, //"3"
0x66, //"4"
0x6D, //"5"
0x7D, //"6"
0x07, //"7"
0x7F, //"8"
0x6F, //"9"
0x77, //"A"
0x7C, //"B"
0x39, //"C"
0x5E, //"D"
0x79, //"E"
0x71, //"F"
0x76, //"H"
0x38, //"L"
0x37, //"n"
0x3E, //"u"
0x73, //"P"
0x5C, //"o"
0x40, //"-"
0x00, //熄灭
0x00 //自定义
};
static unsigned char LED_DATA[]={0X01,0X02,0X04,0X08,0X10,0X20,0X40,0X80};
void INT_SETTING ()
{
IRQ_setVecs ((Uint32)(&VECSTART));
IRQ_globalDisable ();
IRQ_clear (IRQ_EVT_INT0);
IRQ_clear (IRQ_EVT_INT1);
IRQ_plug (IRQ_EVT_INT0,&yxq1);
IRQ_plug (IRQ_EVT_INT1,&yxq2);
IRQ_enable (IRQ_EVT_INT0);
IRQ_enable (IRQ_EVT_INT1);
IRQ_globalEnable ();
}
void main ()
{
static unsigned char i;
CSL_init ();
PLL_config (&PLL_SETTING);
CHIP_RSET (XBSR,0X0A01);
EMIF_config (&EMIF_SETTING);
INT_SETTING ();
while (1)
{
for (i=0;i<8;i++)
{
LED=LED_DATA[i];
delay (5);
}
}
}
void delay (int t)
{
static int i,j;
while (t--)
{
for (i=0;i<500;i++)
for (j=0;j<500;j++);
}
}
interrupt void yxq1 ()
{
delay (10);
BELL=0X01;
delay (14);
BELL=0X00;
}
interrupt void yxq2 ()
{
static int i;
delay (10);
for (i=0;i<16;i++)
{
SMG=SEG[i];
delay (10);
}
}
此帖出自
小平头技术问答
一周热门 更多>