External Interrupt INT0 ATtiny10

After having a little fun. I learned a few things about this chip.. Pullups are different..

My goal on this was to just figure out external interrupt, just reading datasheet. It works..

Her is the code I used for INT0 on PB2 works great. I did add a .1uf Cap on GND to PB2 for de-bounce.

/*

Testing External interupt on ATtiny10


Sherm 10/31/21 Booooooo

It now works..

*/


#undef F_CPU

#define F_CPU 1000000UL

#include <avr/io.h>

#include <avr/interrupt.h>

#include <util/delay.h>


int main(void){


EICRA=0b00000010; //detect falling edge ext int on ISC0 0 and 1

EIMSK=0b00000001; // turn on INT0


DDRB=0b00000010; //put PB1 as output and PB2 as input

PUEB=0b00000100; //enable pullup on PB2 attiny10

//PORTB|=(1<<PB2); //enable pullup NOT ON ATTINY10

sei(); //start interrupts

while(1){ //loop, loop.....


}

}


// Interrupt Service Routine catch button and toggle led on PB1

ISR(INT0_vect){

PORTB ^=(1<<PB1);

//_delay_ms(400); // was for debounce but went with .1uf Cap from gnd to PB2 that worked great.

//EIFR=0b00000001; // clear the external interrupt flag

// it says: The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be

//cleared by writing a logical one to it. This flag is always cleared when INT0 is configured as a level

//interrupt.

}