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.

someting wrong with PWM counter

Hellow: I'm using F28335 and I want to know if the DSP can finish the program in time. so I use the following sentences to record time. However, I get some numbers that comfuse me... (TBPRD=5000, count up and down mode) PWMr2=EPwm1Regs.TBCTR; cr2=EPwm1Regs.TBSTS.bit.CTRDIR; The number I get doesn't seem right. For example, if I use the following sentences: PWMr2=EPwm1Regs.TBCTR; cr2=EPwm1Regs.TBSTS.bit.CTRDIR; PWMr3=EPwm1Regs.TBCTR; cr3=EPwm1Regs.TBSTS.bit.CTRDIR; I get: PWMr2=1280; cr2=0; PWMr3=2200; cr3=0; How can this be possible? It seems that at least 10000 pwm circles have passed. But there are only for sentences. What's wrong with this method? Or is there any better idea to record the time that has been used? (I tried DSP/BIOS, but it seems to hard for me...) Thank you very much!
  • C2000 devices have internal timers, these can be used to profile the code. Just put the timer registers in the watch window. Alternatively CCS supports profiling of the code. Depending on the version of CCS you are using the locations may be different.

     

    Also for very accurate timing it is ideal to toggle GPIO's and use a scope to measure the time.