Referral to ULPWU/PLVD code per AN879??


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Talking Changing channel to 13 fixed it!

    Thanks Darrell. I should have caught that channel number myself. I was able to test this thoroughly by incrementally changing the Vthr constant in the code and correspondingly incrementing the target voltage in the PICKIT2. It now works like a charm.

    Thanks also for answering my question about the 6138/VDD calculation. I now understand the algorithm completely.

    Let me say how much I appreciate your frequent and outstanding support to the forum. I use it extensively and really do appreciate it.

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


    Did you find this post helpful? Yes | No

    Default

    SWEET!

    I expect to receive 1% of the value of that resistor and capacitor you saved.
    <br>
    DT

  3. #3
    Join Date
    Jan 2007
    Posts
    39


    Did you find this post helpful? Yes | No

    Default Re: Referral to ULPWU/PLVD code per AN879??

    Hello, I have found this post, because I want to do the same. I have 16F690 battery powered system and I want to detect low battery caase. I have Implemented the code like described here, but it somehow doesn't work:

    'read baterry
    VRCON.4 = 1 ; Turn 0.6V reference ON
    PAUSEUS 200 ; Allow VP6 to settle
    ADCIN 13, temp_word ; get VP6 analog reading (10-bit)
    VRCON.4 = 0 ; Turn 0.6V reference OFF
    VDD = 6138 / temp_word ; convert to voltage ve vdd je 25 = 2,5 V
    temp_data[9] = (VDD DIG 1) + $30
    temp_data[10] = "."
    temp_data[11] = (VDD DIG 0) + $30
    temp_data[12] = 13
    temp_data[13] = 10

    But it somehow doesn't work. If powerred with 3.3 V I have in VDD 42, if powerred from exhausted bateries with total voltage 2.4 V I have there 4 and if powered from new bateries with 3.1 V I have there 4. Do you have any idea, why it is doesn't work?
    Bob

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


    Did you find this post helpful? Yes | No

    Default Re: Referral to ULPWU/PLVD code per AN879??

    I imagine that you are only seeing 2 digits of a much larger number that was calculated wrong because either the A/D wasn't set up right or a variable size is wrong.
    Make sure you have these in your program.
    Code:
    temp_word VAR WORD
    VDD       VAR WORD
    
    DEFINE ADC_BITS 10
    ADCON0.7 = 1
    DT

  5. #5
    Join Date
    Jan 2007
    Posts
    39


    Did you find this post helpful? Yes | No

    Default Re: Referral to ULPWU/PLVD code per AN879??

    Wow, super, it's working now. I didn't specified the

    DEFINE ADC_BITS 10
    ADCON0.7 = 1

    Thanks a lot, I really apreciated you quick answer and help!!!

    bob

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

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