/******************************************************************************
* [url=home.php?mod=space&uid=288409]@file[/url] main.c
* [url=home.php?mod=space&uid=895143]@version[/url] V1.00
* $Revision: 3 $
* $Date: 14/01/28 11:45a $
* [url=home.php?mod=space&uid=247401]@brief[/url] Template project for M051 series MCU
*
* @note
* Copyright (C) 2014 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#include <stdio.h>
#include "M051Series.h"
void SYS_Init(void)
{
/* Unlock protected registers */
SYS_UnlockReg();
/* Enable IP clock */
CLK->APBCLK = CLK_APBCLK_UART0_EN_Msk;
/* Update System Core Clock */
/* User can use SystemCoreClockUpdate() to calculate SystemCoreClock and cyclesPerUs automatically. */
SystemCoreClockUpdate();
/* Set P3 multi-function pins for UART0 RXD and TXD */
SYS->P3_MFP = SYS_MFP_P30_RXD0 | SYS_MFP_P31_TXD0;
/* Lock protected registers */
SYS_LockReg();
}
int main()
{
int8_t ch;
SYS_Init();
/* 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 2014 Nuvoton Technology Corp. ***/
|