#include
#define uint unsigned int //宏界说
sbit SPK=P3^5; //界说喇叭端口
sbit key=P3^1; //开发板上对应的是s18按键
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x–)
for(y=110;y>0;y–);
}
void main()
{
if(key==0)
{
delay(100);
}
else
{
SPK=1;
}
}