

#include <at89x51.h>

#define ON 1
#define OFF 0
#define HIGH 1
#define LOW 0

static bit cycle;

void Timer0_ISR (void) interrupt 1;

void Timer0_ISR (void) interrupt 1
{
    if(cycle) {

        P1_2 = OFF;
        TH0 = 0xC3;
        TL0 = 0xF2;
        cycle = LOW;
    }

    else {

        P1_2 = ON;
        TH0 = 0xFA;
        TL0 = 0x99;
        cycle = HIGH;
    }

    TF0 = OFF;

    return;
}

void main (void) {

    EA = ON;      
    ET0 = ON;    

    TR0 = OFF;  
    TF0 = OFF; 

    TMOD &= 0xF0;
    TMOD |= 0x01;

    TH0 = 0xFA; 

    TL0 = 0x99;

    cycle = HIGH;
    
    P1_2 = OFF;

    TR0 = ON;  

    while (1) {

    }
}

