
#include <8052.h>

#define WAIT    1
#define READY   0
#define CLEAR   0
#define SET     1

volatile bit ovf = 0;   /* record the overflow */
volatile bit bit_status = READY;

void isr_byte_recv(void) __interrupt 7;

main()
{
        T2CON |= 0x01;
        EXEN2 = 1;
        EA = 1;
        ET2 = 1;
        TR2 = 1;
        while (1) {
                /* my application code here */
                /* This is a test code */
                if (TF2 == 1) {         /* check overflow */
                        P1_4 = !P1_4; /* LED1 */
                        TF2 = 0;
                }
        }
}


void isr_byte_recv(void) __interrupt 7
{
        P1_4 = !P1_4;
        if (TF2 == 1) {         /* check overflow */
                ovf = 1;
                P1_5 = !P1_5;   /* LED2 */
        }
        else
                P3_4 = !P3_4;   /* buzzer */
        TF2 = 0;
        EXF2 = 0;
}
