ISR codes gets lost

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

cross mob
Anonymous
Not applicable

Greetings,

   

I keep on losing my ISR code wirtten inside CY_ISR(intoncmp_Interrupt) function in intoncmp.c file.  After writing and saving it remains there but when i upload the code or open the file some other time , code vanishes automaticaly.

   

How can i resolve this issue?

   

 

   

Thanks

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

How can i resolve this issue?

   

Don't use this way of injecting code into generated files. When they are re-generated they might get overwritten.

   

There are some clearly marked placed where you may insert declarations or code. Only those areas will survive a re-buld.

   

There are two other ways to control the code flow for interrupt handlers:

   

Using the Component_StartEx() API (explained in the component's datasheet)

   

or using "macro callbacks"  (explained in Creator Help)

   

I (personally) do not tamper one of the generated .c files (to be quite honest, I rarely do look into them at all). I prefer using StartEx() which allows me to delete from time to time all the generated files (keeping a workspace bundle quite small) and re-generate them at need.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thank you.

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

You are always welcome!

   

 

   

Be creative 😉

   

Bob

0 Likes