AnsweredAssumed Answered

Timer keeps running in simulator

Question asked by monzie9000 on Jun 14, 2013
Latest reply on Jul 1, 2013 by CraigG

According to my reading of the hardware manual, a general purpose timer should stop once it has reached the width value in one shot mode.

The timer keeps running, and also doesn't reset when it reaches the width value nor the period value.

I am using the simulator while waiting for my EZ board.

Did I misconfigure something?

 

 

#include "stdio.h"

#include "cdefBF51x_base.h"

/*****************************************************************************

* Problem1.c

*****************************************************************************/

 

int main( void )

{

    int i;

    //Disable output pin

    *pTIMER0_CONFIG |= OUT_DIS;

    //Set mode to PWM

    *pTIMER0_CONFIG |= PWM_OUT;

    //Set Period

    *pTIMER0_PERIOD = 0x50000;

    *pTIMER0_WIDTH =  0x10000;

    *pTIMER_ENABLE |= TIMEN0;

   

    do

    {    i = *pTIMER_STATUS;

        printf("0X%x 0X%x\r\n",i,*pTIMER0_COUNTER);

   

    }

    while ((i & TRUN0 )==TRUN0);

    return 0;

}

Attachments

Outcomes