#define wave portd.F4
unsigned short count=0;
void main()
{
INTCON=0XE4;
T0CON=0X08;
TMR0L=0X10;
TMR0H=0X27;
wave=0;
wave=1;
T0CON.TMR0ON=1;
}
void interrupt()
{
if(TMR0IF)
{
count++;
INTCON.TMR0IF=0;
if(count==25)
{
wave=~wave;
TMR0L=0X10;
TMR0H=0X27;
count=0;
}
T0CON.TMR0ON=1;
}
}
No comments:
Post a Comment