18F2520 ADC issue


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614

    Question 18F2520 ADC issue

    Hi,

    A little thing I do not understand :

    I have a 4.096 voltage ref for ADC
    Input sees a LM335 , through a 10k/.22µ L.P.F., powered from 5 v with a 2.2k series resistor.
    Wiring to lm335 is ground shielded.

    Everything has worked fine for 25+ hours ... ( reading Ok ... etc,etc ...)


    Now,

    An ADC input overflow has occured ( logged by the system ) that should NEVER had happend ... and the ADC result now is DIVIDED by 2 !!!

    a ( say many ! ) system reset did not change anything ...


    I took the chip off to read its logging values and just rewrote the "wrong logged" data. ( NO change to the program ).


    Pic placed Back to its place ...

    ISSUE has disappeared... everything fine again.



    Soooo ...

    Is there some limitation on ADC input voltage relative to the ADC Vref ??? ...

    Yess ... Parameter A25 ( Midrange data ) says ... Vref + 0.3v !!! , that seems logical not to input more than what can be read, ... but no such issue specified ...

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

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Janine View Post
    I am just wondering if there are some one know how to change c code to picbasic.
    Or if some one can help me to write PICBASIC code for LCD03
    I also use BASIC.
    How did this go from Ace's ADC issue to converting code from C to PicBasic?
    If you know C (cut and paste from some website somewhere?), then reading your code in Post#3 and converting that to a similar PicBasicPro program should be easy enough. Looks easy enough to me...but that's just me...


    ADC issue - maybe a spike on the A/D input, CMOS latchup or something similar?

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


    Did you find this post helpful? Yes | No

    Default

    What about if you add some clamping diode, but instead of sending them to Vdd, send them to Vref... well a buffered Vref.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Steve

    Good idea ... I've placed a low-leakage BAW62 ... hope my TL431 ref. will agree !!!

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

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


    Did you find this post helpful? Yes | No

    Default Once again ...

    Hi, pros

    One more 18F2520 Out of use after 30 Hours of good work, like the others, and still the same AN2 ADC input leakage current tremendously increasing. ( I repeat here AN1 has EXACTLY the same input circuit : a LM335 fully filtered and clamped : a 10k resistor in series ...).

    EVERYTHING has been carefully verified ... Even Microchip gurus didn't have anything to reply ...

    another " damaged " circuit has been continuously running for more than a year ... all other analog inputs are still Ok !!!

    Has anyone a little idea ???

    Date Markings are 07204AY ...

    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
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    Alain

    I'm not sure if just powering off and on the PIC would solve your problem. Most likely it would if the input protection got clamped on a spike and stayed stuck(latched). I've seen similar behaviour in other hardware with input protections and the usual way to recover was a power cycle. Is it possible for you to rule that out?

    Jerson

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    ... and still the same AN2 ADC input leakage current tremendously increasing.
    Is there any possibility that the CVRCON register is getting modified somewhere along the way?

    Either intentionally ... CVRCON = %11000000

    or Unintentionally ... if you have ASM in your program and are in the wrong bank when writing to address B5.

    If the CVref is turned on, and the CVROE bit is set, the CVref will output on RA2/AN2/VREF-/CVREF.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default Halas ...

    Hi, Darrel and Jerson

    CVRCON would be a good Idea ... but it is cleared at each power-up, and there's no asm ... other than DT Instant interrupts !

    but the ADC still works ( it follows input, but as if a ghost divider was placed : for 3.4 v @ sensor input it "sees " 2.28v - confirmed by the voltmeter placed on the input pin )

    Now, after a power down, the problem comes back , first times after ~ half an hour, then quicker and quicker ... and finally at power up and continuously.

    if re-programming the device ... the problem still is here.

    Note the problem only occurs after ~ 30 Hours of work ... whether the chip stays in sleep mode ( 400 Hours ) or powered down.

    May be I should try another chip ... a 2580 i.e. ...

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

  9. #9
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    Repeated failure after a fixed duration suggests stack problem to me. I can suggest you check the nesting levels in your code and if you have sufficient stack left over for interrupts use. Due to stack failure, the program could be returning to a wrong location and somehow modifying the CVRCON register and turning the AN2 port to output VREF. There may be other symptoms that accompany this.

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


    Did you find this post helpful? Yes | No

    Default

    Hi, Jerson

    as the AN2 input permanently stays "damaged" after some times ... I do not think it could be a stack or soft problem ...
    as I wrote : re-programming the chip do not solve the issue ...

    let's say the program continue to run pretty fine, of course excepting what relies to AN2 input ...

    I must make some tests with RA2 as digital input/output ... just to try to see if something abnormal and verify if it is in the ADC input multiplexer or in the clamping diodes that the problem is ...

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

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


    Did you find this post helpful? Yes | No

    Red face Found something ... BUT ...

    Hi,

    I finally found something ...

    I used AN0 to AN2 ... and AN3 for external reference.

    Innocently ... I had declared AN3 as analog in the ADCON1 register.

    Looking closer to the Datasheet ... The reference DO NOT use the ADC multiplexer path.

    So, I declared AN3 as digital ...

    AND The right AN2 value re-appeared !!!



    BUT that is because I do not use AN's inputs greater than 2 ... I would have to valid AN3 as Analog if using AN4 ...

    So problem is still here.

    I Just found a Turnaround ...

    Alain
    Last edited by Acetronics2; - 24th August 2009 at 16:14.
    ************************************************** ***********************
    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 " !!!
    *****************************************

Similar Threads

  1. Stable Adc Reading Routine
    By gebillpap in forum General
    Replies: 27
    Last Post: - 13th May 2015, 02:18
  2. Battery charger - power supply issue affecting ADC
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 14th December 2008, 00:12
  3. 18F1320 ... Strange Memory
    By Acetronics2 in forum mel PIC BASIC Pro
    Replies: 43
    Last Post: - 9th April 2006, 09:55
  4. ADC value with 2 decimals on an LCD
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2005, 15:54
  5. 12F675 ADC 'Issues'
    By harrisondp in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2005, 01:55

Members who have read this thread : 1

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