text: /******************************************************************************
   * @file     main.c
   * @version  V1.00
   * $Revision: 2 $
   * $Date: 16/10/25 4:34p $
   * @brief    Software Development Template.
   * @note
   * Copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.
  *****************************************************************************/
  #include <stdio.h>
  #include "NUC126.h"
  
  
  void SYS_Init(void)
  {
      /* Enable IP clock */
      CLK->APBCLK0 = CLK_APBCLK0_UART0CKEN_Msk;
  
      /* Update System Core Clock */
      /* User can use SystemCoreClockUpdate() to calculate SystemCoreClock and cyclesPerUs automatically. */
      SystemCoreClockUpdate();
  
      /* Set PD multi-function pins for UART0 RXD and TXD */
      SYS->GPD_MFPL &= ~(SYS_GPD_MFPL_PD0MFP_Msk | SYS_GPD_MFPL_PD1MFP_Msk);
      SYS->GPD_MFPL |= (SYS_GPD_MFPL_PD0MFP_UART0_RXD | SYS_GPD_MFPL_PD1MFP_UART0_TXD);
  }
  
  
  int main()
  {
      int8_t ch;
  
      /* Unlock protected registers */
      SYS_UnlockReg();
  
      SYS_Init();
  
      /* Lock protected registers */
      SYS_LockReg();
  
      /* Init UART0 to 115200-8n1 for print message */
      UART_Open(UART0, 115200);
  
      printf("Simple Demo Code\n\n");
  
      printf("Please Input Any Key\n\n");
  
      do
      {
          printf("Input: ");
          ch = getchar();
          printf("%c\n", ch);
      }
      while(1);
  }
  
  /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/
  