It seems to me that every 20ms, one could toggle all the servo pins high at once and then turn them off one by one as needed when a particular servo's time is up.
That's how I'd do it.
the reason it is not done this way is that you would need to loop through the servos at every pin change to see who should go next, with 20 servos that would be a lot of 16 bit operations.
alternativley you could try and sort the servos at the start of each frame but again lots of 16 bit operations.
This seems really inefficient to me however.
No, you would not.
just let the ISR CYcle through a pre sorted table.
The next problem is if you have 20 servos at very similar values, Do you stay blocking in the ISR to set all 20 of them ?
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16