TIFR1=0x00;//Timer1 INT Flag Reg: Clear Timer Overflow Flag
TCCR1A=0x00;//Timer1 Control Reg A: Wave Gen Mode normal (Simply counts up from 0 to 65535 (16-bit int)
TCCR1B=(1<<CS12);//Timer1 Control Reg B: Timer Prescaler set to 256. 1 tick = 16uS. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
boost_pwm_max_count=1000000L/(16*configPage6.boostFreq*2);//Converts the frequency in Hz to the number of ticks (at 16uS) it takes to complete 1 cycle. The x2 is there because the frequency is stored at half value (in a byte) to allow freqneucies up to 511Hz
vvt_pwm_max_count=1000000L/(16*configPage6.vvtFreq*2);//Converts the frequency in Hz to the number of ticks (at 16uS) it takes to complete 1 cycle
//Much help in this from http://arduinomega.blogspot.com.au/2011/05/timer2-and-overflow-interrupt-lets-get.html
//Fuel Schedules, which uses timer 3
TCCR3B=0x00;//Disable Timer3 while we set it up
TCNT3=0;//Reset Timer Count
TIFR3=0x00;//Timer3 INT Flag Reg: Clear Timer Overflow Flag
TCCR3A=0x00;//Timer3 Control Reg A: Wave Gen Mode normal
TCCR3B=(1<<CS12);//Timer3 Control Reg B: Timer Prescaler set to 256. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
//TCCR3B = 0x03; //Timer3 Control Reg B: Timer Prescaler set to 64. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
//Ignition Schedules, which uses timer 5. This is also used by the fast version of micros(). If the speed of this timer is changed from 4uS ticks, that MUST be changed as well. See globals.h and timers.ino
TCCR5B=0x00;//Disable Timer5 while we set it up
TCNT5=0;//Reset Timer Count
//TIFR5 = 0x00; //Timer5 INT Flag Reg: Clear Timer Overflow Flag
//TIFR5 = 0xFF;
TCCR5A=0x00;//Timer5 Control Reg A: Wave Gen Mode normal
//TCCR5B = (1 << CS12); //Timer5 Control Reg B: Timer Prescaler set to 256. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
//TCCR5B = 0x03; //aka Divisor = 64 = 490.1Hz
TCCR5B=(1<<CS11)|(1<<CS10);//Timer5 Control Reg B: Timer Prescaler set to 64. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg
//The remaining Schedules (Schedules 4 for fuel and ignition) use Timer4
TCCR4B=0x00;//Disable Timer4 while we set it up
TCNT4=0;//Reset Timer Count
TIFR4=0x00;//Timer4 INT Flag Reg: Clear Timer Overflow Flag
TCCR4A=0x00;//Timer4 Control Reg A: Wave Gen Mode normal
TCCR4B=(1<<CS12);//Timer4 Control Reg B: aka Divisor = 256 = 122.5HzTimer Prescaler set to 256. Refer to http://www.instructables.com/files/orig/F3T/TIKL/H3WSA4V7/F3TTIKLH3WSA4V7.jpg