code
void beep(void);
main()
{
int i;
TRISB= 0x00;
CMCON= 0x07;
TRISA= 0xfd;
while(1)
{
for(i=1;i<129;i=i*2)
{
PORTB = i;
while(PORTA.F0==0)
{
Delay_ms(3000);
}
beep();
Delay_ms(10);
}
}
}
void beep(void)
{
int i_b;
for(i_b=0;i_b<20;i_b++)
{
PORTA.F1=1;
Delay_ms(300);
PORTA.F1=0;
Delay_ms(300);
}
No comments:
Post a Comment