#define PIND (*(volatile unsigned char *)(0x10 + 0x20)) /* Pinos de entrada */
#define DDRB (*(volatile unsigned char *)(0x17 + 0x20)) /* Registrador de direção dos dados */
#define PORTB (*(volatile unsigned char *)(0x18 + 0x20))/* Registrador de dados */
#define DDRD (*(volatile unsigned char *)(0x11 + 0x20)) /* Registrador de direção dos dados */
void led_on ()
{
PORTB = 0x00;
}
void led_off ()
{
PORTB = 0xff;
}
unsigned char check_buttons ()
{
return PIND;
}
void print_led (unsigned char value)
{
PORTB = value;
}
int main (void) {
int i;
int value;
value = -1;
DDRB = 0xff;
DDRD = 0x00;
PORTB = 0xff;
while (1) {
value = check_buttons();
print_led(value);
}
return 0;
}