Hello can someone tell me why my interrupt does not respond, with the debugger, I always get z = 0
double z; main { . . . . . . while(1) { CC1_M2 = 0x0001;// 001=>capture on posirtive Flanke CC1_T01CON = 0x0047; CC1_CC8IC = 0x00C0; // Interrupt enable und z = Periode ; }//end of while }// end of main void Drehzahl_messung(void) interrupt(0x18) { Periode = 100; }
or what I have since forgotten Thanks
Does it work if you declare z volatile?
volatile double z;
Sorry, I can't help with your problem, since I don't work with the C166 processor.
But one thing to think about is your assign of the double value in the interrupt handler.
Is the C166 processor capable of writing a double (or if it is just an alias for a float) atomically? If not, then the main loop may read broken values if the interrupt happens in the middle of a read, unless you synchronizes the accesses, possibly by _atomic_/_endatomic_.
Another thing: Are floating point operations supported in both the interupt handler and the main program at the same time?
View all questions in Keil forum