Simple Servo Control
Posted: Mon Sep 13, 2010 4:58 pm
Version: 1
Status: Under development
License: BSD
Download: /files/project_builds/busservo.zip
This is a reposting of my "Servo Driver Fragment" from XMOSLinkers.
Basically this is just a really simple single-thread code for driving RC servos. I'm sure there's a smarter way to do some of these steps (the for-loop over signal pins is a bit of a busy wait). This should be relatively high-performing though, and it's easy to fit to any port size. I'm sure it wouldn't be hard to go from here to using a multiplexed output, but I only need a few channels.
This should work on just about anything you can hook it up to, but the demo code is set up to use ports on the XC-1. Note: The timing accuracy is improved quite a bit by compiling on the "Release" profile in the XMOS tools. This should give just over ~1.2 us resolution on each servo pin (assuming an 8-bit port). The error is quite a bit higher (thought possibly still within the error of most servos) if compiled using the "Debug" profile.
Video:
Status: Under development
License: BSD
Download: /files/project_builds/busservo.zip
This is a reposting of my "Servo Driver Fragment" from XMOSLinkers.
Basically this is just a really simple single-thread code for driving RC servos. I'm sure there's a smarter way to do some of these steps (the for-loop over signal pins is a bit of a busy wait). This should be relatively high-performing though, and it's easy to fit to any port size. I'm sure it wouldn't be hard to go from here to using a multiplexed output, but I only need a few channels.
This should work on just about anything you can hook it up to, but the demo code is set up to use ports on the XC-1. Note: The timing accuracy is improved quite a bit by compiling on the "Release" profile in the XMOS tools. This should give just over ~1.2 us resolution on each servo pin (assuming an 8-bit port). The error is quite a bit higher (thought possibly still within the error of most servos) if compiled using the "Debug" profile.
Video: