The code is as follows:
# include "Config. H"
# include "Target. H"
Int k=0;
Void GPIO_set ()
{
PINSEL0=0 x00000000;
PINSEL1=0 x00000301;
IO0DIR=1 & lt; <4 | 1 & lt; <5;
IO0SET=1 & lt; <4 | 1 & lt; <5;
}
Void IRQ_Eint0 ()
{
k=1;
While ((EXTINT & amp; 0 x08)!=0)
{
EXTINT=0 x08;
}
VICVectAddr=0 x00;
}
Void IRQ_Eint3 ()
{
K=2;
While ((EXTINT & amp; 0 x08)!=0)
{
EXTINT=0 x08;
}
VICVectAddr=0 x00;
}
Void ZD_set ()
{
EXTMODE=1;
EXTPOLAR=0;
VICIntSelect=0 x00000000;
VICVectCntl0=0 x20 | 17;
IRQ_Eint3 VICVectAddr0=(int);
VICIntEnable=(1 & lt; <17);
VICVectCntl1=0 x20 | 14;
IRQ_Eint0 VICVectAddr1=(int);
VICIntEnable=(1 & lt; <14);
VICIntEnable=(1 & lt; <17) | (1 & lt; <14);
}
Int main ()
{
GPIO_set ();
__enable_irq ();//
ZD_set ();
While (1)
{
The switch (k)
{
Case 1:
IO0CLR=1 & lt; <4.
break;
Case 2:
IO0CLR=1 & lt; <5;
break;
Default:
break;
}
}
}