hi all,
reading more in depth how PWM is generated at the mega128, guess it wont work as is for a digital servo.
whereas a standard servo works like this and from what i undersantd, the mega128 generates PWM as:
_____                     _____
|       |                     |       |
|       |                     |       |
|       |____________|       |____________
<-------------------------> <-------------------------->
     cycle 20ms                  cycle 20ms

A digital servo signal expect a PWM like this (the widht of pulse also varies like standard)
__  __  __  __  __  __  __  __  __  __  __  __
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
|  |_|  |_|  |_ |  |_|  |_|  |_|  |_ |  |_|  |_|  |_|  |_ |  |
<---------------------------><------------------------------>
     cycle 20ms                  cycle 20ms
So to sum up a digital servo expect a more spreaded signal in the same cycle of 20 ms
As of what i read, it expects 6 pules in one cycle so in one second a standard servo receives 50 pulses and a digital one 300.
So to set the PWM generator i should generate a shorter pulse 6 times like in a loop what do you think?

On the other hand, in the script, you are using fast PWM with compare output mode right?
so on compare match OCnA/OCnB/OCnC will clear and set at TOP, this is set on TCCRnA
and then you set TCCRnB fot Fast PWM with ICRn for saving TOP and prescaler 8
I guess i understand now the script, but setting TOP at 40000 means a PWM cycle of 40 milisecs? wouldnt it be about 20 milisecs the needed? or am i doing something wrong?

thanks in advance
rodrigo