Shop OBEX P1 Docs P2 Docs Learn Events
A problem about the object "servo32v7_RampDemo" — Parallax Forums

A problem about the object "servo32v7_RampDemo"

kevinspacekevinspace Posts: 56
edited 2011-01-11 07:39 in Propeller 1
Hello everybody, I'm encountered a problem about the object "servo32v7_RampDemo".

(http://obex.parallax.com/objects/51/)

In the servo32v7_RampDemo,when I wanted the servo turn to the specified position,

I discovered that seems must add the Set command before the SetRamp command.

If I only used the SetRamp command without the Set command, that will appeared some errors.

Like this program :

CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
ServoCh1 = 0 'Select DEMO servo

OBJ
SERVO : "Servo32v7.spin"

PUB Servo32_DEMO | temp
SERVO.Start
SERVO.Ramp
SERVO.SetRamp(ServoCh1,2300,200) ' set the servo turn to most right side



Here is the wave of the SetRamp(ServoCh1,2300,200) command.
Above the video, the servo didn't turn to the most right side position directly, it turned to left in the

beginning, then turned to the specified position (most right side).

So I think that must add the set command in the first.

Like this program :

CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
ServoCh1 = 0 'Select DEMO servo

OBJ
SERVO : "Servo32v7.spin"

PUB Servo32_DEMO | temp
SERVO.Start
SERVO.Ramp
SERVO.Set(ServoCh1,1500) ' set the initial servo position in the first
waitcnt(clkfreq*2 + cnt)
SERVO.SetRamp(ServoCh1,2300,200) ' set the servo turn to most right side
waitcnt(clkfreq*2 + cnt)
SERVO.SetRamp(ServoCh1,700,200) ' set the servo turn to most left side
waitcnt(clkfreq*2 + cnt)
SERVO.SetRamp(ServoCh1,2300,200) ' set the servo turn to most right side

Above the video, when I added the set command in the first, then the servo will turn to the

specified position successfully and without any troubles.

My question is how to solve the phenomena which only used the SetRamp command and without Set command

Is there are anybody can give me any suggestion?

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-01-11 00:41
    Yes, SET should be executed first. The demo program in the OBEX has the correct order. The Set command tells the Servo Handler which servos are active (enabled) and what the initial position should be for the servo.
  • kevinspacekevinspace Posts: 56
    edited 2011-01-11 01:04
    Thank you very much, Beau Schwabe (parallax) !

    That means when I want to use the object "servo32v7" , I always must add the Set command beyond each the SetRamp ?

    or only add the Set command once in the first ?
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-01-11 07:14
    You just need the Set command at the beginning. Once this is done, the Servo Handler knows which servo's you are using and where the 'initial' position is. SetRamp will move to the 'new' position at the rate that you determine, while an additional Set command will over-ride the SetRamp and move the servo to the immediate last executed Set position.
  • kevinspacekevinspace Posts: 56
    edited 2011-01-11 07:39
    You just need the Set command at the beginning. Once this is done, the Servo Handler knows which servo's you are using and where the 'initial' position is. SetRamp will move to the 'new' position at the rate that you determine, while an additional Set command will over-ride the SetRamp and move the servo to the immediate last executed Set position.

    I am grateful for your assistance, Beau Schwabe.
Sign In or Register to comment.