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

    Angry

    Eris's pulses are NOT 200 to 400 ms, as you tell,

    but 200 to 400 x 5µS !!! this EQUALS 1 to 2 ms ...

    read your manual more carefully before hoping to give lessons ...


    Straight back to primary school !!!

    Hope not to read you any more about that. CENSORED !!!

    E.O.F.

    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
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Cool Apology

    Acetronics,

    I would like to apologize for the things I said.

    You were right and I was wrong. I missed some parts and behaved impolite.

    I also sent you a private message to apologize.

    Sayzer

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

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


    Did you find this post helpful? Yes | No

    Wink no public apologies needed ...

    [QUOTE=sayzer]Acetronics,

    I would like to apologize for the things I said.

    ...

    Hi, Sayzer

    that's kind from you ,

    the only important thing is you've learnt something useful ... I don' like this teaching method ... but I'm pretty sure you will always remember about PULSOUT resolution.
    a good joke is my favourite method for students to keep things in mind.

    That's the only real important thing....; may be ... life respect too, but it's not the right place to discuss it here.

    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
    Feb 2006
    Posts
    11


    Did you find this post helpful? Yes | No

    Default Update: absolutely no progress

    I've tried all the tips you guys gave, and have also been trying any and all PicBasic servo control code I could find on the net, but something is still not right. I've tried four different servos that I know to be functional. I've tried a 16F690 and a 16F628A, with the internal oscillator and with an external 4MHz crystal. I've tried changing the pulsewidths and pauses to every reasonable and many unreasonable numbers. I've switched breadboards. I'm shopping around for a goat to sacrifice to the PIC.

    Here's what I'm trying to use now, with a 16F628a:

    trisb = 0
    cont var byte
    cont = 0
    led var PORTB.1

    hither:

    low led
    for cont = 0 to 50
    pulsout PORTB.0,110
    pause 18
    next cont

    goto yon

    yon:

    high led
    for cont = 0 to 50
    pulsout PORTB.0,190
    pause 18
    next cont

    goto hither


    It is a slightly modified version of some code from the rentron site, which was meant for a 16F84. My include file (not the whole thing of course) looks like:

    device pic16F628A, xt_osc, wdt_on, mclr_on, lvp_off, protect_off


    My LED does flash convincingly, but still my servo heads to one extreme and stays there. This is keeping me awake at night now. What mistakes might I still be making? Does anyone know of an example of a working servo controller written in PicBasic, including a circuit diagram and not intended for a 16F84? I just need something functional to build on.

    You're probably sick of this thread by now, but any help would be appreciated.

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


    Did you find this post helpful? Yes | No

    Cool

    Try this code.
    Schematic and code are also attached.
    ------------------------------------------------------------------------


    @ DEVICE intrc_osc, MCLR_OFF,WDT_OFF,PROTECT_OFF

    DEFINE LCD_EREG PORTA
    ' Set LCD Enable port

    DEFINE LCD_EBIT 7
    ' Set LCD Enable bit

    TRISA=%00100000
    ' RA5=Input, Rest= Output

    TRISB=%01100001
    ' RB6, RB5, RB0 = Input, Rest=Output

    '--------Assign name to ports---------------
    potvar var portb.0
    'Pot is connected to RB0.

    servo var portb.3
    'Servo is connected to RB3.

    Button1 var portb.5
    'Button1 is connected to Portb.5 and increases the frequency.

    Button2 var portb.6
    'Button2 is connected to Portb.6 and decreases the frequency.


    '---------Variables-------------------------
    pulse var byte
    'Variable to hold Pot value for servo Position

    freq var byte
    'Variable to hold Button1 and Button2 adjustments for Frequency

    '--------Initial Setup----------------------
    Freq=18
    'Initial Frequency

    '--------Main Loop-------------------------

    loop:

    IF button1=0 then freq=freq+1
    'Incr freq

    IF button2=0 then freq=freq-1
    'Decr freq

    IF freq>30 then freq=30
    'Max. Low freq

    IF freq<5 then freq=5
    'Max. High Freq

    pot potvar,255,pulse
    'Read pot and store the value in pulse variable

    If pulse>240 then pulse=240
    'Max. Pulse 240mS

    IF pulse<60 then pulse=60
    'Min. Pulse 60mS.

    pulsout servo,pulse
    'pulsout the stored pot value (pulse) to servo pin.

    pause freq

    lcdout $fe,1,"Pulse:",#pulse
    LCDOUT $fe,$c0,"Freq:",#freq


    goto loop

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

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


    Did you find this post helpful? Yes | No

    Question little walkaround ...

    Hi, Eris

    Seem strange ...

    There's one last thing we didn't had a look to : Your supply !!!

    Could you describe it or better send a scheme.

    On my side, I try your code on my 628 R/C testboard ... just to be sure!.

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

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


    Did you find this post helpful? Yes | No

    Wink Walkaround highly requested ...

    Hi, Eris

    Bad news ... I copied and pasted your code, just changed portB N°s as required here ... put a 6LR1 cell ( there's a regulator on the board !!! ) and a futaba servo.

    Every thing goes as you programmed it : the led blinks and the windscreen wiper does its job ...

    The problem is not ( no more ... humour ) in your code ...

    So, What to do ??? ...

    First verify your servo supply ( good common ground w/Pic ... enough current to feed the servo ...)

    Second verify the signal lead of the servo ... servo behaviour smells no received signal !!!
    In that way I would recommend you !!! SOFORT !!! to add a 1k resistor between Portb.0 and your servo connector.

    I keep the line
    Alain
    Last edited by Acetronics2; - 27th February 2006 at 13:12.
    ************************************************** ***********************
    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. Replies: 10
    Last Post: - 26th May 2008, 07:00
  3. Help with Servo Control Please!
    By wireman22 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th June 2007, 18:15
  4. Control RC servo via Parallax Servo Control
    By cibotsan in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th September 2005, 08:18
  5. Servo control with 12F629
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd June 2005, 23: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