Project

General

Profile

Revision 264

Added by Brad Neuman over 13 years ago

First attempt at the frequency hack
NOT TESTED ON THE BOARD!

View differences:

ConstantCharging.c
271 271
	
272 272
	TCCR1A = (_BV(COM1B1)|_BV(PWM1B)|_BV(COM1A1)|_BV(PWM1A)); //clear timer 1 on compare, set at 0x00. Fast PWM mode
273 273
	TCCR1B |= _BV(CS12)|_BV(CS10); //leave timer on and set compare to 0 to make output off	
274
	
275
	//hack stuff so it will run in continuous mode
276
	TIMSK |= _BV(TOIE1); //enable overflow interrupt for timer 1
277
	
274 278
	OCR1B = 0;
275 279
	OCR1A = 0;
276 280
	
......
436 440
				
437 441
        /* Trickle Charge */
438 442
				if(status==1)
439
					OCR1B = 50;
443
					OCR1B = 200;
440 444
			}
441 445
      /* NO CONTACT */
442 446
			else
......
704 708
	}
705 709
}
706 710

  
711
ISR(TIMER1_OVF_vect)
712
{
713
	delay_ms(1); //wait a clock cycle so we know the ouput gets set (which happens at timer = 0)
714
	
715
	TCNT1 = 156; // start out at 156. Now OCR1B - 156 = duty cycle
716
}
717

  
707 718
ISR(PCINT_vect){;} //so the interrupt doesnt go to the reset vector

Also available in: Unified diff