- /******************************************************************************
- * [url=home.php?mod=space&uid=288409]@file[/url] main.c
- * [url=home.php?mod=space&uid=895143]@version[/url] V1.00
- * $Revision: 4 $
- * $Date: 15/09/02 10:05a $
- * [url=home.php?mod=space&uid=247401]@brief[/url] Software Development Template.
- * @note
- * Copyright (C) 2014~2015 Nuvoton Technology Corp. All rights reserved.
- *****************************************************************************/
- #include <stdio.h>
- #include "M451Series.h"
- void SYS_Init(void)
- {
- /*---------------------------------------------------------------------------------------------------------*/
- /* Init System Clock */
- /*---------------------------------------------------------------------------------------------------------*/
- /* Enable UART module clock */
- CLK_EnableModuleClock(UART0_MODULE);
- /* Update System Core Clock */
- /* User can use SystemCoreClockUpdate() to calculate SystemCoreClock and cyclesPerUs automatically. */
- SystemCoreClockUpdate();
- /*---------------------------------------------------------------------------------------------------------*/
- /* Init I/O Multi-function */
- /*---------------------------------------------------------------------------------------------------------*/
- /* 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("\n");
- 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 2014~2015 Nuvoton Technology Corp. ***/
|