Strangest thing: INT0 generates Reset and handling INT0 (INT0_vect) handles Reset :-( on ATMega168.
2011-01-24 by Cat C
Hi there, I'm using an ATMega168-20AU to read a temperature sensor connected to PD2 (INT0). The sensor sends it's data every second without being requested, so I chose INT0 to read it in an ISR whenever it sends it. SO: 1. It doesn't work; and I don't expect it to work first try, BUT: 2. If I try to read it in the "INT0_vect" handler, the Reset button stops working, instead it goes to my Handler. 3. If I remove my Handler, the Sensor output resets the microcontroller. My Interrupt setup does 2 things (sorry about the missalignment): //EICRA = External Interrupt Control Register A EICRA = 0b00000010; //Change to "0b00001010" to ALSO read Temp2 // |||||||| // ||||||\\ - ISC01:00, Interrupt Sense Control 0. Falling edge of INT0 generates INT // ||||\\-- - ISC11:10, Interrupt Sense Control 1. Falling edge of INT1 generates INT // \\\\---- - Reserved, always read "0" //EIMSK = External Interrupt Mask Register EIMSK = 0b00000001; //Change to "0b00000011" to ALSO read Temp2 // |||||||| // |||||||\ - INT0, External Interrupt Request 0 Enable // ||||||\- - INT1, External Interrupt Request 1 Enable // \\\\\\-- - Reserved, always read "0" What am I doing wrong? Thanks, Cat