The sweep doesn't occur because there's a repeat loop preventing it. The first thing we want to do is make sure the servos are centered with respect to the code.
Check the comments, they tell to comment the repeat with no code block to allow the code to move on to the ramping back and forth code.
What procedure did you use to center your continuous rotation servos? They should now be receiving 1.5 ms pulses every 20 ms (assuming you did not change the code). Do you have an oscilloscope we can use to check this?
Both servos attempt to stop but instead cycle back and forth about 5 degrees about the stop point, with about a 1/3 second period.
The code I was using for servo contro is posted above to Rokicki.
Richard
BTW, make sure the repeat loop that stops the code is in effect. It should not move on to the ramping code until you center the servos (adjusting the pots with a screwdriver).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 6/15/2007 6:58:12 PM GMT
Andy,
My servos are Hitec RC jobs from my airplane collection, that I modified for continuous rotation. Since I don't have external access to the feedback pot, please tell me where to go in servo.spin to make adjustments to set the software centering point.
Thanks,
Richard
That will send 1.5 ms + 20 us to servo zero (P16), and 1.5 ms·- 15 us to servo one (P19 assuming you changed pin[noparse][[/noparse]1] := 18 to pin[noparse][[/noparse]1] := 19).
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 6/15/2007 7:38:12 PM GMT
Andy,
One other thing, someone referred to this problem earlier in the thread but I didn't pick it up. After looking at page 20 of the IO/timing tutorial I see why my code caused the pulse widths to change with clock frequency. None of this explains the earlier pll failure, so I will chalk it up to mishandling of the chip. At only $12.95 (unbelievable price for so much power) I can't get too upset over the mishap.
Richard
Comments
The sweep doesn't occur because there's a repeat loop preventing it. The first thing we want to do is make sure the servos are centered with respect to the code.
Check the comments, they tell to comment the repeat with no code block to allow the code to move on to the ramping back and forth code.
What procedure did you use to center your continuous rotation servos? They should now be receiving 1.5 ms pulses every 20 ms (assuming you did not change the code). Do you have an oscilloscope we can use to check this?
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Heres the code. Just change the pllx multiplier and see if the neutral point changes, like mine does.
Thanks,
Richard
' servo control.spin
CON
_clkmode = XTAL1 + pll16x
_xinfreq = 5_000_000
VAR
long stack1[noparse][[/noparse]20], stack2[noparse][[/noparse]20], stack3[noparse][[/noparse]20]
PUB start
cognew(left_servo, @stack1)
cognew(right_servo, @stack2)
cognew(flash_LED, @stack3)
PUB left_servo
dira[noparse][[/noparse]16]~~
repeat
outa[noparse][[/noparse]16]~~
waitcnt(clkfreq/664+cnt) '664 stop
outa[noparse][[/noparse]16]~
waitcnt(clkfreq/50+cnt)
PUB right_servo
dira[noparse][[/noparse]19]~~
repeat
outa[noparse][[/noparse]19]~~
waitcnt(clkfreq/664+cnt) '662 stop
outa[noparse][[/noparse]19]~
waitcnt(clkfreq/50+cnt)
PUB flash_LED
dira[noparse][[/noparse]15]~~
repeat
!outa[noparse][[/noparse]15]
waitcnt(clkfreq/2 + cnt)
I ran the sweep with the following result:
Both servos attempt to stop but instead cycle back and forth about 5 degrees about the stop point, with about a 1/3 second period.
The code I was using for servo contro is posted above to Rokicki.
Richard
I donot have an O scope or a place to borrow one.
Richard
Yes, the code you have does cause symptoms you described. Use my code.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 6/15/2007 6:42:12 PM GMT
Also, re center your servos using my code.
I managed to observed 20 (ish) RPM speeds with your code.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
You know you were going to get this response ... why?
Thanks for working with me on this.
Richard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 6/15/2007 6:58:12 PM GMT
http://www.parallax.com/dl/docs/prod/prop/PE-IOTimingBasics-v1.0.zip
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
My servos are Hitec RC jobs from my airplane collection, that I modified for continuous rotation. Since I don't have external access to the feedback pot, please tell me where to go in servo.spin to make adjustments to set the software centering point.
Thanks,
Richard
Sure. notice where it says servo[noparse][[/noparse]0] := servo := 0. You can change that to something like:
servo[noparse][[/noparse]0] := 20
servo[noparse][[/noparse]1] := -15
That will send 1.5 ms + 20 us to servo zero (P16), and 1.5 ms·- 15 us to servo one (P19 assuming you changed pin[noparse][[/noparse]1] := 18 to pin[noparse][[/noparse]1] := 19).
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 6/15/2007 7:38:12 PM GMT
Thanks for all of the help. 30 and 32 did the trick. Your servo object is now in my bot.
Thanks again,
Richard
One other thing, someone referred to this problem earlier in the thread but I didn't pick it up. After looking at page 20 of the IO/timing tutorial I see why my code caused the pulse widths to change with clock frequency. None of this explains the earlier pll failure, so I will chalk it up to mishandling of the chip. At only $12.95 (unbelievable price for so much power) I can't get too upset over the mishap.
Richard