- /******************************************************************************
- * [url=home.php?mod=space&uid=288409]@file[/url] main.c
- * [url=home.php?mod=space&uid=895143]@version[/url] V1.00
- * [url=home.php?mod=space&uid=247401]@brief[/url] Show how to print and get character with IDE console window.
- *
- * SPDX-License-Identifier: Apache-2.0
- * [url=home.php?mod=space&uid=17282]@CopyRight[/url] (C) 2016 Nuvoton Technology Corp. All rights reserved.
- *****************************************************************************/
- #include <stdio.h>
- #include "NuMicro.h"
- # if defined (__GNUC__)
- extern void initialise_monitor_handles(void);
- #endif
- #define PLL_CLOCK 96000000
- /**
- * @brief Init system clock and I/O multi function .
- * @param None
- * [url=home.php?mod=space&uid=266161]@return[/url] None
- */
- void SYS_Init(void)
- {
- /*---------------------------------------------------------------------------------------------------------*/
- /* Init System Clock */
- /*---------------------------------------------------------------------------------------------------------*/
- /* Unlock protected registers */
- SYS_UnlockReg();
- /* Enable HIRC clock (Internal RC 48MHz) */
- CLK_EnableXtalRC(CLK_PWRCTL_HIRCEN_Msk);
- /* Wait for HIRC clock ready */
- CLK_WaitClockReady(CLK_STATUS_HIRCSTB_Msk);
- /* Select HCLK clock source as HIRC and HCLK source divider as 1 */
- CLK_SetHCLK(CLK_CLKSEL0_HCLKSEL_HIRC, CLK_CLKDIV0_HCLK(1));
- /* Set PCLK0/PCLK1 to HCLK/2 */
- CLK->PCLKDIV = CLK_PCLKDIV_APB0DIV_DIV1 | CLK_PCLKDIV_APB1DIV_DIV1;
- /* Update System Core Clock */
- /* User can use SystemCoreClockUpdate() to calculate PllClock, SystemCoreClock and CycylesPerUs automatically. */
- SystemCoreClockUpdate();
- /* Lock protected registers */
- SYS_LockReg();
- }
- int32_t main()
- {
- int8_t item;
- /* Init System, IP clock and multi-function I/O */
- SYS_Init();
- #if defined (__GNUC__) && !defined(__ARMCC_VERSION) && defined(OS_USE_SEMIHOSTING)
- initialise_monitor_handles();
- #endif
- printf("\n Start SEMIHOST test: \n");
- while(1)
- {
- item = getchar();
- printf("%c\n",item);
- }
- }
- /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/
|