TCFG0, R/W, Address = 0xE250_0000Timer Input Clock Frequency = PCLK / ( {prescaler value + 1} ) / {divider value}
TCFG1, R/W, Address = 0xE250_0004
CON, R/W, Address = 0xE250_0008
TCNTB4, R/W, Address = 0xE250_003C
举例
#define TCFG0 (*(unsigned int*)0xE2500000)
#define TCFG1 (*(unsigned int*)0xE2500004)
#define CON (*(unsigned int*)0xE2500008)
#define TCNTB4 (*(unsigned int*)0xE250003C)
#define TCNTO4 (*(unsigned int*)0xE2500040)
TCFG0 = 255 << 8;
TCFG1 = 4 << 16;
TCNTB4 = 16896; //66M/(255+1)/16
CON = (1 << 20 ) | (1 << 22) | (1 << 21); //更新一次
CON = (1 << 20 ) | (1 << 22) | (0 << 21);
while(1)
{
if(TCNTO4 == 0) //监视
{
led = ~led;
}
}
相关文章