本文来自http://blog.youkuaiyun.com/hellogv/
#include "SPCE061A.H"
unsigned int g_uiOutput=0,iii=0;
void IRQ6(void) __attribute__ ((ISR));
void IRQ6(void)
{
if(*P_INT_Ctrl&C_IRQ6_TMB1)//C_IRQ6_TMB1对应于main()中的*P_INT_Ctrl_New|=XXXXXXX
{
if(g_uiOutput==64)//用于查看是否真的以秒为累加,64为频率数
{
g_uiOutput=0;
iii++;
}
g_uiOutput++;
*P_Watchdog_Clear=0x0001;
*P_INT_Clear=C_IRQ6_TMB1;//C_IRQ6_TMB1对应于main()中的*P_INT_Ctrl_New|=XXXXXXX
}
}
main()
{
*P_SystemClock = 0x0080; //设置高的CPU主频,可以操作得更快
asm("INT OFF");
*P_TimeBase_Setup=C_TMB1_64Hz;
//这里可以选择C_TMB1_8Hz、C_TMB1_16Hz、C_TMB1_32Hz、C_TMB1_64Hz
//以及C_TMB2_128Hz、C_TMB2_256Hz、C_TMB2_512Hz、C_TMB2_1024Hz
*P_INT_Ctrl_New|=C_IRQ6_TMB1;//这里对应于C_TMB2_XXXX用C_IRQ6_TMB1,C_TMB1_XXXX用C_IRQ6_TMB1
asm("INT IRQ");
while(1)
{
*P_Watchdog_Clear = C_WDTCLR;
}
}