您的位置: OpenADSP社区论坛 -> Blackfin专区 -> 新手上路 -> BF609开发板定时器波形输出
本帖共有875个阅读者
发表帖子 发表投票 回复主题
BF609开发板定时器波形输出
kladsp(论坛新手)
kladsp
头衔:社区公民
帮派:无帮无派
帖数:66
金钱:634
积分:88
注册时间:2015/1/26
楼主信息 | 留言 | Email | 主页 | 编辑 | 管理 | 离线
BF609开发板定时器波形输出

BF609开发板,A17插座把 PE14管脚引出了,这个脚作为定时器TMR0的输出管脚,我程序把定时器设置为PWM_OUT工作模式,开启了管脚复用功能,但是用示波器没有在这个管脚看到 波形输出,为什么呢?

定时器配置代码是官方发布的代码:

/*******************************************************************
*   Function:    Init_Timers
*   Description: This function initializes Timer0 for PWM mode.
*******************************************************************/
void Init_Timers(void)
{
/* active state, auto reload, generate no interrupt */
*pTCNTL = BITM_TCNTL_PWR | BITM_TCNTL_AUTORLD | BITM_TCNTL_INT ;
*pTPERIOD = TIMEOUT_PERIOD;
*pTSCALE = TIMEOUT_PERIOD/2;

/* enable the timer */
*pTCNTL |= BITM_TCNTL_EN;
}

/*******************************************************************
*   Function:    Init_Timer_Interrupts
*   Description: This function initializes the interrupts for Timer0
*******************************************************************/
void Init_Timer_Interrupts(void)
{
    ADI_TMR_RESULT eTmrResult   =   ADI_TMR_SUCCESS;

    if(!ghTimer)
    {
    /* Open the timer */
    if( (eTmrResult = adi_tmr_Open (
            TEST_TIMER_NUM,
            TimerMemory,
            ADI_TMR_MEMORY,
            TimerHandler,
            NULL,
            &ghTimer)) != ADI_TMR_SUCCESS)
    {
     DEBUG_PRINT("Timer open failed 0x%08X \n", eTmrResult);
    }

    /* Set the mode to PWM OUT */
    if((eTmrResult = adi_tmr_SetMode(
            ghTimer,
            ADI_TMR_MODE_CONTINUOUS_PWMOUT)) != ADI_TMR_SUCCESS)
    {
     DEBUG_PRINT("Failed to open timer in PWM out mode 0x%08X \n", eTmrResult);
    }

    /* Set the IRQ mode to get interrupt after timer counts to Delay + Width */
    if((eTmrResult = adi_tmr_SetIRQMode(
            ghTimer,
            ADI_TMR_IRQMODE_WIDTH_DELAY)) != ADI_TMR_SUCCESS)
    {
     DEBUG_PRINT("Failed to set the timer IRQ mode 0x%08X \n", eTmrResult);
    }

    /* Set the Period */
    if((eTmrResult = adi_tmr_SetPeriod(
            ghTimer,
            TIMER_PERIOD)) != ADI_TMR_SUCCESS)
    {
     DEBUG_PRINT("Failed to set the timer Period 0x%08X \n", eTmrResult);
    }

    /* Set the timer width */
    if((eTmrResult = adi_tmr_SetWidth(
            ghTimer,
            TIMER_WIDTH)) != ADI_TMR_SUCCESS)
    {
     DEBUG_PRINT("Failed to set the timer Width 0x%08X \n", eTmrResult);
    }

    /* Set the timer Delay */
    if((eTmrResult = adi_tmr_SetDelay(
            ghTimer,
            TIMER_DELAY)) != ADI_TMR_SUCCESS)
    {
     DEBUG_PRINT("Failed to set the timer Delay 0x%08X \n", eTmrResult);
    }

    /* Enable the timer to stop gracefully */
    if((eTmrResult = adi_tmr_EnableGracefulStop(
            ghTimer,
            true)) != ADI_TMR_SUCCESS)
    {
     DEBUG_PRINT("Failed to enable the timer to stop gracefully 0x%08X \n", eTmrResult);
    }
    }
    /* Enable the timer*/
    if((eTmrResult = adi_tmr_Enable(
            ghTimer,
            true)) != ADI_TMR_SUCCESS)
    {
     DEBUG_PRINT("Failed to enable the timer 0x%08X \n", eTmrResult);
    }
}



「该帖子被 kladsp 在 2015-03-12 15:13:56 编辑过」

这家伙很懒,什么也没有留下!
等级:论坛新手 参考IP地址:*.*.*.*
2015/3/12 14:51:00
kladsp(论坛新手)
kladsp
头衔:社区公民
帮派:无帮无派
帖数:66
金钱:634
积分:88
注册时间:2015/1/26
1信息 | 留言 | Email | 主页 | 编辑 | 管理 | 离线
配置错误,可以输出了

这家伙很懒,什么也没有留下!
等级:论坛新手 参考IP地址:*.*.*.*
2015/3/16 13:30:51
Powered by OpenADSP Copyright © 2010 www.Openadsp.com. All rights reserved.159972 Call, 1 Queries, Processed in 0.015625 second(s),