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: Cedar Rapids, IA
Posts: 1,766

The Karen-Mobile - '05 Dodge Magnum SXT
Team Dodge
90 day: 26.72 mpg (US)

Fiat Dakota - '00 Dodge Dakota SLT RWD Quad Cab
90 day: 16.67 mpg (US)

The Red Sled - '01 Dodge Durango SLT 4WD
90 day: 16.96 mpg (US)
Thanks: 799
Thanked 682 Times in 437 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.
__________________
The Fiat Dakota


The Karen-mobile


The Red Sled
  Reply With Quote