/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2019 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
//***********************************************************************************************************
// Website: http://www.nuvoton.com
// E-Mail : MicroC-8bit@nuvoton.com
//***********************************************************************************************************
//***********************************************************************************************************
// File Function: ML51 simple GPIO toggle out demo code
//***********************************************************************************************************
#include "ML51.h"
bit uart2rvflag=0;
unsigned char TXtemp=0x30;
void SMC0_ISR(void) interrupt 19 // Vector [url=home.php?mod=space&uid=72445]@[/url] 0x9B
{
SFRS=0;
if((SC0IS&SET_BIT0)==SET_BIT0)
{
TXtemp = SC0DR;
clr_SC0IS_RDAIF;
uart2rvflag = 1;
}
}
/**
* [url=home.php?mod=space&uid=247401]@brief[/url] UART2 TXD output demo
* @param None
* [url=home.php?mod=space&uid=266161]@return[/url] None
* [url=home.php?mod=space&uid=1543424]@Details[/url] conned UART2 and UART0 to loop check.
*/
void main (void)
{
MFP_P31_UART0_TXD;
P31_QUASI_MODE;
UART_Open(24000000,UART0_Timer1,115200); /* Open UART0 use timer1 as baudrate generate and baud rate = 115200 */
MFP_P55_UART2_RXD;
P55_INPUT_MODE;
UART_Open(24000000,UART2,115200); /* Open UART2 use timer1 as baudrate generate and baud rate = 115200*/
UART_Interrupt_Enable(UART2,Enable);
ENABLE_GLOBAL_INTERRUPT;
/* Connect P5.5 and P3.1 to check loop from UART0 to UART2*/
UART_Send_Data(UART0,TXtemp);
while(1)
{
if (uart2rvflag)
{
TXtemp++;
uart2rvflag=0;
Timer3_Delay(24000000,4,300,1000);
UART_Send_Data(UART0,TXtemp);
}
}
}
|