A timer for all occasions

Ok, FreeRTOS is great but not so great if you need to use timers on an AVR to control PWM for motors.

- The Goal -
Run FreeRTOS on a Mega32 and also control DC motors via a L293D using PWM

- The Challenges -
FreeRTOS uses Timer1 to control the FreeRTOS kernel. This leaves Timer0 and Timer2 (both 8 bit) for PWM. Timer0 and Timer1 share a common pre-scaler.

Note that FreeRTOS set the Timer1 pre-scaler in the port.c file via the portCLOCK_PRESCALER and other defines.

Apart from this Timer0 and Timer2 appear to by unmolested by FreeRTOS.

Comments