Servo control woes


Closed Thread
Results 1 to 25 of 25

Hybrid View

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


    Did you find this post helpful? Yes | No

    Post Datasheet !!!

    Hi,Eris

    Seems you have to read some closer the µChip Datasheet section 3 ...

    Lots ( ! ) of registers to set " by hand " that PbP do not handle !!!

    to confirm that, just program a dusty 16F84 ... will work properly with your example !!!

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

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    The internal oscillator doesn't automatically run at 8MHz. You have to
    write to OSCCON to switch to 8MHz.

    The default value of OSCCON frequency select bits is for 4MHz. See the
    datasheet for the default value in this register at power up.

    Also PULSOUT toggles the pin twice to produce your pulse, so the initial
    state of the pin determins the polarity of the pulse.

    You want a high-going pulse for your servo, so clear the pin before the
    PULSOUT command.

    See if this works.
    Code:
    @ DEVICE INTRC_OSC_NOCLKOUT, MCLR_OFF,WDT_OFF,PROTECT_OFF
    DEFINE OSC 8
    servo var PORTC.5
    i var word
    
    OSCCON = %01110000 ' Now it's going to run at 8MHz
    
    PORTC.5 = 0 ' <-- make pin low before PULSOUT (toggles high then low)
    TRISC.5 = 0  ' make pin an output
    
    loop:
    
    for i = 200 to 400
    low servo
    pulsout servo,i
    pause 18
    next i
    
    goto loop
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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


    Did you find this post helpful? Yes | No

    Cool

    Hi Eriswerks,

    Try using another servo or at least make sure that your servo is ok.

    Also, as you know, for most of the servos, the pulse range is from 100mS to 200mS.

    For some recent ones, range is from 60mS to 240mS (wider movement).

    Also, below is a code to consider while playing with servos.

    servo var portc.5
    freq var byte
    pulse var byte


    loop:

    pot portc.3,255,pulse
    pot portc.4,255,freq

    if pulse>240 then pulse=240 'Max pulse protection.
    If pulse<60 then pulse=60 'Min pulse protection
    If freq>30 then freq=30 'Frequency protection
    IF freq<5 then freq=5 'Frequency protection

    pulsout servo,pulse
    pause freq


    goto loop
    -----------------------
    If you also use an LCD, you can see at what value(s) your servo does what it does and how it does.



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

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


    Did you find this post helpful? Yes | No

    Talking Servo inside ???

    [QUOTE=sayzer]

    Try using another servo or at least make sure that your servo is ok.

    Also, as you know, for most of the servos, the pulse range is from 100mS to 200mS.

    > That's really new ...


    > Mhhhh, I do not know who's inside ... but he has a lot to learn about R/C Equipments ...

    Alain

    PS: ALL servos accept the 40-50 Hz frame rate ...
    ************************************************** ***********************
    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 " !!!
    *****************************************

  5. #5
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    ---------------------------------------------
    There must be some language in PicBasic to tell the PIC to which frequency to set the internal oscillator, but I haven't been able to find it.

    What am I (still) doing wrong here?
    ---------------------------------------------

    Yes, there is a PicBasic command... POKE

    Use POKE to write values to ANY register in the datasheet. I usually use binary values so it's easier to see and change individual bits:

    POKE OSCON, %10110001

    (this is a made up value, I don't know what you will need exactly)
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

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


    Did you find this post helpful? Yes | No

    Cool

    For Acetronics,

    This is not the place for your egoistic posts.

    Why don’t you go to a primary school and show the little kids how much you know about everything you think you know about?

    You can top your ego that way.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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


    Did you find this post helpful? Yes | No

    Angry The important thing is to speak ...

    Sayzer,

    If you want to know, I do not do care about my EGO ... no time for that.

    I'd just like you NOT to tell wrong things to those who do not know ...

    It's difficult enough to learn pic's programming ... try not to add your own errors nor misunderstandings ... verify first !!!

    Alain

    Engineer, 30 years of DiY R/C, ... and always doubting ...
    ************************************************** ***********************
    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Cool

    Ok, Acetronics I agree . People make mistake even the ones with 30yrs of experiences.

    Could you pls tell us what happens if we send 250mS - 300mS pulse to an R/C servo at 50Hz?

    Also, 350mS and 400mS at the same freq?

    How would servo respond to these pulse(s) ?

    Pls do not make it so complicated so that we, the learners without 30 yrs of experiences, can learn something from your valuable words. Before you post your answer, make sure that your answer does not conflict with your previous posts;

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

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


    Did you find this post helpful? Yes | No

    Angry Stoooooop !!!!

    Hi, sayzer

    So, you've decided to be frankly ridiculous ... your problem !!!

    250ms pulses @ 50 HZ gives .... a firm "1" ( or "0" ) level !!! you've just recreated the resettable monostable mutivibrator !!!

    Who should go back to primary school ??? ( period = 1 / frequency ... no need a highschool for that )

    your servo wil just have the little "jump" for amplifier settling at power up ... and won't move any more.

    you shouldn't have tried .... you're really boring.

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

Similar Threads

  1. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 09:40
  2. Replies: 10
    Last Post: - 26th May 2008, 08:00
  3. Help with Servo Control Please!
    By wireman22 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th June 2007, 19:15
  4. Control RC servo via Parallax Servo Control
    By cibotsan in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th September 2005, 09:18
  5. Servo control with 12F629
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th June 2005, 00:34

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