/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2019 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
//***********************************************************************************************************
// Website: http://www.nuvoton.com
// E-Mail : MicroC-8bit@nuvoton.com
// Date : Jan/21/2019
//***********************************************************************************************************
//***********************************************************************************************************
// File Function: ML51 INT0 pin demo
//***********************************************************************************************************
#include "ML51.H"
/* External pin interrupt INT0 subroutine */
void INT0_ISR(void) interrupt 0 // Vector [url=home.php?mod=space&uid=72445]@[/url] 0x03
{
clr_TCON_IE0; //clr int flag wait next falling edge
printf ("\n INT0 interrupt !!");
}
void main (void)
{
/* Initial UART0 for printf */
MFP_P31_UART0_TXD;
P31_PUSHPULL_MODE;
UART_Open(24000000,UART0_Timer3,115200);
ENABLE_UART0_PRINTF;
/*INT0 ENABLE */
MFP_P25_INT0; //setting INT0 pin P0.6 as Quasi mode
P25_INPUT_MODE; //Set input mode
ENABLE_P25_PULLUP; //set pull up resistor.
INT0_FALLING_EDGE_TRIG; //setting trig condition level or edge
ENABLE_INT0_INTERRUPT; //INT0_Enable;
ENABLE_GLOBAL_INTERRUPT; //Global interrupt enable
while(1);
}
|