Servo does not move


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1

    Unhappy Servo does not move

    Greetings,

    i've found a program to move a servo ( left and right ).

    Did some minor modifications ( lcd pinouts ) and programmed my pic 16f84A.

    However the servo does not move !

    The LCD displays the position OK and the buttons work OK but there is no movement from the servo.
    With an ohmeter i cannot sense any voltage also.

    Is there something wrong with the program ?
    Any ideas ?

    This is the program:

    pos var word ' Servo position
    servo1 var PORTB.4 ' Alias servo pin

    Low servo1 ' Servo output low
    PORTB = 0 ' PORTB lines low to read buttons
    TRISB = $fe ' Enable first button row
    Pause 100 ' Wait for LCD to startup
    Gosub center ' Center servo

    mainloop:
    If PORTB.5 = 1 Then
    Gosub left
    Endif
    If PORTB.2 = 1 Then
    Gosub center
    Endif
    If PORTB.6 = 1 Then
    Gosub right
    Endif

    servo1 = 1 ' Start servo pulse
    Pauseus 1000 + pos ' Delay for servo pulse high time
    servo1 = 0 ' End servo pulse
    Pause 16 ' Servo update rate about 60Hz
    Goto mainloop ' Do it all forever

    left:
    If pos < 2000 Then
    pos = pos + 1
    GoSub display ' Display new position on LCD
    Endif
    Return

    right:
    If pos > 1000 Then
    pos = pos - 1
    GoSub display ' Display new position on LCD
    Endif
    Return

    center:
    pos = 1500
    GoSub display ' Display new position on LCD
    Return

    display:
    Lcdout $fe, 1, "Position = ", #pos
    Return

    end

    thanks

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default

    Hi,
    You have the servo on portB.4 but then you do
    Code:
    TRISB = $fe ' Enable first button row
    Which sets that pin to input. So when you do:
    Code:
    servo1 = 1 ' Start servo pulse
    Pauseus 1000 + pos ' Delay for servo pulse high time
    servo1 = 0 ' End servo pulse
    Pause 16 ' Servo update rate about 60Hz
    Goto mainloop ' Do it all forever
    PortB.4 won't go high since it's set to be an input.

    Either change your servo1 = 1 to HIGH servo1 and servo1 = 0 to LOW servo1 or make sure that PortB.4 is setup as an output.

    /Henrik Olsson.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    that's it !

    i missed that !

    thanks . it's working fine now.

    .

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I have all things working and changed the code to be more complete.

    But still having some issues.

    I've noticed that the value for the servo to be centered the pos must be 400 ( even with the original code )

    for far left the value must be 1300

    but for far right 0 is not enough.

    i've tryed this but doesnt work...

    right:
    If pos > -100 Then
    pos = pos - 10
    Endif
    servo1 = 1
    Pauseus 1000 + pos
    servo1 = 0
    Pause 16 ' Servo update rate about 60Hz
    Return

    any ideas ?
    and why arent the original values working for me ? I've seen many servo programs and all have the same values for center.

    thanks

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


    Did you find this post helpful? Yes | No

    Default

    Hi, Ruijc

    I think you are "mixing" and misunderstanding some servo parameters here ...

    so, before going further ... what is your servo model and brand ??? and what is your radio set ???

    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 " !!!
    *****************************************

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Hi Alain,

    thanks for your help.

    i'm currently using a futaba's S148 servo.

    My idea is to test any futaba and hitec servos ( digital and analog ).


    .

Similar Threads

  1. PIC16F877A pwm use for IR transmission
    By mcbeasleyjr in forum General
    Replies: 0
    Last Post: - 11th July 2009, 18:51
  2. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  3. How to move servo slowly?
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th April 2009, 13:50
  4. Problem with 12F629, servo and EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st March 2008, 09:53
  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 : 0

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