Servo troubles.


Closed Thread
Results 1 to 28 of 28

Thread: Servo troubles.

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Location
    Stockholm
    Posts
    80


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Decrease the 100 until it starts pausing at one end (meaning the PIC is trying to over-drive the servo) and increase the 200 until it starts pausing at the other end (again, meaning the PIC is trying to over-drive the servo in the other direction).
    Well, as you said before the values depends on which servo I use, I settled for the servo that I'm going to use (the brand new china-made) and with that 75 and 255 seem to be the correct values, however, when its 255, its still not at the endpioint, its a few mm more left. ..However this doesnt matter.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Glenn View Post
    however, when its 255, its still not at the endpioint, its a few mm more left. ..However this doesnt matter.
    Change your BYTE variable to a WORD variable and you'll be able to go beyond 2.55 ms. But that sounds a bit goofy since a 2.55ms pulse width is out of spec for most servo's. But hey, if it works for you, go with it...

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi, SKI

    The maximum I ever reached is 250 µs to 2600 µs ... with a Futaba S3001 or a Robbe RS100 ...

    not linear at all between 250 and 600µs !!!

    regards
    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Glenn

    I Think I've found what looks "strange" to you ...

    Code:
    @ device HS_OSC,MCLR_OFF,LVP_OFF,WDT_ON,PROTECT_OFF
    DEFINE OSC 4
    
    CMCON = 7 ' Disable comparators
    
    PORTA = %00000011
    PORTB = 0
    
    TRISA = %00000011
    TRISB = 0
    
    'Use b1 to hold pulse width variable for servo 1
    
    b1 var WORD
    
    'initialize variables
    b1 = 150 << 4
    
    low portb.0		' put the servoport low.
    main:
    
            low portb.0
    	pulsout portb.0, ( b1 >> 4 )	'send current servo 1 position out
    	if porta.0 = 0 then left1	'check for pressed switch 0
    	if porta.1 = 0 then right1	'check for pressed switch 1
    
    bugtrap:
    
            if b1 > ( 150 << 4 ) then
                   b1 = b1 - 1
    
            else
                   if b1 < ( 150 << 4 ) then b1 = b1 + 1
                  
            endif
            pause 18 : goto main
    
    left1: 
             IF porta.1 = 0 Then bugtrap
             b1 = b1 + 1 
             if b1 > ( 3199 ) then max1
             Pause 8 : goto main
    
    right1:  
               IF Porta.0 = 0 Then bugtrap
               b1 = b1 - 1 
               if b1 < ( 1601 ) then min1
               Pause 8 : goto main
    
    max1:  b1 = ( 100 << 4 ) : goto main ; jump to other side
    
    min1:  b1 = ( 200 << 4 ) : goto main ; jump to other side
    
    END
    This is not the "perfect movement" ... but the maximum to get from this coding style.

    Alain

    PS : Question : Why multiply b1 per 16 ( << 4 ) and divide it per 16 ( >> 4 ) when outputting the pulse.
    The answer to last trouble is here !!!
    Last edited by Acetronics2; - 23rd September 2008 at 08:39.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  2. Problem with 12F629, servo and EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st March 2008, 09:53
  3. Servo does not move
    By ruijc in forum General
    Replies: 12
    Last Post: - 12th November 2007, 19:14
  4. Beginner + Servo
    By james in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st July 2007, 21:31
  5. Help with Servo Control Please!
    By wireman22 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th June 2007, 18:15

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts