//ICC-AVR application builder : 2008-04-01  11:51:38
// Target : M16
// Crystal: 16.000Mhz

#include <iom16v.h>
#include <macros.h>

void port_init(void)
{
 PORTA = 0x00;
 DDRA  = 0xFF;
 PORTB = 0x00;
 DDRB  = 0xFF;
 PORTC = 0x00; //m103 output only
 DDRC  = 0xFF;
 PORTD = 0x00;
 DDRD  = 0xFF;
}

//call this routine to initialize all peripherals
void init_devices(void)
{
 //stop errant interrupts until set up
 CLI(); //disable all interrupts
 port_init();

 MCUCR = 0x00;
 GICR  = 0x00;
 TIMSK = 0x00; //timer interrupt sources
 SEI(); //re-enable interrupts
 //all peripherals are now initialized
}

//
void main(void)
{
 unsigned int i;
 init_devices();
 //insert your functional code here...
 while(1){
		PORTA = 0x01;
	    for(i=0;i<8;i++){
			delay(100);
			PORTA= PORTA * 2;
		}
		PORTB = 0x01;
	    for(i=0;i<8;i++){
			delay(100);
			PORTB= PORTB * 2;
		}
		PORTC = 0x01;
	    for(i=0;i<8;i++){
			delay(100);
			PORTA= PORTC * 2;
		}
		PORTD = 0x01;
	    for(i=0;i<8;i++){
			delay(100);
			PORTD= PORTD * 2;
		}
	}
 
}

