Regarding interrupts of psoc3

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.
Anonymous
Not applicable

hi...........

   

                      while iam trying to implement PICU interrupt project from AN54460 application note of cypress....iam unable to make user defined function as ISR..instead, a default ISR is generating by my PSOC creator 2.0....Here iam mentioning the steps what i followed......please notice it....
          
                     1) I had taken two digital input pins for switches, which are again connected to two Interrupt pins.
                     2) Two digital output pins for two LEDS
                     3) Interrupt type parameter for both interrupts isr_1 and isr_2 is configured as DERIVED
                     4) isr_1 assigned a higher priority than isr_2
                  
                     5) when i go to  'Build > Generate application" a default ISRs for two interrupts are generating, just same to that of "MY FIRST INTERRUPT PROJECT" from the same application note.....an i coudnt find "InterruptRoutines.h" file on source files
 
             and at the end of document it is mentioned that the AN54460.cywrk workspace contains four code examples to demonstrate the topis of this application note.....can you please help me, how to open it....and from where i can retrieve this....

0 Likes
10 Replies
Anonymous
Not applicable

 Hi sivananda,

   

 

   

There is an auto generated ISR_1.c file generated in A_MyFirstInterruptProject where the follwoing interrupt handler code is written.

   

   

/*******************************************************************************

   

*  Place your includes, defines and code here 

   

********************************************************************************/

   

/* `#START isr_1_intc` */

   

#include <Timer_1.h>

   

/* Global variable definition */

   

volatile uint8 toggle_flag = 0;

   

/* `#END` */

   

 

   

   

CY_ISR(isr_1_Interrupt)

   

{

   

    /*  Place your Interrupt code here. */    /* `#START isr_1_Interrupt` */    

   

    /* Read the timer status register to   clear the interrupt */ 

   

    Timer_1_ReadStatusRegister();    

   

    /* Set the flag variable */

   

    toggle_flag = 1;

   

    /* `#END` */   

   

}

   

   

   

 

   

This the space made available to handle code.

   

 

   

Instead, there is an alternate way doin this.You can define the function in the source code files which is done in the second example proj in appnote (B_PicuInterruptProject). Use the following lines in main.c files to acheive this:

   

 

   

CY_ISR(my_interrupt_routine)

   

{

   

// interrupt handle code

   

}

   

 

   

main()

   

{

   

CYGlobalIntEnable;

   

ISR_1_StartEx(my_interrupt_routine);

   

}

   

 

   

The isr.c and .h files are generated for every interrupt that you use. To avoid using these generated files, use the above lines of code to do it in the source files.

   

Hope this helps.

   

 

   

Thanks,

   

srim

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 All the four projects are present in the same workspace (see image attached) of the appnote

0 Likes
Anonymous
Not applicable

 if you want to use your own interrupts (isr_1 and isr_2), you can go to the configuration of the pin and in under the input tab, slect interrup to none. 

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I cannot recommend this way of using interrupts, because when switching from PSoC3 to PSoC5 (or later 4) it breaks code.

   

Instead I recommend to declare your own interrupt functions

   

CY_ISR_PROTO(MyIntFunc); // Prototype declaration

   

and

   

CY_ISR(MyIntFunc) // Interrupt function definition

   

{

   

// Code goes here

   

}

   

 

   

and in the initialization part of the program

   

 

   

isr_StartEX(MyIntFunc); // Start Interrupt with my handler

   

 

   

This suggestion will prevent you from funneling around in generated code, keeping everything together in your own files.

   

For the CY_ISR-macro have a look into the "System Reference Guide" under Help -> Documentation..

   

 

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

By the way, I remember to have read not to connect interrupts to external pins when they are acted with mechanical switches, so take care for that and if appropriate use a debouncing algorithm.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 Bob is right, don't use interrupt with switch input directly.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Use the glitch filter with a pin to effect an ISR on a pin.

   

 

   

      http://www.cypress.com/search.cfm?q=GPIO+interrupts&sa.x=22&sa.y=18

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

This one as well. 

   

 http://www.cypress.com/?rID=2674

   

 

   

0 Likes
Anonymous
Not applicable

Bob Marlowe - thank you for the suggestion. I too prefer your approach because I can write my ISR routines in main.c and avoid external declaration of variables and keep track of them in both files...No I can keep all in one source file.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Additionally there is a path in the Workspace Explorer named "Generated_Source" which I delete from time-to-time. You cannot do that if you modified any of the files inside which I strongly avoid to do.

   

 

   

Bob

0 Likes