/* GROUP I DARLAN VIVIAN EDUARDO A. P. ALCHIERI THIAGO MEREGE PEREIRA */ /* I/O PORT B, DATA DIRECTION REGISTER (0 -> in, 1 -> out) */ #define DDRB (*(volatile unsigned char *)(0x17 + 0x20)) /* I/O PORT B, DATA REGISTER */ #define PORTB (*(volatile unsigned char *)(0x18 + 0x20)) /* I/O PORT D, INPUT PINS */ #define PIND (*(volatile unsigned char *)(0x30)) /* GIMSK, GENERAL INTERRUPT MASK REGISTER */ #define GIMSK (*(volatile unsigned char *)(0x5B)) /* MCUCR, MCU CONTROL REGISTER */ #define MCUCR (*(volatile unsigned char *)(0x55)) /* SREG, STATUS REGISTER */ #define SREG (*(volatile unsigned char *)(0x5F)) #define IRQ0 __vector_1 #define SIGNAL __attribute__ ((signal)) int main(void) { /* Enable interrupts */ SREG = 0x80; /* Enable External Interrupt Request 0 */ GIMSK = 0x40; /* Rise edge of INT 0 generates a IRQ */ MCUCR = 0x03; /* Set the whole port (all bits) to "output" */ DDRB = 0xff; while(1) {} return 0; } void IRQ0 (void) SIGNAL; void IRQ0 (void) { /* Turns on/off all PORTB leds */ PORTB = ~PORTB; }