Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
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?
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.
Hello,
The HET IDE contains two examples:
1. PWM with synchronous duty cycle update at compare match event
2. PWM with synchronous duty cycle update at period end
In those two examples, the CNT is used as counter, ECMP is to toggle the pin when the counter value matches the data in ECMP data field, then toggle the pin back when the counter value is equal to the max value in CNT.
The MOV32 is used to update the data value of ECMP instruction.
Hello Wang,
Thanks. It helped.
I do not have hardware at my end to test.
1) Just want to know if we can use a similar approach to change the period of PWM using HET?
Below is the code sniffet in HET IDE
FLAME_PERIOD_CHANGE_9 MOV32 { remote=FLAME_TIMER_9,z_cond=ON,type=IMTOREG&REM,reg=NONE,data=1249}; CPU to write to this data field
FLAME_TIMER_9 CNT { max = FLAME_PERIOD_CNT, reg = A, irq = ON }
FLAME_PULSE_9 MCMP { action = SET, en_pin_action = ON, pin = 0, order = REG_GE_DATA, reg = A, data = FLAME_PULSE_WIDTH_CNT }
Code sniffet in CCS
HET_FLAME_PERIOD_CHANGE_9_0.mov32.data = 1000; // Configure PWM Frequency
 HET_FLAME_PULSE_9_0.mcmp.opposite_action = 1U; // Set Flame Sense PWM
Do you think it is correct?
2) Also want to know how can I generate an interrupt in the rising edge of the pulse. Is it possible through HET IDE?
Hi Wang,
I have received EVK.
I was able to generate 2kHz frequency with a duty cycle with RM42 Hercules microcontroller.
But I could not change the frequency using mov32 instruction in CCS.
HET_FLAME_PERIOD_CHANGE_9_0.mov32.data = 1000; // Configure PWM Frequency
HET_FLAME_PULSE_9_0.mcmp.opposite_action = 1U; // Set Flame Sense PWM
Can you help here?
Please use the het.c (generated by HALCoGen) as example:
1. Change the period of PWM signal:
void pwmSetSignal(hetRAMBASE_t * hetRAM, uint32 pwm, hetSIGNAL_t signal)
2. Change the duty cycle of a PWM signal:
void pwmSetDuty(hetRAMBASE_t * hetRAM, uint32 pwm, uint32 pwmDuty)