Pulsin Stabilization


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Posts
    52

    Thumbs up Pulsin Stabilization

    Hi All,

    Below is my code for turning on and off the landing lights of an RC model, however, I find the lights turning on and off randomly.... ??? ... confused...

    I'm using a 12F675, the pin connections as follows:

    GPIO.0, 1, 4 and 5 have LEDs connected (landing LEDs on gpio.4) all via the respective Resistors.

    GPIO.3 is connected to the RC input through a 1k Res (i've tried it direct)

    The program responds as expected on the RC input however on either side of the switch (on or off) the lights randomly turn on (when they are sposed to be off) and off (when they are sposed to be on.)

    There is nothing connected the GPIO.2, however I am not sure if tis "open" pin could be causing it.

    I checked with the scope and the input signal seems to be stable, just dont know why the signal seems to be jumping within the pic, any ideas?

    Many thanks
    Rob

    Code:
    @ DEVICE INTRC_OSC, MCLR_off, PROTECT_OFF, WDT_ON, PWRT_ON, BOD_ON
    CMCON = 7 ' Comparators OFF
    ANSEL = 0 ' A/D OFF -- Port pins all digital
    TRISIO = %001000 ' All output but GPIO3 = input
    GPIO = %000000 ' All 0 on boot 
    ADCON0  = 0
    WPU = 0
    DATA @1,$FF, $FF
    'DEFINE PULSIN_MAX 3000
    
    wing_led2   Var GPIO.5  
    land_led1   VAR GPIO.4
    tail_Led   VAR GPIO.0
    strob_led   VAR GPIO.1   
    servoin     VAR GPIO.3
    p var word
    '---------------------------------------------------------
    start:
    '---------------------------------------------------------
    Pause 200 ' Stabilisation at startup
    p = 0
    High wing_led2      
    High tail_led
    
    PulsIn servoin,1,P
    SELECT CASE p
       CASE is >160
          HIGH land_led1
       Case is <130
          LOW land_led1
    End select
    Low strob_led
    pause 250
    High strob_led         
    pause 100
    low strob_led  
    GOTO start
    End

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Pulsin Stabilization

    Your Rx may be glitching, maybe set it up to wait for 3 vaild pulses before changing states of the lights. Now if the are staying on when they should be off, and staying off when they should be on, maybe you need to hit the rev for that channel in your radio
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  3. #3
    Join Date
    Mar 2010
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: Pulsin Stabilization

    Thought about that too, tried it on a 2.4ghz set (which should be a more solid signal) and yet it still does it, also I would expect it to remain in the last state when the Rx is off yet they still randomly turns on and off again, :-(. I tried a 1k res to ground from GPIO.3 but then it does not work at all, :-(

    Its ironic that something this "simple" is proving such an issue, probably spent 24 hours solid on this project and hundreds of rewrites but still not etting it, :-(

    I have another circuit that i had done for another application where i used the same principles that works flawlessly, yet this just doesnt, only this one is on vero board.
    Last edited by Bobbo_ZA; - 30th August 2011 at 20:52. Reason: Spelling

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Pulsin Stabilization

    An open pin is not a problem as long as you code it as an output near the beginning of the program.

    You might try a debounce type of routine to hide false signals.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Pulsin Stabilization

    It might be helpful to take your unused GPIO.2 and connect it to the Rx of a RS-232 port on your PC, then use DEBUGOUT or SEROUT2 to send the value of PULSIN to the PC. It is even better if you have one of those little TTL-RS232 converters lying around and use that.

    Serial ports make wonderful debugging tools.
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default Re: Pulsin Stabilization

    Motion seconded.
    Steve

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

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