#include <stdio.h>
#include <string.h>
#include <ADuCM360.h>

void delay(long int);
int iGoToSleep = 0;

int main (void)
{
	pADI_CLKCTL->CLKCON0 = 0x0;				// UCLK, HFOSC,clock divide bit 1
	pADI_CLKCTL->CLKSYSDIV = 0x0;			// CD0 clock - 16Mhz 
	
	pADI_GP1->GPOEN  =  0x8;          // GPIO1.3 is output    
	pADI_GP1->GPSET  =  0x8;          // switch LED off        
	
	pADI_GP1->GPCLR = 0x8;            // Turn on LED         
	delay(1000000);
	pADI_GP1->GPSET = 0x8;            // Turn off LED        		 
	delay(1000000);
	pADI_GP1->GPCLR = 0x8;            // Turn on LED         
	delay(1000000);
	pADI_GP1->GPSET = 0x8;            // Turn off LED        	 
	delay(1000000);
		
	pADI_WDT->T3CON = 0x00 ; 				  // vypnu watchdog timer    
	pADI_WDT->T3LD = 0x100;           // 0x1000 = 32 sek
	pADI_WDT->T3CON = 0x69;           // reset az dojde T3LD

	while (1)
   {
	 }
}
void delay (long int length)
{
   while (length >0)
      length--;
}
