This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Gating control for timers

Other Parts Discussed in Thread: TMS320F28027F

Hi,

I'm currently using Piccolo lauchPad  with booster kit and I am going thru TMS320F28027F datasheets and Timer-section.
Previous Microcontrollers I have used had gating control for Timers which means that external pin is able to enable Timer to run. Now in This Piccolo there seems to be no gating control, only direct clock drive when Timer is set to run by direct register control.

What do you suggest, what is the best way to achieve this functionality, simply polling an input pin and when pin is "high" timer is run, else not run ?

-Jay

  • Hi Jay,

    user4246147 said:
    What do you suggest, what is the best way to achieve this functionality, simply polling an input pin and when pin is "high" timer is run, else not run ?

    Instead, You can make use of external interrupt to start CPU timer manually in external interrupt's ISR.

    Regards,
    Gautam

  • Hi Gautam,

    thanks for your reply.
    Gating control would be powerful way of making accurate pulse measurements. I have a pulse input round 10-50mS and that pulse is to be measured. So you suggest I start the timer with edge of that pulse setting the interrupt, maybe I then should switch the interrupt to be descending edge causing another interrupt on the high to low edge (don't know at this point if that is possible ). This would be quick way to handle since I'm running on 60MHz, but I'm also running FOC which is interrupt consuming process what have I understood.

    -Jay
  • Hi Jay,

    The eCAP peripheral doesn't do exactly what your referring to, but it is in many ways more suited to measuring the time between square-wave transitions (measuring pulse-widths/duty-cycles, periods, etc).  You can find more information about this peripheral in the eCAP User's Guide.

    Hopefully this helps!


    Thank you,
    Brett

  • Gating control could be done with this simple method: take system clk out from pin and feed it to Timer2 external CLK input thru 2 input AND gate.
    The other input on AND gate is fed to external pulse to be measured. NOw pulse allows system CLK to go to Timer2 when pulse is active. When external pulse goes back to low it creates an interrupt and T2 can be read.

    -Jay