xiaolin198832 发表于 2014-8-13 20:28:47

ok6410A定时器配置

ok6410A定时器怎么配置没成功!请问这行代码:g_pVIC0Reg->VIC0INTENABLE |= 1<<24;//开timer1的使能(相当于关掉mask)出错了,wince6.0怎么启动定时器呢?求教!!!


//配置定时器寄存器
BOOL RetValue = TRUE;
//设置timer1为1/8分频,=0x0010
    g_pPWMRegs->TINT_CSTAT |= 1<<1;   //开timer1中断,允许timer1中断发生
   //g_pVIC0Reg->VIC0INTENABLE |= 1<<24;//开timer1的使能(相当于关掉mask)
   g_pPWMRegs->TCFG1 &= ~(0x01 << 4);
    g_pPWMRegs->TCFG1 |= 0x01 << 5;
    g_pPWMRegs->TCFG1 &= ~(0x11 << 6);
    //设置timer1的控制寄存器
   g_pPWMRegs->TCON |= 0x01 << 11; //auto reload
    g_pPWMRegs->TCON &= ~(0x01 << 10); //output off
    //pTimerReg->TCON |= 0x01 << 10; //output on
    g_pPWMRegs->TCON &= ~(0x01 << 9); //manual update off
    g_pPWMRegs->TCON &= ~(0x01 << 8); //timer1 stop
    ///////////////PCLK = 50M, prescaler = 0
    //设置定时器的counter寄存器,2ms;
    g_pPWMRegs->TCNTB1 = 488;
    //设置定时器的compare寄存器
   g_pPWMRegs->TCMPB1 = 244;

xiaolin198832 发表于 2014-8-13 20:30:28

帮忙看看多谢!!!!!!!!

独家记忆 发表于 2014-8-14 08:44:46

楼主,您可以参考一下底层驱动下的蜂鸣器驱动,或者参考网上的背光驱动、、、、:)
页: [1]
查看完整版本: ok6410A定时器配置