How do you store 1 to 2ms servo pulses in a variable?


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

    Lightbulb let's see ...

    Mhhhhhh,

    I think reading the 5 signals one after the other can't work like expected ...

    signal n+1 begins ~ 15 ns ( yes ... NANO seconds ) past signal n ends ...
    Pbp cannot follow that !!! ( verified ... need time to change input pin: 4-6 µs.) and we must wait for the following signals burst.

    So, @ 4 Mhz the default timeout is 650 ms ...

    here we have :

    2 + 27 + 27 + 27 + 27 + 5 x 2ms ( maxi ) ... 120 ms per loop ... ( W/a 40 Hz frame )

    The truth is elsewhere ...

    we must also verify pulses come in the same order as the inputs are connected ...

    I already have realised that (with 4 channels ...) and it can be done with a PULSIN - RCTIME - RCTIME - RCTIME - RCTIME sequence ...

    My Application is a 4 channel ... Failsafe. WORKING

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    signal n+1 begins ~ 15 ns ( yes ... NANO seconds ) past signal n ends ...
    Alain[/QUOTE]

    That's what I'm saying, PBP and pulsin will likely miss every 2nd servo 'pulse' coming from the receiver.
    Normally, obviously, you wouldn't want to use this sort of thing in an aircraft, or even an R/C car...but apparently, this is for some sort of 'turret control'.
    So, if that's the case, it probably wouldn't hurt to miss a pulse here and there. The code could just grab whatever pulses it could from whatever pins, and whichever pins it misses, just resend the last good value it got for that pin.

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


    Did you find this post helpful? Yes | No

    Question

    Hi, Skimask


    Back to our friend's program ... there's something " not told " ... cause it might give outputs ... even one of 3 or 4 !!!

    I'll give a try to that code on my breadboard ... or just use a 16F84 instead of my failsafe processor !!! Test board already made for 4 channels ...

    results tomorrow morning ...

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Skimask
    Back to our friend's program ... there's something " not told " ... cause it might give outputs ... even one of 3 or 4 !!!
    I'll give a try to that code on my breadboard ... or just use a 16F84 instead of my failsafe processor !!! Test board already made for 4 channels ...
    results tomorrow morning ...
    Alain
    If I'm reading this right, the original poster, wants to sample 5 channels, and based on the value of the 5th channel (be it high or low or whatever), send the 1st 4 channels either out these 4 channels or those 4 channels...just like he said, a channel switcher.
    If that's the case, why bother sampling the other 4 channels? Just sample the 5th channel and use an output based on that decision as an input to a 2 input AND gate, along with the other input coming from channel X.
    2 74L08's (8 2-input AND gates), one PIC12Fxxx (or even 10Fxxx) should handle the 5th channel switching chores.

    Of course that's only if I'm reading the project correctly.

  5. #5
    Join Date
    Jun 2007
    Location
    SW England
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Chaps, this is dead interesting stuff. Not sure that I follow ALL what is being said, but still good nonetheless.
    In the previous post I mentioned that both turrets need four servos each to operate. Apologies... I mislead. Each turret needs just THREE servos - not four. The usual 'landing gear' switch (Ch.5) is to be the switch that changes the three R/C pulses at PORTA to either PORTB.0 to B.2, or B.3 to B.5.

    Using a 4MHz crystal/resonator I found the output gives a slight amount of servo jitter. Not much, but enough to be annoying. Swapping the Xtal to 10MHz does counter that unwanted jitter, but then the 'reverse' timing becomes out of sync (servo neutral shifts to somewhere other than neutral).

    I like the AND gate suggestion. But in this case the three servos which are not being operated are to be set to their neutral positions while they're sleeping.

    The downloadable version is PBP is limited to around thirty lines of code. I'm toying with the idea of purchasing the full-working version, but reluctant to splash out £££s if I can't even understand how to write simple code for gadgets such as this.
    You guys obviously know what you're doing so I'm hanging on to your advice.

    Ace': Good luck with the breadboard lash-up. And thanks!
    Same goes for you too, Ski'.... Thanks for all your input with this.

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


    Did you find this post helpful? Yes | No

    Talking

    [QUOTE=Martin Peters;39803]

    Using a 4MHz crystal/resonator I found the output gives a slight amount of servo jitter. Not much, but enough to be annoying.

    > Good news ... your program works now ???

    Swapping the Xtal to 10MHz does counter that unwanted jitter, but then the 'reverse' timing becomes out of sync (servo neutral shifts to somewhere other than neutral).

    > Héhé, PULSIN resolution changes with XTal freq. ... so @ 10 MHz ... neutral becomes 150 x 10 / 4 = 375.

    I like the AND gate suggestion. But in this case the three servos which are not being operated are to be set to their neutral positions while they're sleeping.

    > Sending no signal to servos ( but servos always powered ) **might** leave them to their last position, if light effort like placing a gun barrel ... to be verified "live"

    The downloadable version is PBP is limited to around thirty lines of code. I'm toying with the idea of purchasing the full-working version, but reluctant to splash out £££s if I can't even understand how to write simple code for gadgets such as this.

    > If you want to do ... you have to learn !!! no "pushbutton" miracle device here ...
    > You'll have to learn some basics of general program writing like flowcharts ... clearly told : to write down what you want to do and how you will do it.
    > Translating those papers into µP languages is the easier part of the thing ...

    > Those "gadgets" we play with have needed some years learning and experiencing ... and we still learn each and everyday !!!
    > Are you ready for that ???

    You guys obviously know what you're doing

    > do you really think we know what we do ??? ( LOL )

    so I'm hanging on to your advice.

    My own advice is to look at what you want to do w/µP ... programming is like jogging ... stop for a while and It's a bit hard to recover the "cruising speed"

    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

    Lightbulb

    Hi, Martin

    I did some diving into my Model Boats docs ... and found a Proton Basic Program Called "Turret1" ... I think you found it too !!!

    That raised in my mind the problem is much more complicated than we think ...

    - Use the minimum count of channels to drive from 1 to 4 Turrets
    - Have slow turret rotation
    - Move 1 to 4 Turret at the same time ( "Inverting The signal" good reason ... ).
    - couple by couple would be really nice ...
    - Have slow Barrels positionning too ...

    And overall keep a "driving board" that can be placed on a Classic Transmitter !!!

    So, ... I decided to re-Start the project on the Basis Here explained ...

    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. Thermo 7 segments - little problem
    By fratello in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 27th July 2013, 07:31
  2. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 13:35
  3. one line led light make image
    By bioul in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 12:19
  4. HSERIN doesn´t work
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th July 2007, 14:23
  5. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36

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