NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Undefined Interupt and Tips how to debug them....
November 20, 2012 by fishberg5051 |
Hi everyone, I am attempting to use an interupt in my code, and when I enable the interupts with the sei(); and cli(); functions, my chip keeps resetting and starts over from main(). Reading elsewhere someone suggested that an interupt was undefined and my overall question is if there are any tips or tricks on determine which one is not defined? I have access to a jtag ice debugger but no idea what to look for. Overall I'm attempting to get the input voltage to have a more accurate temperature sensor vs hardcoding the input voltage value. It should also be mentioned I'm using a 1284P, and I understand it may be difficult to offer suggestions based on the examples I provided but it's worth a shot. some code examples I'm attempting is:
So overall what is happening when I debug is the ADC_vect fires once, but then the __vector_default continuously fires for the board has become reset at this point and hits the sei(); and setup_adc(); functions over and over and over and over again. Any ideas are welcome, and thank you for your time. |
---|---|
November 20, 2012 by Noter |
Could it be a power problem and the brown-out detector is causing the reset? The only way I know to find an unknown software interrupt is to setup the EMPTY_INTERRUPT(vector) for each vector, one at a time, and compile/run. As soon as you don't reset then that's the one. You can find all the vectors in iom1284p.h and perhaps start by setting EMPTY_INTERRUPT on all vectors and if you still reset then it's not an unexpected interrupt that's causing it. |
November 20, 2012 by BobaMosfet |
fishberg5051- The problem is that you are doing a delay within your ISR. Don't. Ever. BM |
Please log in to post a reply.
Did you know that the Timer/Counter modules on the microcontroller can be configured to output a PWM (Pulse Width Modulation) signal? Learn more...
|