PDA

View Full Version : Servo32v7 Object



xanadu
03-28-2012, 01:20 AM
I can get the servos to move using this object, but I cannot get them to ramp. Using the ramp command makes the servo stay still when the code is run. Any ideas?



CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

ServoCh1 = 31

OBJ

SERVO : "Servo32v7.spin"

PUB servorun

SERVO.Start
SERVO.ramp
SERVO.set(ServoCh1,1500)

repeat

SERVO.SetRamp(ServoCh1,700,500)
waitcnt(clkfreq * 5 + cnt)

SERVO.SetRamp(ServoCh1,1500,500)
waitcnt(clkfreq * 5 + cnt)

SERVO.SetRamp(ServoCh1,2200,500)
waitcnt(clkfreq * 5 + cnt)

SERVO.SetRamp(ServoCh1,1500,500)
waitcnt(clkfreq * 5 + cnt)


The regular non-ramping command SERVO.Set(ServoCh1,1500) works okay...

Rayman
03-28-2012, 02:11 AM
I don't see the problem right away... But, you are giving it a 10 second ramp and only waiting 5 seconds...
Maybe change 500 to 50 and see if that helps...

xanadu
03-28-2012, 02:26 AM
Thanks I tried that too.

I also re-downloaded the servo object, loaded the demo and changed the servo pin and that doesn't work either.

So... just for the heck of it I put the servo on pin 30 instead of 31 and it works better, but glitchy. I moved it to pin 6 and it works great. Does that mean my Prop is bad?

StefanL38
03-28-2012, 10:06 AM
it's not a good idea to use PIN31 for testing servos as this pin is also the Rx-pin.

simply test with a pin within the range 0..27. If you have something like the demoboard choose a pin-number
that has nothing else connected.

best regards
Stefan

Rayman
03-28-2012, 11:19 AM
You might be suffering from the famous problem that with a FTDI USB serial chip connected to P31&P30, voltage on these pins can cause the FTDI chip to power up and generate a reset...

So, like Stefan said, better to not use P30&P31. Or, if you're using a Prop Plug, you can remove it...

xanadu
03-28-2012, 06:41 PM
**Looks at Prop Proto-board Schematic and scratches head**

Wow, thanks guys I had not realized that pin was shared, or forgot since I started using the Prop Proto.