Woah its been a while since I've posted here. Anyways, I'm in a situation where I'm using the IFI EDU controller again to control some servos, and well, I need some help.
First of all, the servos I'm having trouble with is are some Hitec HS-755HB's (website w/ link to spec sheet:
http://www.hitecrcd.com/Servos/hs755.htm). This project isn't FIRST related, so no need to worry about FIRST-legal issues. My problem is I need 180 degrees of rotation. If you turn the servos manually, they have 180 degrees of rotation before they hit their mechanical stops. When you PWM a 0 or 255 to them, however, they only have about 120 degrees of rotation.
At first I thought the problem was the IFI controller wasn't outputting a signal to the full range the servo accepts it.
(If you don't know the difference between the R/C (and IFI) PWM standard and the 'traditional' idea of a PWM signal, check out
http://www.geocities.com/BourbonStre...rvobasics.html really quickly)
Anyways, the Hitec servo manual (
http://www.hitecrcd.com/Servos/Servomanual.pdf) lists a .9ms pulse as min rotation and a 2.1ms pulse as max rotation. I oscilloscope'd the IFI PWM and sure enough programming a 0 results in a ~.9ms pulse with an overall period of about 17ms and a 255 is a ~2.1ms pulse with an overall period of 17ms (the astute programmer will notice the user processor coincidentally refreshes at 17ms). Anyways, the point is the PWM signal being outputted is within the servo's spec, so turns out the servo is designed to rotate only ~120 degrees.
My problem now is what I can do to get the 180 degrees I need.
I tried checking the servo's spec sheet (
http://www.hitecrcd.com/Servos/spec_sheets/HS755hb.pdf), but I saw no obvious spec listing the max range of rotation. Anyone know how to decode a servo's range of motion from that spec sheet? All the other Hitec servos similarly don't list that value, and I've had just as little luck from other manufacterers (towerhobbies, etc.). Anyone know a servo distributor that DOES list the servo's max range of rotation?
Alternatively, could I go beyond the servo's spec signal to get the extra rotation I want? ie could I send a .8 or .7ms pulse to get it to crank that extra few degrees I need? If so, how could I go about programming my own PWM code to do that (again, b/c the IFI default code does 0 and 255 as .9 and 2.1ms, respectively, which I want to go beyond)? I'm assuming the IFI signal-generating code is hidden in ifi_library.lib, to which we don't get the source (or do we?)
We have that old snippet from the old IR beacon code that generates a 40KHtz PWM with 50% duty cycle using the User CPU's CCP PWM mode (At this point, refer to the PIC18F8520 datasheet -
http://www.microchip.com/stellent/id...cName=en010319 - specifically the "Capture/Compare/PWM (CCP) Module" and "Timer2 Module" sections). 40KHz is way too fast for a servo - the servo needs a PWM period of around 50Hz (10-30ms). Is it possible to generate a ~50Hz PWM using the CCP? Page 154 lists the formula for a PWM period as [(PR2) + 1] * 4 * Tosc * (TMR2 Prescale Value). I don't know Tosc offhand, but in the 40 KHz code snippet, the Period Register (PR2) was set to 249 and the prescaler set to 1. Do the math and Tosc comes out to about 2.5e-8. Assuming you maximize both PR2 (to 255) and the prescaler (to 1:16), this still results in a PWM period of .04 ms, or about 2.4KHz -- way too fast for a servo signal. Page 154 implies you could do something with the postscaler and it mentions the word "servo", but I haven't been able to figure out how to use the postscaler in the generation of a PWM signal. Still, even if you could apply the max 1:16 postscaler, that would still result in a PWM period of about 6ms (I would want the /duty cycle/ to last about 6-8ms if I want to overspec the servo signal). We can't (easily) change Tosc in the Edu controller, can we, as that would be the only other thing you could increase to increase the generated period? Any clever programmers have any thoughts? Or is this method not even worth pursuing because going beyond the .9-2.1ms range won't do anything?
I guess my final option would be to open up the servo and toy around with its innards. Keep in mind that I would want to just increase the range of motion, not break the mechanical stops... I just want 180 degrees of servo rotation, not a servo that just does constant rotation. Again, the servo has 180 degrees of mechanical rotation, it just doesn't have 180 degrees in its electrical control system. Can you modify a servo to increase its range of motion, not modify it to become a forward/reverse motor?
Well that was a mouthful. Anyone got any thoughts to help me out?