/******************************************************************************
* Workfile    : EX0401.c
* Purpose     : PORTA Output
* Copyright   : appsofttech co.,ltd.
* Author      : Prajin Palangsantikul
* Email       : prajin@appsofttech.com
* Compiler    : AVR Studio/WINAVR
* Target      : ATmega16
* Other Files :
* Ref         :
******************************************************************************/

/****************************************************************** Includes */
#include <avr/io.h>         // AVR device-specific IO definitions

#define F_CPU 16000000UL     // 8 MHz
#include <util/delay.h>     // header file implement simple delay loops


/****************************************************************** delay_ms */
void delay_ms(unsigned int i)
{        
    for (; i>0; i--)
        _delay_ms(1);
}

/************************************************************ Main Functions */
int main(void)
{      
    DDRC=0xFF;              // PORT A Output all
	PORTC=0x00;             // Clear port    

    while (1) {
        PORTC = 0xFF;       // Output High
        delay_ms(1000);     // Delay 1s
        PORTC = 0x00;       // Output Low
        delay_ms(1000);
  }

  return 0;
}

