I'm trying to use pin change interrupts with the ATtiny because I have to use the INT0 pin for SCK in I2C.
I can trigger the interrupt, but after it fires, it runs through setup() again. It may be just rebooting - with no bootloader it's hard to tell.
The attachInterrupt() with INT0 works fine. I've tried a few different techniques and vectors [ISR (PCINT1_vect), SIGNAL (SIG_PCINT)] with similar results.
I may be doing something basically wrong here, but I can't figure out what.
Here is a sample that demonstrates the problem . . .
/* IR Receiver Test 2 GOES BACK TO MAIN WHEN I USE ISR
* SETUP:
* ATtiny Pin 1 = (RESET) N/U ATtiny Pin 2 = (D3) IR OUTPUT PIN
* ATtiny Pin 3 = (D4) to LED1 ATtiny Pin 4 = GND
* ATtiny Pin 5 = D0/SDA on GPIO ATtiny Pin 6 = (D1) Piezo
* ATtiny Pin 7 = D2/INT0/SCK on GPIO ATtiny Pin 8 = VCC (2.7-5.5V)
*/
#define LED1_PIN 4 // ATtiny Pin 3
#define PIEZO_PIN 1 // ATtiny Pin 6
#define IR_PIN 3 // IR sensor - ATtiny Pin 2
void setup(){
pinMode(LED1_PIN,OUTPUT); // for general DEBUG use
pinMode(IR_PIN,INPUT); // IR on pin 3
digitalWrite(IR_PIN, HIGH); // turn on pullup resistor
Blink(LED1_PIN,3); // shows it's in setup
//tone(PIEZO_PIN,2500,1000); // shows it's in setup (not supported with MIT core)
delay(1500);
// attachInterrupt(0,IR_ISR,FALLING); // THIS METHOD OF ISR WORKS
// Setup pin change interrupt . . .
// METHOD 4: *************
PCMSK |= (1<
I'm stumped. Any help is appreciated.