#include <reg52.h>

#include "p_apps.h"
#include "PalmChip.h"

volatile BOOLEAN Timer_bIndicated = FALSE;

#define _iTH0	0x6f	
#define _iTL0	0x78	

void Timer0Interrupt() interrupt 1 //	using 1
{
	Timer_bIndicated = TRUE;

    // set the initial number again
	TH0 = _iTH0;
    TL0 = _iTL0;
}

// Call this function just before entering main loop
void ControlInitialize()
{
	TMOD = 0x21;		// T/C0 function mode 1 timer; T/C1 function mode 2 timer for serial communication
    CKCON &= 0xe7;		// timer0, timer 1 count by clk/12
	TH0 = _iTH0;		// set timer 0 initial number, make it interrupt every 20ms
	TL0 = _iTL0;
	TR0 = 1;
	IP = 0;				// no interrupt has higher piority
//    IE = 0x96;		// enable timer0, serial and external 1 interrupts; EA = 1, ES = 1, EX1 = 1, ET0 = 1
	ET0 = 1;
	EX1 = 1;
	EA = 1;
}


