
/*********Interrupt function for timer 1****************
This interrupt is always on and is 100us*/
void t1_isr(void) interrupt 3 using 2 
{
	SYSTIME++;						//increament the SYSTIME variable used for fire timing
	if (IE0)						//If zero cross detected.
	{
		SYSTIME=0;					//increase systimer.
		cycles++;
		IE0=0;						//Clear zero cross flag.
		firecount=4;				//set fire couter.
	}
	if (SYSTIME>99)					//If SYSTIME exceeding 100 it is a zero cross.
	{
		SYSTIME=0;					//reset system timer.
		firecount=4;				//set fire counter.
	}
	if (onfire && SYSTIME>firedly && firecount  && fwbit)
	{
		FIREPORT=!FIREPORT;			//Put the fire pulse	
		firecount--;				//Reduce remining pulse counter.
	}
	else
		FIREPORT=1;					//Make fire pin 1 to keep transistor off.
	fwbit=!fwbit;					//fwbit to make firing pulse 200us
	ioport=OPSTATUS;
}
