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.

Can't stop PWM

Other Parts Discussed in Thread: HALCOGEN

I am using HALCogen to create a simple 0% PWM signal from the N2HET. I don't really care about the PWM, I am just using the end-of-period interrupt as a 10ms timing base. My problem is I would like to stop this timer every time it interrupts, perform a certain action (i.e. perform an i2c transfer), and then restart it.

When I stop the PWM (using pwmStop()) it stops the actual waveform generation, however the clock still runs on. Therefore, when I restart the timer (using pwmStart()) it interrupts too early.

1) Is there any way to completely stop the pwm (i.e. both the signal AND the counter) without stopping other N2HET programs that are running on the same bus?

2) I am currently using the PWM merely as a timing base. This is the best way I could think of doing so without using the RTI peripheral. Is there a better way to achieve this without using the RTI?

Thanks for the help!

  • Hello Kornecki-san,

      The HET program generated by HalcoGen is a generic program to illustrate various PWM and Input capture capabilities. You can only use the pwmStop() to stop the pin action but not the counter.

      For your application that you merely just need a timer, I will suggest that you create a custom HET program. .  I will recommend that you utilize the DJZ instruction. The DJZ acts as a virtual timer. You will preload the DJZ with your desired timer value. When the timer expires it will geneate an interrupt and wait for your to re-enter the timer value to restart counting.