/*
 * Testing.c
 *
 * Created: 12/15/2014 10:59:16 PM
 *  Author: soc
 */ 


#include <avr/io.h>

//Define functions
//Forward Declarations
//=================================================
void ioinit(void);
void delay_ms(uint16_t x);
//=================================================



int main(void)
{
	
	ioinit(	);//setup IO pins and defaults
	PORTC = 0x00;
    while(1)
    {
        PORTC ++;
		if(PORTC == 0x08){
			PORTC = 0x01;
		}
		delay_ms(2000);
    }
	return 0;
}

void ioinit(void)
{
	
	//1= output, 0 = input
	DDRB = 0b11111111;  // All pins to output
	DDRC = 0b11111111; //  All pins to output
	DDRD = 0b11111110; //  All pins except the RX on PD0 are set to high
	
}

void delay_ms(uint16_t x)
{
  uint8_t y, z;

  for (; x > 0; x--)
  {
	  for(y = 0;y < 90; y++)
	  { 
		  for(z = 0; z < 6; z++)
		  {
			  asm volatile ("nop");
		  }
	  }
	
   }
 }