Hi everybody, need help or advice.
Work with mc68hc912bc32 in Code Warrior ver. 5.5 without Processor Expert using C.
Have a problem - when RTI called my program become to a cycle in RTI procedure and never return to main procedure (but other interrupts work for some time). It seems like return vector rewrites to RTI procedure but not to last operation in main procedure in moment of RTI called. So RTI procedure becames as main and gets cycle in it all time. For some time of such working microcontroller's stack overflow! (in C! not assembler). All other interrupts work correctly, when I use assembler all is ok too. That's problem?
I've wrote little demonstration project, that also have this problem and put it here. Can you look to it? May be there is some error in initialization of RTI or some header file forget?
Thank you. If any questions ask me.
Solved! Go to Solution.
Evgenij wrote:So, why stack overflow I know now - the interrupt procedure become recursive many times, I think so.
For clearing interrupt flags I guess too. But what I've done with RTI it does not work. As I think I've clear RTIF (1 = Set when the time-out period is met) in RTIFLG.So at the end of RTI procedure I write:RTIFLG = 0;
But it also doesn't work and value of RTIFLG register stays 0x80 at memory map in simulation. Is it not writable? I think it is read and write anytime. Other interrupts work correctly as for my eyes.
Can you complement my procedure for full and right?