16F876A Pulsin issues


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie,

    Firstly, wow, thank you, :-) all the reading up I was doing last night and I cant believe I missed that, :-), makes sense and I'm sure it will work (will have to wait till I get home from work to test it - note to self, bring board to work)

    Another probably small issue I have is the pic does not seem to be driving the servo correctly, in the 12F I could simply do a pulsin on one pin and pulsout to another pin which would control the servo no problem (Planing to use this as a failsafe - want to read in a switch channel and depending on the position I'll output either direct to the servo or via another pic or Arduino for navigation), however now with the 16F the servo moves in one direction but extremely slowly, like 1mm every 5 minutes, its almost as if the resolution is so high its moving in tiny steps, could this be caused by the 20Mhz osc?

    Thanks again
    Rob

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


    Did you find this post helpful? Yes | No

    Default

    The value of P (or other timing) may well reveal why.

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Bobbo

    Try this

    Code:
    ...
    
    PAUSE 2000
    LCDOUT $FE, 1, "Pulse"," "
    
    Main:
        PulsIn Rx,1,P                    'Read in Rx input
        LOW servo
        pulsout servo, P                 'output to a servo connected on B.1
        Toggle PORTB.5
        LCDOUT $FE, $80+7,  # P    'Output to LCD
        LCDOUT $FE, $C0+1,# P           'Testing on the second line
    goto main:
    
    ...
    Servo will follow the input signal ...

    Alain
    Last edited by Acetronics2; - 30th March 2010 at 11:15.
    ************************************************** ***********************
    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
    Mar 2010
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    I feel like such a rookie, :-) I should have look at more of my previous code, :-)

    Code:
    pulsin gr,1,g	
    pulsin rx,1,P          
    low throttle
    pulsout throttle, P
    Thanks exactly what I had in a previous project, :-)

    Can't wait to get home now, :-)

    Will post pics once I have it programed and working, hope to build up a nice multi function test unit - once thing im still investigating is how to measure the battery voltage of a 4 cell flight pack (nicad or nimh) with a 250ma load, im using the units 5.02V regulated supply as a reference but not quite sure if I could just give the flight pack's V to the ADC through a resistor and work from there? 4 Cell fully charged will give me 5.6V and I dont know what the ADC does when the voltage is higher than the reference V, also could the pic handle the extra .6V?

    On a side note I'm still hunting down a case for my LM35 project, finally got some ally tubing to house the sensor, just need to find a nice case for the PIC and water proof it, :-) (will post pics etc as well once complete)

    Kind Regards
    rob

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Rob

    Consider all inputs are clamped to Vcc + .6 v ... ( take care: clamps diodes are very Weeeeeeak ! )

    so, the best is not to have more than Vcc ... or use strong external clamp diodes ( 1 N4148 i.e )

    but analog inputs can rise to Vref + 2v ... not forgetting Vcc+.6v is an absolute maximum ...

    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
    Join Date
    Mar 2010
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Would adding a bigger load to the pack solve the problem? A bigger load should pull the cells down to 1.2v per cell to give me a max of 4.8V on a fully charged pack? perhaps a 500ma load?

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


    Did you find this post helpful? Yes | No

    Wink

    Bad Idea ...

    just use a voltage divider in the input ...

    1/2 is the easiest to find ( 2 equal 1% resistors ) ...
    2/3 is still easy ( 1 k and 2k resistors @ 1%)

    Installing a load that can draw 300 - 400 mA on demand is rather a good thing ...

    But think regulator doesn't output EXACT 5.000 v ... so measure it and enter value as a parameter for calculations ...

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

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