#include "config.h"
/*#define Fosc 11059200 这部分在config.h中以有定义
#define Fcclk (Fosc * 4)
#define Fcco (Fcclk * 4)
#define Fpclk (Fcclk / 4) * 1
*/
void T0Init(void)
{
T0PR = 99;//晶振11.0592mhz/100
T0MCR = 0X03;
T0MR0 = 110592/2;//定时0.5s
T0TCR = 0X03;
T0TCR = 0X01;
}
int main(void)
{
TargetResetInit();
PINSEL0 = 0X00000000;
IODIR = 0X01;
IOSET = 0X01;
T0Init();
for(;;)
{
if(T0IR&0x01==0)
{
T0IR = 0X01;
if(IOSET&0X01==0)
{
IOSET = 0X01;
}
else
{
IOCLR = 0X01;
}
}
}
return 0;
}
程序实现P0.0在0.5秒中翻转一次,可不知道怎么的就是不能实现......... |