2003-06-06 01:50 AM
Calling the same function within a main routine and an interrupt routine
2003-06-06 01:09 AM
I would like to call a function with arguments both into the main and an interrupt routine. Is this possible ? How can I be sure that the arguments are not corrupted in case the interrupt routine interrupts the main routine ? Or in other words is it possibles to pass the arguments through the stack instead of through memory or registers?
(I USE HIWARE COMPILER) See the following example: void main void { while (1) { fct (arg1,arg2); } } #pragma TRAP_PROC SAVE_REGS void interrupt 12 it_sci (void) { ....... fct (arg1,arg2); ....... } #pragma NO_OVERLAP void fct (int arg1,int arg2) { SIM // do something with arg1; ....... // do something with arg2; ....... RIM }2003-06-06 01:50 AM
I think you should disable interrupts at the first line of ''fct'' function and then enable them at the exit.
Patrik