Interrupt mess

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
greg79
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

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
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

 

lock attach
Attachments are accessible only for community members.
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

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."

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

0 Likes
greg79
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

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

0 Likes