Shop OBEX P1 Docs P2 Docs Learn Events
Problem Controlling Continuous Rotation Servo to 90 degrees — Parallax Forums

Problem Controlling Continuous Rotation Servo to 90 degrees

Yan HanYan Han Posts: 3
edited 2007-03-23 15:26 in General Discussion
i have written an assembly language source code, as shown below to control the Continuous Rotation servo motor, such that it rotates CLOCKWISE 90 degrees and stop momentarily until the next input is triggered. Then it rotates CLOCKWISE again 90 degrees and stop. the process repeats.

Run
movlw 0x0C
movwf COUNT_2

loopd
decfsz COUNT_2,f
goto One
return

One
BSF PORTB,7
CALL Delay
BCF PORTB,7
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay
CALL Delay

GOTO loopd

Delay
movlw 0xF9
movwf COUNT_1
loop
decfsz COUNT_1,f
goto loop
RETURN

i understand that this method is different from the conventional time-pulse method. Initially, it worked sort of well for the first few rotations, but gradually the position is no longer perpendicular.

is there any explaination for this? or even better, can anyone provide an example program to execute the desired movement? i am looking forward to receiving replies a.s.a.p, as i urgently need to solve this for my final year project. thanks!

Comments

  • ForrestForrest Posts: 1,341
    edited 2007-03-23 03:42
    Check this message from 2 days ago http://forums.parallax.com/showthread.php?p=639459
  • Yan HanYan Han Posts: 3
    edited 2007-03-23 04:26
    this method is using the optical sensor to control the position. but i thought the positioning of servo motor is controlled by various time pulse; 1.0 ms hi for anti-clockwise, 2.0 ms hi for clockwise.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-03-23 04:45
    In a continuous-rotation servo, the internal feedback mechanism (a potentiometer) has been mechanically disconnected from the shaft. The only thing that the pulse widths control is the speed of rotation — not the position. To get accurate positioning, you need additional position feedback. An opto sensor is one such method.

    -Phil
  • Yan HanYan Han Posts: 3
    edited 2007-03-23 04:56
    no wonder.... ok thanks a lot!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-23 15:26
    This thread is being moved from the BASIC Stamp Forum to the Sandbox Forum.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.