All pastes #807128 Raw Edit

Anonymous

public c v1 · immutable
·published 2007-12-06 07:37 UTC
rendered paste body
//occurs every timer tickISR(TIMER1_COMPA_vect){	//Increase the millisecond counter   totalMilliseconds++;	//This applies any on-the-fly millisecond adjustment on the second   if(totalMilliseconds >= 1000)   {		//Do we need to retard the clock?		if(incrementMilliseconds < 0)		{			//We subtract the increment from the counter and exit			//Second roll over will happen late			totalMilliseconds += incrementMilliseconds;			incrementMilliseconds = 0;			return;		}		//Do we need to speed up the clock?		else if(incrementMilliseconds > 0)		{			//We roll over the second.But instead of starting millisecond at 0			//We start at incrementMilliseconds to speed up the clock			totalMilliseconds = incrementMilliseconds;			incrementMilliseconds = 0;				}		else		{			totalMilliseconds = 0;		}				totalSeconds++;		//This function handles the PWM for the charger	ChargeMilliSecond();}