# include
# define uint unsigned int
# define uchar unsigned char
sbit p32 = P3 ^ 2;
sbit p33 = P3 ^ 3;
main () {
Ea = 1;
it0 = 1;
it1 = 1;
ex0 = 1;
ex1 = 1;
p0 = 0xff;
// turn off the LED lights of all P0 ports
P1 = 0xff;
// turn off the LED lights of all P0 ports
while (1); // infinite loop,
}< br>
/***************************** ***********************************
function: latency: about 0.6 Ms
********************************* * **********************************/
void delay (uint K)
{
uint I, j;
for (I = 0; I
{for (j = 0; j <121; j ++)
{;}}
}< span style = "white-space: pre">
/************************************ * ************************
function functions: Program
****************** **************************************** * ***/
void int1 (void) interrupt 0 // The interrupt Number of the External Interrupt 0 is 0
{< br> If (p32 = 0) {
delay (150);
If (p32 = 0)
p0 = ~ P0; // every time an interrupted request is generated, P1 returns the inverse.
}< BR >}
/************************************ * ************************
function functions: interrupted service programs with external interruptions of T0
****************************** * ******************************/
void int2 (void) interrupt 2 // The interrupt Number of the External Interrupt 2 is 2
{< br>
If (p33 = 0) {
delay (150);
If (p33 = 0)
P1 = ~ P1; // every time an interrupted request is generated, P1 returns the inverse.
}< br>
}