Shop OBEX P1 Docs P2 Docs Learn Events
Servo32v7 Object — Parallax Forums

Servo32v7 Object

xanaduxanadu Posts: 3,347
edited 2012-03-28 10:41 in Propeller 1
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...

Comments

  • RaymanRayman Posts: 14,844
    edited 2012-03-27 18:11
    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...
  • xanaduxanadu Posts: 3,347
    edited 2012-03-27 18:26
    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?
  • StefanL38StefanL38 Posts: 2,292
    edited 2012-03-28 02:06
    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
  • RaymanRayman Posts: 14,844
    edited 2012-03-28 03:19
    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...
  • xanaduxanadu Posts: 3,347
    edited 2012-03-28 10:41
    **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.
Sign In or Register to comment.