你需要的程序:#include<reg52.h> //庫文件
#define uchar unsigned char//宏定義無符號字符型
#define uint unsigned int //宏定義無符號整型
/********************************************************************
初始定義
*********************************************************************/
//uchar count; //按鍵計數,每按一下,count 加1
//uchar a,b; //定義字符型變量
//uchar temp; //定義字符型變量
sbit BY0=P0^0; //
void Ext_Interrupt0() interrupt 0 using 1
{
BY0 =!BY0;
}
void Ext_Interrupt1() interrupt 2 using 1
{
BY0 =~BY0;
}
/********************************************************************
主函數
*********************************************************************/
void main()
{
EX0=1;
EX1=1;
EA=1;
while(1)
{
}
} |