#include<pic.h>
#define uint8 unsigned char
#define uint16 unsigned int
#define Micro_Spaker_Out RA5 //喇叭输出
void delaym(uint16 t)
{
uint8 i;
while(t--)
{
for(i=120;i>0;i--);
}
}
void Init_MCU()
{
TRISA = 0x1F;
ANSELA = 0x10;
}
int main()
{
Init_MCU();
while(1)
{
//Keycan();
if(RA4 == 1)
{
Micro_Spaker_Out = 0;
delaym(100);
Micro_Spaker_Out = 1;
delaym(100);
}
else
{
Micro_Spaker_Out = 0;
delaym(50);
Micro_Spaker_Out = 1;
delaym(50);
}
}
} |