S5PV210 timer

TCFG0, R/W, Address = 0xE250_0000
Timer Input Clock Frequency = PCLK / ( {prescaler value + 1} ) / {divider value}
1

TCFG1, R/W, Address = 0xE250_0004
1

CON, R/W, Address = 0xE250_0008
1

TCNTB4, R/W, Address = 0xE250_003C
1

举例

#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;
    }
}
posted @ 2017-09-04 22:15  thomas_blog  阅读(112)  评论(0编辑  收藏  举报