Help with setting adcon1 for 16f877


Results 1 to 9 of 9

Threaded View

  1. #4
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie

    I've had some time now to play with my circuit and try a few things to try and get it working properly. I have all but exhausted all my options to figuring out what is wrong, short of trying to find another suitable voltage reference chip that might work.

    I have a question to ask now if you have the time to answer. First off, your suggested %10000101 for 10-bit ADC and %00000101 for 8-bit ADC seem to function ok for AN0 & AN1 although I get the same abnormity on ANO that I thought would be corrected by adding the voltage reference chip. The problem I was trying to rectify with the LM336BZ-5 is that when I run the circuit on the TX then the variable on AN0 is always 4 to 5 numbers less than it is when running on the batteries. I was thinking that the difference was being caused by the different voltages, as the 7805 outputs 4.98 vdc and the MIC2954-03BZ gives me 4.99 vdc output. This 5 number difference is maintained through-out the whole range that the variable changes. Another point of using the reference chip is that when I measure the voltage of the circuit when it's being run on batteries and when the micro is in the sleep mode, then the voltage fluctuates from about 5.21 vdc up to 5.43 vdc which is another reason I decided to use a voltage reference chip.

    I have my circuit wired so that when it is powered from the mains that a relay is powered up which cuts out the battery power and the pic runs off the TX. When the TX is unplugged then the relay is deactivated and the batteries take over to power the pic circuit. I figured a relay was a good option to also disconnect the voltage divider from the batteries, keeping it isolated when running off the mains to prevent draining the batteries without the need to take the batteries out whenever the mains are powering the circuit.

    I can't seem to get my reference chip to perform as anticipated, I've included a schematics for how I have it wired to the pic just in case I missed out on something obvious but I'm pretty sure I have it wired correctly.

    With the way that I have the LM336BZ-5 reference chip wired, and using a pic pin to supply the positive, it will only adjust from a minimum of 4.10 volts to a maximum of 4.33 volts. I thought I would be able to adjust it to 4.096 Volts?

    Any suggestions on what I'm doing wrong here?

    Thanks
    jessey
    Attached Images Attached Images  

Similar Threads

  1. OSCON setting for 18F4520
    By Dennis in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 29th November 2009, 15:18
  2. PBP 2.60 & ADCON1 problem
    By bitbangerbob in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st October 2009, 12:06
  3. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 14:01
  4. code size VS speed optimization setting?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th April 2008, 14:38
  5. Setting up ADC....
    By robertmark68 in forum General
    Replies: 1
    Last Post: - 11th August 2006, 18:08

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