I'm trying to figure out how to use the timers properly. I using something like the following code to end up with a 20msec period with a 1msec duty. Typical of what you might find with an analog servo. I can't figure out how to invert the signal without using hardware or writing an my own interrupt handler to toggle gpio pins. Is it possible using PWM to have the timer start high and then go low when the match is reached?
The code above does what I want, except it starts low and goes high on the match. I realize I could use 19000 for the match and then have it go high for the last 1msec, however that doesn't start at the beginning of the period.
I've searched for sample servo code but didn't find anything.
-rick
Well it doesn't seem like there are any software answers to this. To solve this problem I'm going to use a SN74HC04N. This solves the inverted signal problem and an added bonus is that it brings the signal level up to 5volts and makes the servo happy.
-rick