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/RM42L432: change PWM duty cycle and frequency

Part Number: RM42L432
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Dear team,

I have the same question.Please help.

In my application, I have to generate PWM in HET IDE and this PWM duty cycle and frequency I have to change in my application main code.

How this can be done?

  • Hi Susan,

    The instructions MOV32 and MOV64 can modify the data field of other instructions. This feature enables the N2HET program to implement double buffering on capture and compare functions. For example, the PWCNT and DJZ instructions can be followed by a MOV64 instructions that is conditionally executed when the PWCNT or DJZ instruction matches. The host CPU can update the next compare value by writing asynchronously to the data field of the MOV64 instruction instead of writing directly to the data field of the PWCNT and DJZ instructions.

    Please refer to the het.c generated by HALCOGen.

    In het.c, the instruction 1 (line 100) and instruction 2 (line 117) are for PWM duty and period. The instruction 41 (line 780) and instruction 42 (line 797) are to update the data field and control field of PWCNT and DJZ instructions.

  • Many thanks!

    Besides,I want to know why my configuration can not generate PWM. Please help.

  • Hi Susan,

    The code looks ok for me. 

    Have you make it work?