📄 isr.c
字号:
#include"SPCE061A.h"
unsigned char ledCode[11] = {0x003f,0x0006,0x005b,0x004f, 0x0066,0x006d,0x007d,0x0007,0x007f,0x006f, 0x00};
//共阴接法'0''1''2''3''4''5''6''7''8''9'的代码
unsigned char ledBit[6] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
unsigned char dispbuf[6] = {10, 10, 10, 10, 10, 10};
unsigned char t1msCounter= 0;
unsigned char t1sCounter = 0;
unsigned char bitCounter = 0;
unsigned char Index = 0;
unsigned char i;
void BREAK(void) __attribute__ ((ISR));
void FIQ(void) __attribute__ ((ISR));
void IRQ0(void) __attribute__ ((ISR));
void IRQ1(void) __attribute__ ((ISR));
void IRQ2(void) __attribute__ ((ISR));
void IRQ3(void) __attribute__ ((ISR));
void IRQ4(void) __attribute__ ((ISR));
void IRQ5(void) __attribute__ ((ISR));
void IRQ6(void) __attribute__ ((ISR));
void IRQ7(void) __attribute__ ((ISR));
void BREAK(void)
{
//add your code here
}
void FIQ(void)
{
//add your code here
}
void IRQ0(void)
{
//add your code here
}
void IRQ1(void)
{
t1msCounter++;
if(t1msCounter >=4) //4ms刷新一次LED
{
t1msCounter = 0;
*P_IOB_Data = ledBit[bitCounter];
*P_IOA_Data = ledCode[dispbuf[bitCounter]];
bitCounter++;
if(bitCounter >= 6) bitCounter = 0;
}
t1sCounter++;
if(t1sCounter >= 1000)
{
t1sCounter = 0;
Index++;
if(Index >= 6) Index = 0;
for(i = 0; i <6; i++)
dispbuf[i] = 10;
for(i = 0; i < Index; i++)
dispbuf[i]=Index;
}
*P_INT_Clear=C_IRQ1_TMA; //clear INT flag
}
void IRQ2(void)
{
//add your code here
}
void IRQ3(void)
{
//add your code here
}
void IRQ4(void)
{
//add your code here
}
void IRQ5(void)
{
//add your code here
}
void IRQ6(void)
{
//add your code here
}
void IRQ7(void)
{
//add your code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -