2011-10-09 05:38 AM
Hi:
STM8S105C6 is used in my project. I want to create the interrupt process in main.c, the compiler is cosmic. In general, the interrupt function is created in stm8_interrupt_vector.c. So i want move it into the file of main.c. Can you tell how to do? thanks! Best Regards! Fred #describe-the-goal-not-the-step2011-10-09 11:15 AM
''I want move it into the file of main.c''
Why?
2011-10-09 05:51 PM
Hi:
Aim to put all function into main.c. Fred2011-10-18 09:48 AM
Warning...
If you need it, it's better using ''extern volatile'' variables in main, accessed by the interrupt.c file. A much better way is to make a set of ''set_var'' ''get_var'' ''clr_var'' functions in your main and call them from your interrupt.c file. For example, the timer interrupt will add a second in the RTC.2011-10-20 01:26 PM
What constitutes ''better'' depends very much on the particular system requirements & constraints.
Very often, it is important that ISRs are as ''lean and mean'' as possible - so the overhead of calling a function to get the value into a local copy, update the local copy, and then call another function to write it back may be undesirable. At least consider providing a function to increment the count in a single call...