#define wave portd.F4
#define S1 portB.F0
#define S2 portB.F1
#define S3 portB.F2
void interrupt()
{
if(TMR0IF)
{
INTCON.TMR0IF=0;
wave=1;
}
}
void main()
{
INTCON=0XE4;
T0CON=0X08;
TRISD.F4=0;
TRISB.F0=1;
TRISB.F1=1;
TRISB.F2=1;
wave=0;
while(1)
{
if(S1==1)
{
TMR0L=0XEE;
TMR0H=0XEE;
T0CON.TMR0ON=1;
S1=0;
}
if(S2==1)
{
TMR0L=0X00;
TMR0H=0X00;
T0CON.TMR0ON=1;
S2=0;
}
if(S3==1)
{
TMR0L=0X10;
TMR0H=0X27;
T0CON.TMR0ON=1;
S3=0;
}
}
}
No comments:
Post a Comment