PWM Overflow Interrupt - Forums Re: PWM Overflow Interrupt Hi Abhijit,


Thank you very much for the feedback.

The use of 'ReadStatus Register( )' to clear interrupts is mentioned in the Component datasheet rather than in device datasheet.

"The interrupt output is the logical OR of the group of possible interrupt sources. This
signal will go high while any of the enabled interrupt sources are true. The interrupt output
shall remain asserted until the Status Register is read out by the software. In order to
receive subsequent interrupts, the interrupt shall be cleared by reading the Status
Register using the PWM_ReadStatusRegister() API. The interrupt output is not visible if
the Use Interrupt parameter is not set. This allows the status register to be removed for
resource optimization as necessary."

Wed, 25 May 2011 23:44:25 -0600
Re: PWM Overflow Interrupt Hi

I feel that a lot of small things need to be added to the datasheet; for example NONE of the datasheets mention that PWM0_ReadStatusRegister(); must be called to get the PWM interrupt ready for the next time. In the datasheet for the ISR there is but one vague reference -

"Some interrupt sources will also need to be cleared with the appropriate block API (GPIO, UART, …) or they will just re-pend the interrupt. Entering the ISR will clear the pending bit for some interrupt sources."

@Cypress folks - I believe some effort is needed to make datasheets a bit more comprehensive in covering all these small nuggets of info!


Tue, 24 May 2011 05:30:41 -0600
Re: PWM Overflow Interrupt Oh dang! I was missing just the global interrupt enable statement... "CYGlobalIntEnable". Working now.

BTW It was not there in the default generated main(). It'd be a good idea if the datasheets for the components with interrupts mentioned this...




Wed, 18 May 2011 09:54:14 -0600
Re: PWM Overflow Interrupt Hey Abhijit,


Can you please tell us on what event you want an Interrupt to be triggered?

Whether you want Interrupt on Terminal Count or on Compare 1 Event? According to your requirement, you can choose any of these. It can be seen in the Advanced tab as shown below.




In main( ), don't forget to uncomment the CYGlobalIntEnable. Else Interrupt will never be triggered.


In the isr.c, include the PWM0.h and all other header files which you'll be using in the ISR vector. These should be written inside the #START and #END statements. Any other variables can also be declared here. If they are used in main too, then use the keyword "extern".




In the CY_ISR( ) function read the status register to clear the interrupt bit as it is sticky. Then you can set variables according to your logic.





This can get your Interrupt to working. Let us know if this helps.

Wed, 18 May 2011 07:45:47 -0600