16F876A Pulsin issues


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    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 " !!!
    *****************************************

  2. #2
    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

  3. #3
    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 " !!!
    *****************************************

  4. #4
    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?

  5. #5
    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 " !!!
    *****************************************

  6. #6
    Join Date
    Mar 2010
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    I have an idiot grin on my face, :-) im making some really good progress, I have the pulse in now displaying on the screen (strange from a JR Rx Im getting a range from 560 - 990 from the pulsin) and have the ability to jump to a servo test (sweep from side to side) at the push of a button, :-)

    My ADC is sort of working, with the voltage divider I'm getting 2.54V on my DMM, however if I display the ADC input Im only seeing 2 and not the .54 (obviously this will be multiplied by 2 once i get the decimals). I have tried:

    Code:
    lcdout $FE, $C0+8, dec volt
    
    and 
    
    lcdout $FE, $C0+8, # volt

    but still only get the first digit. Is this due to the ADC VAR being a "WORD"

    Code:
    Volt    Var     WORD
    .
    .
    .
    ADCIN 4, volt
    .
    .
    .
    My Vref from the regulator is 5.00V on my DMM

    Not sure im getting this whole ADC concept, I;ve read another one of Melanie's posts and from what I can work out, my RAW ADC in variable should be as follows:

    if my Vref = 5.00 then if my ADCIN was exactly 5.00V the ADC result would give me 1024, however I am giving a ADC of 2.54 I should get a value in the variable of 520? however I am displaying a single digit "2" on the LCD with the code above, not sure how to do the math on this.
    Last edited by Bobbo_ZA; - 30th March 2010 at 21:56.

  7. #7
    Join Date
    Mar 2010
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Ah, ok, finally, im a git, :-)

    Im now reading a 520 adc value with the battery on and the DMM measuring 2.54 (Needs to be multiplied by 2 to reverse the voltage divider effect).

    Err, something not right, im missing something with the math:

    Code:
        ADCIN 4, volt                  ' Read AN4 into temp variable
        Vin = (5*volt/1024)       ' Convert to voltage assuming 5.00 = 1024
    
    lcdout $FE, $C0+8, dec Vin,".",dec2 Vin,"V"
    pulling out many hairs, :-( my biggest issue is that even in school my maths was not great, spose thats why Excel was invented, for people like me, :-)
    Last edited by Bobbo_ZA; - 30th March 2010 at 22:56.

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