📄 isr.c
字号:
//*******************************************************************//
//Interrupt Service Routine For C language
//*******************************************************************//
#include "SPCE061A.H"
unsigned int g_uiIOA_LED=0xff,g_uiIOB_LED=0xff,g_uiClockCnt;
void Key2 (void);
unsigned int rand();
extern fuwei;
extern kaishi;
void BREAK(void) __attribute__ ((ISR));
void BREAK(void)
{
}
void FIQ(void) __attribute__ ((ISR));
void FIQ(void)
{
}
void IRQ0(void) __attribute__ ((ISR));
void IRQ0(void)
{
}
void IRQ1(void) __attribute__ ((ISR));
void IRQ1(void)
{
}
void IRQ2(void) __attribute__ ((ISR));
void IRQ2(void)
{
}
void IRQ3(void) __attribute__ ((ISR));
void IRQ3(void)
{
}
void IRQ4(void) __attribute__ ((ISR));
void IRQ4(void)
{
unsigned int indate=0x0000; //date是IOA高八位赋值?????????
int i,Dig,j,count1,k=0,a,b,c,d,y;
int n=0,date=0x0000;
loopa:
y=1;
while(y)
{
LedDispDig(2,0);
LedDispDig(1,2);
LedDispDig(3,0);
LedDispDig(4,0);
kaishi=KeyScan1();
if(kaishi==0x0001)
{kaishi==0x0001;y=0;}
else
kaishi==0x0000;
}
if(kaishi==0x0001)
{
Key2 ();
//*P_INT_Ctrl=0x0010;
i=rand()%10;
if(*P_INT_Ctrl&C_IRQ4_1KHz)
for(g_uiClockCnt=0;g_uiClockCnt<1024;g_uiClockCnt++)
{
LedDispDig(2,0);
LedDispDig(1,2);
}
for(Dig=1;Dig>=0;Dig--)
for(j=9;j>=0;j--)
{
for(a=9;a>=0;a--)
for(b=9;b>=0;b--)
for(c=9;c>=0;c--)
for(g_uiClockCnt=0;g_uiClockCnt<2;g_uiClockCnt++) //for(count1=0;count1<4000;count1++)
{
LedDispDig(2,j);
LedDispDig(1,Dig);
LedDispDig(3,a);
LedDispDig(4,b);
if(Dig==0)
{
if(j<=i)
{
indate=KeyScan2();
if(0x00ff&indate!=0)
{
k=1;
goto loopb;
}
}
}
if(Dig==0)
if(j==i&&a==0&&b==0&&c==0)
{
Ledeng(7,0x00ff);
}
}
}
while(1)
{
LedDispDig(2,0);
LedDispDig(1,0);
LedDispDig(3,0);
LedDispDig(4,0);
fuwei=KeyScan1();
if(fuwei==0x0002)
goto loopa;
}
loopb:while(k)
{
//LedDispDig(2,j);
//LedDispDig(1,0);
LedDispDig(3,i-j);
LedDispDig(4,a);
LedDispDig(5,b);
LedDispDig(6,c);
if(indate!=0)
{
if(indate==0x0080)
{
n=1;
date =0x0001;
}
if(indate==0x0040)
{
n=2;
date =0x0002;
}
if(indate==0x0020)
{
n=3;
date =0x0004;
}
else if(indate==0x0010)
{
n=4;
date =0x0008;
}
else if(indate==0x0008)
{
n=5;
date =0x0010;
}
else if(indate==0x0004)
{
n=6;
date =0x0020;
}
/*else if(indate==0x0002)
{
n=7;
date =0x0040;
}*/
else if(indate==0x0001)
{
n=8;
date =0x0080;
}
}
Ledeng(7,date);
LedDispDig(1,n);
fuwei=KeyScan1();
if(fuwei==0x0002)
goto loopa;
}
}
}
void IRQ5(void) __attribute__ ((ISR));
void IRQ5(void)
{
}
void IRQ6(void) __attribute__ ((ISR));
void IRQ6(void)
{
}
void IRQ7(void) __attribute__ ((ISR));
void IRQ7(void)
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -