Problem with servo and PIC16F616


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    21

    Angry Problem with servo and PIC16F616

    Heres my problem :
    I can get one of the modified servos to go forward ( a pulse of 100 ) and another one of the modified servos to go backward ( a pulse of 169) , only at the same time.

    In other words

    I can do :

    servo1 var portc.3 'left Servo
    servo2 var portc.2 'right Servo
    forward con 100
    backward con 169

    pulsout servo1,Forward
    Pulsout servo2,Backward
    pause 18

    to make one servo go backward and one go forward

    BUT when I do just servo2 like follows

    servo1 var portc.3 'left Servo
    servo2 var portc.2 'right Servo

    forward con 100
    backward con 169
    pulsout servo2,backward

    it gets messed up and then it can only go in one direction and it doesn't reverse. But still for both of them at the same time it can do both , but not reverse one. I've tried different pulses with servo2 to get it to go backwards but its a no go.


    What am I doing wrong???

    I am using a PIC16F616 @ 4mhz and two modified HS-425BB servos.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    sure you didn't properly disabled the ADCs... did you? i don't see any line with ANSEL?

    Datasheet, register 4-3, PDF page 34.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3


    Did you find this post helpful? Yes | No

    Default PulsOut is a toggle - you must preset it

    The pulsout command just flips the state of the pin. If the pin were high it gets set low, if the pin were low it gets set high. Although you might expect your starting state to be always low, real world interference does happen and you must set the pin state low to be really sure. I spent days hunting low level random servo chatter in my UAV controller which was corrected by initialising the pins before calling pulsout..

    1. Try presetting the state before calling Pulseout.
    Low servo1
    low servo2
    pulsout servo1, forward
    pulsout servo2, reverse

    2. Current draw causes weirdo effects.
    When you demand a large movement from one or more servos almost instantaneously the servos will draw high current. Although the servos draw small average current, they pull high instantaneous currents. About 1500 mA for a standard size analog servo and about 5000 mA for a digital servo (as measured on my JR servos). This can cause your power supply to sag and give you weird outputs. I always drive my RC logic from a separate power supply to the servos to minimise this and stagger servo operation with the maximum possible delay between each servo movement.

    HTH
    Brian

Similar Threads

  1. Problem with PULSEOUT
    By Forkosh in forum General
    Replies: 2
    Last Post: - 21st October 2007, 12:19

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