Updating HPWM frequently, safe?


Closed Thread
Results 1 to 40 of 79

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I tried every AD oscillator / Sample time possible, and it made no difference.
    Even with the A/D input tied directly to ground, it was getting crazy readings between 0 and 20.

    After I tried it with a 12F675 (without the CCP) and got the same results,
    I finally figured out that I had removed the big cap on the power lines on this protoboard.
    Probably needed it for something else. Doh!

    After putting a 100uf cap across the power supply, everything calmed down again.
    It's still not perfect, but I think that has alot to do with the breadboard.

    So then to really stabilize things I added an averaging routine, and I think that's about as close as we're going to get.

    First make sure you have enough capacitance on your power lines (I think mister_e already suggested that).

    Then add this to the bottom of the program
    Code:
    ' -=-=-=-=-=-=  Average Analog values -=-=-=-=-=-=-=-=-=-=
    Avg       VAR WORD
    AvgCount  CON 16
    spread    CON 20
    
    Average:    ' Smooth data
        IF ABS (pote - Avg) > spread then
            Avg = pote
        else
            Avg = (Avg*(AvgCount-1)+pote)/AvgCount 
            pote = Avg                               
        endif
    Return
    And also, just after the ADCIN statement, add this
    Code:
        gosub Average
    HTH,
    DT

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


    Did you find this post helpful? Yes | No

    Default

    it's getting interesting... i have everything on hand, will do some test here.

    Sorry, i was suppose to do it yesterday
    Steve

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

  3. #3
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    well I hope you find something because I tried adding a 100uF capacitor in the power lines or in parallel with the wiper and my problems remain, even after adding the averaging routine provided by Darrel.

    I even started looking for other pic alternatives in case this can't be solved...

    Thanks again

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


    Did you find this post helpful? Yes | No

    Default

    still working @ 3.x Volt?
    Steve

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

  5. #5
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    yes Sir, using a 3.6v li-ion batt


    Pablo

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


    Did you find this post helpful? Yes | No

    Default

    O.K. can you try to program you pic with the .HEX in attachment and let me know what's happening now?

    Finger crossed...
    Attached Files Attached Files
    Steve

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

  7. #7
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    O.K. can you try to program you pic with the .HEX in attachment and let me know what's happening now?

    Finger crossed...
    it uses the circuit I provided right? will test it tomorrow and let you know. Thanks!!!

Similar Threads

  1. need help on hpwm
    By helmut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th August 2007, 16:49
  2. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 16:05
  3. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 15:14
  4. HPWM and A to D interaction question 18F252
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th May 2006, 04:50
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 03:43

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