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.

CCS/TMS320F28035: How to calculate the PWM duty(200Hz) by HRCAP module

Part Number: TMS320F28035
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

hello , 

I am working base on TMS320F28035,

i want to calculate the duty of pulse by HRCAP, but the counter is 16 bit , can not sample the lower frequency pulse, so , i do not know how to set the HRCAP , and how to calculate the PWM duty.

thank you very much 

  • Suibao,

    My first question is "do you really need HRPWM at 200Hz?". At slower frequencies you should be able to get good enough resolution out of just the basic ePWM.

    When you are trying to create very slow signals you have 2 options.

    1. Slow down your TBCLK and use up-down count mode in the ePWM module.
    2. Use the eCAP module's APWM mode, which has 32 bit counters.

    Regards,
    Cody 

  • ok, than you very much,

    now my question is how to calculate Duty ratio of external pulse by HRCAP module base on TMS320F28035, 

    and frequency of external pulse is 200Hz, because the counter of HRCAP is 16 bit , so it is difficult to calculate the duty ratio of external pulse by the HRCAP , 

    i do not know how tocalculate Duty ratio of external pulse.

  • ok, than you very much,

    now my question is how to calculate Duty ratio of external pulse by HRCAP module base on TMS320F28035, 

    and frequency of external pulse is 200Hz, because the counter of HRCAP is 16 bit , so it is difficult to calculate the duty ratio of external pulse by the HRCAP , 

    i do not know how to calculate Duty ratio of external pulse.

  • Suibao,

    again similar to the HRPWM I don't expect that you need the added accuracy of the HRCAP. I would suggest using an ECAP because it has the 32bit timers.

    The duty ratio is simple, setup the eCAP for a rising-falling-rising measurement and calculate the period between two rising edges and subtract the time between the first rising edge and the first falling edge.

    C2000Ware has a helpful example here:C:\ti\c2000\C2000Ware_2_00_00_02\device_support\f2803x\examples\c28\ecap_capture_pwm

    Regards,
    Cody