定時器初始化原始碼

痞子晶發表於2016-08-01


定時器初始化,定時一秒

具體看手冊。。。


#define TCFG0 	(*(volatile unsigned *)(0x51000000))
#define TCFG1 	(*(volatile unsigned *)(0x51000004))
#define TCNTB0 	(*(volatile unsigned *)(0x5100000C))
#define TCON 		(*(volatile unsigned *)(0x51000008))

void time0_init(void)
{
	TCFG0 = 99;		
	TCFG1 = 0x03;
	TCNTB0 = 41666;
	TCON |= (1<<1);
	TCON = 0x09;
	INTMSK1 &= ~(1<<10);
}


相關文章