2009/2/18 Sebastien Lelong <[email protected]>: >> > There's something I've missed. We both seem to write nice stories that can't be understood ;)
> If interrupts are used for PWM, and if > polling is used for usart and i2c, then we may miss commands ? ... > Is that what you mean ? No ;) The main priority is to create the falling edge when it is due. So this is done in the one an only isr, triggered by a timer. The main loop does: - Check if there was a falling edge (1 us) and set the next servo pulse and timer (maybe 15 us?) - Check if there is a usart char (1 us) and handle it (15 us?) - Check if i2c needs attention (1 us) and handle it (16 us? ;) So in general, it takes less then 2 us know some action is requested, but it might take 30 us (assuming an interrupt takes 10 us) and I think this is fast enough. And the timing of the servo puls will be within 1 us accurate. > Another question... When you say, about interrups and PWM "set the output > high and program a timer to generate an interrupt when the desired time has > elapsed", does this mean, as a consequence, that the whole cycle won't be > 20ms long ? Ex: when all 8 servos are at 50%, the cycle will last ~ 10ms. I > guess this is not a problem when it's shorter than 20ms, but, just in case, > we may add "padding" time, to complete the 20ms. I ignored that detail, but I think it is a good idea to add this padding to get (close to) 20 ms. Not too much trouble (compared to the issue's previous discussed) and there might be a servo out there that requires this. Joep --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jallib?hl=en -~----------~----~----~----~------~----~------~--~---
