警报器程序之--救护音
扫描二维码
随时随地手机看文章
/*The program is belong to Chopin.Wu*/
#include
#define uchar unsigned char
#define uint unsigned int
#define pin_Sound RB0
#define Tmr0EnBit T0IE
__CONFIG(0x3B31);
void init();
uint g_Tmr0InitialValue,g_Tmr0Times;
void main()
{
init();
while(1)
{
}
}
void init()
{TRISA=1;RA0=1;
TRISB=0;
PORTB=0;
OPTION=0x03;
INTCON=0xA0;
TMR0=g_Tmr0InitialValue;
}
void interrupt time0()
{
T0IF=0;
TMR0=g_Tmr0InitialValue;
g_Tmr0Times++;
if(g_Tmr0Times>3600)
{g_Tmr0Times=0;}
if(g_Tmr0Times<1800)
{g_Tmr0InitialValue=131;}
else
{g_Tmr0InitialValue=100;}
pin_Sound=pin_Sound^1;
}