帮忙解释一下下面这个中断例程运行过程,为什么我感觉例程的一些配置有点乱,好像有些配置没有用啊。谢谢好人……
#include "N76E003.h"
#include "SFR_Macro.h"
#include "Function_define.h"
#include "Common.h"
#include "Delay.h"
void EXT_INT0(void) interrupt 0
{
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
clr_GPIO1;
Timer0_Delay1ms(100);
set_GPIO1;
Timer0_Delay1ms(100);
}
void PinInterrupt_ISR (void) interrupt 7
{
if(PIF == 0x01)
{
PIF = 0x00; //clear interrupt flag
clr_GPIO1;
Timer1_Delay10ms(10);
set_GPIO1;
Timer1_Delay10ms(10);
clr_GPIO1;
Timer1_Delay10ms(10);
set_GPIO1;
Timer1_Delay10ms(10);
}
else if (PIF == 0x80)
{
clr_GPIO1;
Timer1_Delay10ms(10);
set_GPIO1;
Timer1_Delay10ms(10);
clr_GPIO1;
Timer1_Delay10ms(10);
set_GPIO1;
Timer1_Delay10ms(10);
clr_GPIO1;
Timer1_Delay10ms(10);
set_GPIO1;
Timer1_Delay10ms(10);
clr_GPIO1;
Timer1_Delay10ms(10);
set_GPIO1;
Timer1_Delay10ms(10);
}
}
/******************************************************************************
The main C function. Program execution starts
here after stack initialization.
******************************************************************************/
void main (void)
{
P07_Input_Mode; //ÅäÖÃP07ΪÊäÈëģʽ
set_P0S_7; //ÅäÖÃΪʩÃÜÌØ´¥·¢ÊäÈë
P00_Input_Mode; //ÅäÖÃP00ΪÊäÈëģʽ
P01_Input_Mode; //ÅäÖÃP01ΪÊäÈëģʽ
set_P0S_1; //ÅäÖÃΪʩÃÜÌسö·¢ÊäÈë
P12_PushPull_Mode; //ÅäÖÃΪÍÆÍìÊä³öģʽ
P30_PushPull_Mode; //ÅäÖÃΪÍÆÍìÊä³öģʽ
P05_PushPull_Mode; //ÅäÖÃΪÍÆÍìÊä³öģʽ
//----------------------------------------------------
// P0.5 set as highlevel trig pin interrupt function
// Keep P0.5 connect to VDD LED will tickle
// otherwise, MCU into power down mode.
//----------------------------------------------------
Enable_INT_Port0; //¹Ü½ÅÖжÏ0µçƽ´¥·¢
Enable_BIT7_LowLevel_Trig; //¹Ü½ÅÖжÏ6¼°7µçƽ´¥·¢£¬¹Ü½ÅÖжϷ´ÏòÌØÐÔʹÄÜ£¬ÕýÏòÌØÐԹرա£
Enable_BIT0_LowLevel_Trig; //¹Ü½ÅÖжÏ0µçƽ´¥·¢£¬¹Ü½ÅÖжϷ´ÏòÌØÐÔʹÄÜ£¬ÕýÏòÌØÐԹرա£
P30 =1;
P05 = 0;
set_EPI; // Enable pin interrupt ʹÄÜÒý½ÅÖжÏ
set_EX0; //ʹÄÜÓÉP3.0²úÉúÖжÏ
set_EA; // global enable bit ʹÄÜËùÓÐÖжÏ
while(1)
{
P01=0;
P30=0;
P01=1;
P30=1;
}
}
|