View Single Post
Old 04-14-2008, 10:46 AM   #25 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location: ÿ
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 269 Times in 212 Posts
interrupt vectors
2 0x0002 INT0 External Interrupt Request 0
3 0x0004 INT1 External Interrupt Request 1
4 0x0006 PCINT0 Pin Change Interrupt Request 0
5 0x0008 PCINT1 Pin Change Interrupt Request 1
6 0x000A PCINT2 Pin Change Interrupt Request 2

arduino board mappings:
INT0 = digital pin 2
INT1 = digital pin 3
PCINT0= digital pin 8
PCINT1= digital pin 9
PCINT2= digital pin 10
PCINT3= digital pin 11
PCINT4= digital pin 12
PCINT5= digital pin 13

attachInterrupt only works with INT0 and INT1, so need to (INT0 example, translate for PCINT):
<chickenscratch>

#include <avr/interrupt.h>
...

int sensePin = 2;

...
ISR(INT0_vect) {
value = digitalRead(sensePin);
}
...
setup()
// Global Enable INT0 interrupt
GICR |= ( 1 < < INT0);
// Signal change triggers interrupt
MCUCR |= ( 1 << ISC00);
MCUCR |= ( 0 << ISC01);

}

</chickenscratch>

Don't know why there are not interrupt vectors for all the PCInts yet.

Note: in an ideal place we would use 6 external interrupts, 3 buttons, 1 injector signal, 1 vss signal, and one ignition power. But I recon we can poll the buttons and the ignition power if absolutely necessary.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 04-14-2008 at 10:53 AM..
  Reply With Quote