servo pulse problem...


Closed Thread
Results 1 to 6 of 6
  1. #1
    tonkgang's Avatar
    tonkgang Guest

    Default servo pulse problem...

    hye.. i am newbie here and this is the first time ever i joined a forum in the net. first of all, sorry 4 my poor english..

    a little question. is there a limit number of pin for microcontroller to generate pulse? i am using pic16f877 with a 4Mhz oscillator to drive a servos. i started with the code for centering 8 servos and the problem is when i checked the pulseout signal with a oscilloscope, the delay between pulse (1.5ms) is about 40ms. how could this happen?

    here is my code:

    b0 var byte
    b1 var byte
    b2 var byte
    b3 var byte
    b4 var byte
    b5 var byte
    b6 var byte
    b7 var byte
    b8 var byte
    b1 var 150
    b2 var 150
    b3 var 150
    b4 var 150
    b5 var 150
    b6 var 150
    b7 var 150
    b8 var 150

    trisb = %00000000
    portb = %00000000


    init:
    pulsout portb.0, b1
    pulsout portb.1, b2
    pulsout portb.2, b3
    pulsout portb.3, b4
    pulsout portb.4, b5
    pulsout portb.5, b6
    pulsout portb.6, b7
    pulsout portb.7, b8
    pause 20
    goto init

    end
    ------------------------------

    is it microcntrlr problem or my code or anytihng else that i dont know?
    sorry for being dumb. i am new to this pic and picbasic thing.
    appreciate any helps

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Cool

    Try the little experiment below if you could.
    Also, if you can, use 20Mhz OSC and modify the timing accordingly.


    TRISA = 0
    TRISB = 0
    TRISC = 0
    TRISD = 0
    TRISE = 0


    b var byte[8]

    for b[8]=0 to 7
    b[b[8]]=150
    next b[8]



    init:
    pulsout portb.0, b[0]
    pauseus 2250
    pulsout portb.1, b[1]
    pauseus 2250
    pulsout portb.2, b[2]
    pauseus 2250
    pulsout portb.3, b[3]
    pauseus 2250
    pulsout portb.4, b[4]
    pauseus 2250
    pulsout portb.5, b[5]
    pauseus 2250
    pulsout portb.6, b[6]
    pauseus 2250
    pulsout portb.7, b[7]
    pauseus 2250

    'Total pause for each servo is approx. 18mS (~50Hz)

    goto init
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    tonkgang's Avatar
    tonkgang Guest


    Did you find this post helpful? Yes | No

    Red face

    thankz so much sayzer for showing me the other way to solve the problem. i dont try it yet. hope it works for this time.

    can u explain to me why such problem occurs in my code?

  4. #4
    tonkgang's Avatar
    tonkgang Guest


    Did you find this post helpful? Yes | No

    Question

    er one more newbie questions.. why the servo position its shaft at outmost left for 2.0ms pulseout and 1.0ms pulseout position the servo shaft at outmost right?

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


    Did you find this post helpful? Yes | No

    Talking one never knows

    Quote Originally Posted by tonkgang
    er one more newbie questions.. why the servo position its shaft at outmost left for 2.0ms pulseout and 1.0ms pulseout position the servo shaft at outmost right?
    Hi, tonk

    The same question : why do we drive on the right side in France and on the left side in England ...

    Some times ago there were "normal" servos and "reverse" servos ... then went the programmable radios ... and the mechanical problem disappeared.

    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
    tonkgang's Avatar
    tonkgang Guest


    Did you find this post helpful? Yes | No

    Talking ooo hoho

    never know that. thanks alain

    then again.. is there a limit no. of pins to generate pulse? i have read somewhere before this which say not to exceed 8-10 servos for each microcontroller. correct me if i'm wrong..

    thankz again
    Last edited by tonkgang; - 7th April 2006 at 19:14.

Similar Threads

  1. DC to servo pulse converter
    By Agent36 in forum General
    Replies: 2
    Last Post: - 16th December 2009, 07:09
  2. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 09:40
  3. Problem with 12F629, servo and EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st March 2008, 10:53
  4. Problem with servo and PIC16F616
    By Forkosh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th November 2007, 22:22
  5. R/C Servo pulse Monitor
    By Harddkyss in forum Code Examples
    Replies: 7
    Last Post: - 25th February 2007, 16:00

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