Greetings,
I am new to Microcontroller programming and I tried 2 approaches to stop the timer configured in PWM Mode from generating a PWM (to obtain a off-period).
I was unable to do so using disableClock( ) and enableClock( ) whereas just replacing it by stopCounter( ) and startCounter( ) respectively, I was able to halt the PWM and create the off time.
This was my logic: The Timer needs the clock to function, and if the clock is disabled, the PWM should stop as well.
The objective of my task was to generate a PWM with a off-time of 400ms and a 50% duty, 1kHz pulse during the 400ms on-time.
Therefore, I used 2 timer instances TIMG0(down-counting timer for 1kHz PWM) and TIMG1(up-down counting timer with 800ms period).
I have attached a drive link to the image of the TIMG1 Interrupt handler code I wrote to do this.
Please let me know if anyone knows why the clock wasn't getting disabled during the program run, despite the load event of TIMG1 being achieved.
Thanks in advance and I am happy to provide more Information.