Announcements
Community Announcement : Welcome to the NEW Cypress Developer Community.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

AmMa_2724956
New Contributor II

Hello,

I want to write PWM when we get Interrupt, which is connected to ZCD.

Please provide any method for doing this.

Thanks in Advance.

0 Likes
1 Solution
Anonymous
Not applicable

Upon interrupt, set a flag.

Check the flag in main, and when it gets set, clear it, then turn on the PWM with PWM_Start().

If you want to change the PWM settings, then you will want to call PWM_Init() with the settings when you want to change them.

The API will change based on which PWM implementation you used, but something similar to the following should work:

At startup:

     TCPWM_Init();

In ISR:

     PWM_Start_Flag = true;

In Main:

     if(PWM_Start_Flag) {

          PWM_Start_Flag = false;

          if(TCPWM_ReadStatus() != STATUS_RUNNING) {

               TCPWM_Start();

          }

     }

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

Upon interrupt, set a flag.

Check the flag in main, and when it gets set, clear it, then turn on the PWM with PWM_Start().

If you want to change the PWM settings, then you will want to call PWM_Init() with the settings when you want to change them.

The API will change based on which PWM implementation you used, but something similar to the following should work:

At startup:

     TCPWM_Init();

In ISR:

     PWM_Start_Flag = true;

In Main:

     if(PWM_Start_Flag) {

          PWM_Start_Flag = false;

          if(TCPWM_ReadStatus() != STATUS_RUNNING) {

               TCPWM_Start();

          }

     }

View solution in original post

0 Likes