/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2019 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
//***********************************************************************************************************
// Website: http://www.nuvoton.com
// E-Mail : MicroC-8bit@nuvoton.com
//***********************************************************************************************************
#include "ML51.h"
/**
* @brief External pin interrupt INT0 demo
* @param None
* @return None
* @details None
*/
void INT0_ISR(void) interrupt 0 // Vector @ 0x03
{
/* Clear INT0 interrupt flag */
clr_TCON_IE0;
printf ("\n INT0 interrupt");
}
void main (void)
{
MFP_P31_UART0_TXD;
P31_QUASI_MODE;
UART_Open(24000000,UART0_Timer1,115200);
ENABLE_UART0_PRINTF;
/* Define P25 multi-function pin as External pin interrupt INT0 source*/
MFP_P25_INT0;
P25_INPUT_MODE;
/* Enable internal pull up function to wait falling edge*/
GPIO_Pull_Enable(Port2,SET_BIT5,PullUp);
/* Include exint.c in library */
ExternPinInterrupt_Enable(INT0,Edge,Enable);
ENABLE_GLOBAL_INTERRUPT;
while(1);
}
|