/*******************************************************************************
 Rue's "is it alive" program for avr processors
  also makes a good skel to build your programs form.
  
  flashed led in port A2
  
*******************************************************************************/


#include <avr/io.h>

// misc

#define OUTPUT             1
#define INPUT              0

void Delay(int delay);

int main (void) {

  // set up directions 
  DDRA = (INPUT << PA0 | INPUT << PA1 |OUTPUT << PA2 |INPUT << PA3 |INPUT << PA4 |INPUT << PA5 |INPUT << PA6 |INPUT << PA7);
  DDRB = (INPUT << PB0 | INPUT << PB1 |INPUT << PB2 |INPUT << PB3 |INPUT << PB4 |INPUT << PB5 |INPUT << PB6 |INPUT << PB7);
  DDRC = (INPUT << PC0 | INPUT << PC1 |INPUT << PC2 |INPUT << PC3 |INPUT << PC4 |INPUT << PC5 |INPUT << PC6 |INPUT << PC7);
  DDRD = (INPUT << PD0 | INPUT << PD1 |INPUT << PD2 |INPUT << PD3 |INPUT << PD4 |INPUT << PD5 |INPUT << PD6 |INPUT << PD7);        

  while(1) {
    Delay(20000);
    PORTA ^= 0x04;
  }

}

void Delay(int delay) {
  int x;
  for (x = delay; x != 0; x--) {
    asm volatile ("nop"::); 
  }
}


