#include "config.h"
void __irq IRQ_Time0(void)//注意此函数要放在T0Init前,要不不能通过编译。
{
if((IOSET&0X01)==1)
IOCLR = 0X01;
else
IOSET = 0X01;
T0IR = 0x01; // 清除中断标志
VICVectAddr = 0x00; // 通知VIC中断处理结束
}
void T0Init(void)
{
T0PR = 99;//晶振11.0592mhz
T0MCR = 0X03;
T0MR0 = 110592/2;//定时0.5s
T0TCR = 0X03;
T0TCR = 0X01;
VICIntSelect = 0x00;
VICVectCntl0 = 0x24;
VICVectAddr0 = (uint32)IRQ_Time0;
VICIntEnable = 0x00000010;
}
int main(void)
{
// TargetResetInit();
PINSEL0 = 0X00000000;
IODIR = 0X01;
T0Init();
while(1);
return 0;
} |