#include
//making a global variable temp
// because user using ISR,
//volatile is used
volatile char temp = 0x01;
ISR(INT0_vect) // using interupt 0
{
loop_until_bit_is_set(PINC,7);
//If user want to exit, push the PC7 button
}
static void avr_init(void)
{
// port initialization
DDRB = 0xff;
DDRC = 0x00;
//ext int initialization
MCUCR|= (1<
GICR |= _BV(INT0); //int0 enable
// in register INT0 in GICR bit is set
sei (); //global enable
}
int main (void)
{
char i; //local variable i;
avr_init(); //call the function above
for(;;) //looping forever is there is no int
{
i = PINC;
PORTB = i;
}
return(0);
}


Tidak ada komentar:
Posting Komentar