Trouble with ADC!!!!

Discussion in 'The Projects Forum' started by paddy611, Jun 18, 2014.

  1. paddy611

    Thread Starter Member

    Oct 9, 2012
    I am using MPLAB IDE version 8.60 and CCS compiler for programming of microcontroller PIC18F4520. I have working code which I am using since last 1 year. But suddenly I am facing a weird problem from couple of days. When I am reprogramming the micro controller it is not functioning as expected. The same hardware is working fine with earlier controller which were programmed couple of months back.
    I am using pickit3 and MCD2 for programming micro-controller. Even changed the PC too. I really don't understand what is going wrong.

    I have used MCP3208 ADC for reading 8 different values and display it on 7 segment display.
    During testing I found that when I am putting fixed value (anything in between 0 to 4095) manually, everything seems working fine.
    But when I am reading from actual ADC, it gives error in functioning.
    I have never faced this problem before.
    Please advice.
  2. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    What is the set up for the A/D using the ADCON regs,osc,Tad, on page 225- 228 of the datasheet. Have you set the Vref to internal which AN bit are you using.
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    We will need a bit more information regarding your setup before we can make any educated suggestions.

    What is your hardware connected? Is your ADC returning random results? Last few bits changing rapidly? Not getting any data from ADC? What is your configuration and communication with the ADC?
  4. crazypacov

    New Member

    Jun 16, 2014
    Use Mikrobasic and load ADC example for 18F4520.
    If it still doesn't work, then it is a hardware problem.