/*================================================================================================ CMtec BOSCH_SpeedControlUnit copyright 2008 v1.0 (2008-08-07) Name: Christoffer Martinsson E-mail: cm@cmtec.se Uses: PB1 = PWM output PB2 = Sensor input ================================================================================================*/ #include #include #include #include #include #include #include /*================================================================================================ Functions ================================================================================================*/ /*------------------------------------------------------------------------------------------------ initIO Description: Initialise I/O Input: - Output: - ------------------------------------------------------------------------------------------------*/ void initIO (void){ /* Start PLL */ PLLCSR = (1< 70) { pwmValue = pwmValue - 70; OCR1A = pwmValue; } else if(pwmValue <= 70) { OCR1A = 0; } else { OCR1A = pwmValue; } } /*================================================================================================ Main ================================================================================================*/ int main (void){ unsigned char tmp = 0; cli(); // Disable global interrupt initIO(); sei(); // Enable global interrupt while(1){ setPWM(readSensor()); } return (0); } /*================================================================================================ End ================================================================================================*/