void main (void)
{
/* Note
MCU power on system clock is HIRC (11.0592MHz), so Fsys = 11.0592MHz
*/
Set_All_GPIO_Quasi_Mode(); //in Common.c
#if DEBUG_PORT == 0
InitialUART0_Timer1_Type1(115200); /* 9600 Baud Rate*/
#elif DEBUG_PORT == 1
InitialUART1_Timer3(115200); /* 9600 Baud Rate*/
#endif
Show_FW_Version_Number_To_PC();
printf ("\n*===================================================================");
printf ("\n* Name: N76E616 Watch Dog Timer Demo Code.");
printf ("\n*===================================================================\n");
/* Change system closk source */
#if SYS_CLK_EN == 1
#if SYS_SEL == 0
System_Clock_Select(E_HXTEN); //Fosc = 2~16MHz XTAL
#elif SYS_SEL == 1
System_Clock_Select(E_LXTEN); //Fosc = 32.768KHz XTAL
#elif SYS_SEL == 2
System_Clock_Select(E_HIRCEN); //Fosc = 11.0592MHz Internal RC
#elif SYS_SEL == 3
System_Clock_Select(E_LIRCEN); //Fosc = 10KHz Internal RC
#elif SYS_SEL == 4
System_Clock_Select(E_OSCEN); //Fosc = OSC-In External OSC
#endif
#endif
#if SYS_DIV_EN == 1
CKDIV = SYS_DIV; //Fsys = Fosc / (2* CLKDIV) = Fcpu
#endif
TA = 0x0AA;
TA = 0x055;
#if PRE_SCALAR == 0
WDCON = 0x00;
#elif PRE_SCALAR == 1
WDCON = 0x01;
#elif PRE_SCALAR == 2
WDCON = 0x02;
#elif PRE_SCALAR == 3
WDCON = 0x03;
#elif PRE_SCALAR == 4
WDCON = 0x04;
#elif PRE_SCALAR == 5
WDCON = 0x05;
#elif PRE_SCALAR == 6
WDCON = 0x06;
#elif PRE_SCALAR == 7
WDCON = 0x07;
#endif
set_WDTEN; //WDT run
while(1);
}
|