cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

greg79
New Contributor II

While I'm trying to learn to use PSOC interrupts, I started a project to trigger an interrupt with a timer and blink an LED. Needless to say, the LED never turns on. What am I missing? Thank you for the help in advance, 

#include "project.h"

Cy_ISR(Timer_Interrupt){
LED_Write(~LED_Read());
LED_ClearInterrupt();
}

int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
Timer_Interrupt_Start();
timer_clock_Start();
Timer_1_Start();

/* Place your initialization/startup code here (e.g. MyInst_Start()) */

for(;;)
{
/* Place your application code here. */
}
}

 

greg79_0-1629203404052.png

 

0 Likes
1 Solution
Bob_Marlowe
Expert II

You need to set the interrupt generated at TC in the timer configuration. It is also advisable to set the capture mode to "none".

Happy coding

Bob

 

View solution in original post

4 Replies
Bob_Marlowe
Expert II

You need to set the interrupt generated at TC in the timer configuration. It is also advisable to set the capture mode to "none".

Happy coding

Bob

 

View solution in original post

Len_CONSULTRON
Honored Contributor II

greg,

You were close.   Attached is a working version of the project.

Since I have a CY8CKIT-059, I set the LED pin from P0.0 to P2.1.

The other changes are commented in main.c

Len
"Engineering is an Art. The Art of Compromise."
greg79
New Contributor II

Those comments in the main.c are very helpful, thanks Len!

0 Likes
greg79
New Contributor II

Thank you! My apologies, I could only accept Bob's reply as a solution. I very much much appreciate the effort. 

0 Likes