View Single Post
Old 08-19-2013, 12:11 PM   #10 (permalink)
t vago
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 828
Thanked 708 Times in 456 Posts
Can you give us a list of the interrupt vectors you're using? Such as -

Code:
ISR( TIMER2_OVF_vect ) { // system timer interrupt handler
ISR( INT0_vect ) { // fuel injector open event handler
ISR( INT1_vect ) { // fuel injector close event handler
ISR( PCINT1_vect ) { // button and VSS pin change vector
ISR( ADC_vect ) { // (freewheeling) A/D conversion completed vector
ISR( USART_UDRE_vect ) { // serial UART transmit data ready vector
I am asking because I had the hardest time trying to get my serial output routine to work as interrupt driven code. I'd write a change into the code, program my MPGuino, turn on serial output via parameter, then watch my MPGuino continually reset.

It turns out that the Arduino compiler would blindly accept anything placed within the "ISR()" parentheses. For my serial output ISR, I could have written:

Code:
ISR( this_is_not_defined_vect ) { // serial UART transmit data ready vector
And Arduino would have compiled it with no error.

The reason that is important is because if Arduino does not have the actual interrupt vector that is found in interrupts.h (mentioned near the beginning of the MPGuino code), then whatever is inside the ISR() parentheses will default to interrupt vector 0. That happens to be the processor reset vector.
  Reply With Quote