Page 1 of 2
Servo MoveToAngle
Posted: Wed Sep 23, 2026 1:15 pm
by chipfryer27
Hi
Seems to be a bug with the MoveToAngle macro of the Servo Controller.
Looking at the output on a Scopemeter I see that irrespective of what I set it to (byte value) it only outputs a signal with 0% duty cycle. so never moves away.
However the MoveToPosition and SetPosition macro's do work and go to expected position as per byte value. If the servo has been moved to 90 degrees (for example) by using say SetPosition, if I then issue a MoveToAngle macro to say byte 128, the servo just output the 0% duty cycle and returns to start position.
Regards
EDIT......
Still figuring out the little Scopemeter I was using. It was set to display the duty cycle and with the servo at a position it was around 10 - 12% (% changing per position). Telling it to go back to 0, the Scopemeter showed a duty cycle of 0% as documented above. However if I zoomed in on the horizontal scale it then gave me a reading of around 6%. Seems if you change input too much you need to either readjust the range or press Auto again. A little "gotcha" it seems....
Re: Servo MoveToAngle
Posted: Wed Sep 23, 2026 10:37 pm
by medelec35
Hi Iain.
Yes I can see there is an issue as the component debugger is throwing initialisation issues while simulation is running, which would mean same issue on embedded.
can you give the attached a go and see if now working.
I have not added the icon back on so I do know about that.
If issue is not resolved for you then can you attach your project file that shows the bug.
As usual, you will need to reload your project after adding updated component.
Re: Servo MoveToAngle
Posted: Wed Sep 23, 2026 10:57 pm
by chipfryer27
Hi Martin
Thanks for the help. I'll try tomorrow once back in my Evil-Lab.
My chart really was very simple. A loop exiting when "return = 1" and within, the MoveToAngle, same as my MoveToPosition really, which works.
I last used servos many years ago, probably FCv7 or FCv8 so thought to refresh my knowledge and tried a few options. It hasn't impeded anything though.
Again, thanks for the help, appreciated.
Regards
Re: Servo MoveToAngle
Posted: Thu Sep 24, 2026 10:45 am
by chipfryer27
Hi Martin
Using MoveToAngle the servo now moves.
However could you please explain the operation too, the relationship between byte and angle? It initially moves to a position approximately 90 degrees through travel so I assume that's the default value. If I then tell it to move to 0 (byte value) it goes to the anticlockwise limit (in my setup). If I then tell it to go to various byte values from 0 - 120 it moves, but when I use 150 it goes backwards to approximately "75", and when I use 180 it moves further past "120". 255 has it going fully clockwise to limit.
Regards
Re: Servo MoveToAngle
Posted: Thu Sep 24, 2026 12:52 pm
by medelec35
Yes, default value is 90°
That would mean 0 to < 90 will go one direction from middle.
90 = middle
>90 the opposite direction.
These are approx. assuming range is 1.00 ms to 2.00ms
Angle (deg) | Duration (ms)
------------|---------------
0 | 1.00
45 | 1.25
90 | 1.49
135 | 1.74
180 | 1.99
If your servo acts like above then I will ask for the fix to be pushed.
Re: Servo MoveToAngle
Posted: Thu Sep 24, 2026 1:21 pm
by medelec35
Sorry I think i got the original table wrong.
Hopefully corrected now, but it's theoretical not actual.
Digging in a bit deeper to check.
I'm going to test on hardware as well
Re: Servo MoveToAngle
Posted: Thu Sep 24, 2026 2:26 pm
by medelec35
Tested on hardware, my results are
Initial = 1.49 ms
0 = 1.00 ms
45 = 1.24 ms
90 = 1.49 ms
135 = 1.32 ms
180 = 1.56 ms
So that concludes there still is an issue.
I have attached my test project if you was interested.
It's only a Quick lash up.
Angles less 90 or less are correct.
I will see if I can find out why angles above 90 are not correct.
Re: Servo MoveToAngle
Posted: Thu Sep 24, 2026 3:49 pm
by chipfryer27
Hi Martin
I seem to have lost a post....
Anyway, I put a scope on:-
Using MoveToPosition I could get 90 degrees of rotation for 0-255 giving 1 to 2mS of width.
Using MoveToAngle I got 45 degrees for 0-128 (anything above reduced rotation) giving 1 to 1.5mS
Extending the Max / Min range from 0.35mS to 3.1mS gave:-
Using MoveToAngle I got approx 180 degrees for 0-128 (anything above reduced rotation) giving approx 0.3 to 2.2mS of width.
Last time I used servos was maybe FCv7 or v8 and I'd forgotten how bad they can be if bought off certain sites.......
Regards
Re: Servo MoveToAngle
Posted: Thu Sep 24, 2026 4:14 pm
by medelec35
I'm not relying on actual physical servo position, instead I'm checking the pulse duration on my analyser.
That rules out any servo differences.
I know what the values should be so trying to work out how to derive the correct values.
Re: Servo MoveToAngle
Posted: Thu Sep 24, 2026 11:22 pm
by medelec35
Hi Iain.
Fixed the MoveToAngle.
There was an Angle-to-byte overflow.
Now the new results after fix:
Initial = 1.49 ms
0 = 1.00 ms
45 = 1.24 ms
90 = 1.49 ms
135 = 1.73 ms
180 = 2.00 ms
I have been checking some other functions and found some more issues, so the component has had a bit of an overhaul.
I have given Ben access to the modified component source so the component database can be updated.