element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Pic Microcontrollers Forum Wrong operation when using internally generated negative voltage reference for A/D converter on PIC16F18877
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 5 replies
  • Subscribers 186 subscribers
  • Views 1029 views
  • Users 0 members are here
  • pic16
  • reference
  • adc
Related

Wrong operation when using internally generated negative voltage reference for A/D converter on PIC16F18877

Mila_G
Mila_G over 1 year ago

Hello,

please can you help me with the wrong operation when using internally generated negative voltage reference for A/D converter on PIC16F18877?

I would like to use ADC with references 0.416 V and Vdd (5 V).
It works perfectly when I connect 0.416 V to the Vref- pin (RA2) from an external source.

Then I generate 0.416 V on RA2 from FVR and D/A converter as follows:
  FVRCON = 0x84;
  DAC1CON0 = 0xA8;
  DAC1CON1 = 0x0D;
The DAC also works perfectly and there is about 0.416 V on the Vref- pin (RA2).

But now ADC works only if the negative reference is Gnd. If I switch this from Gnd to Vref- (just by changing ADREF from 0 to 0x10), a failure occurs. The voltage on the RA2 pin changes to 2.1 V (and of course the A/D gives bad results).

Workaround attempts:
- 0.416 V output from DAC to RB7, directly conneted to RA2 via a wire, works just as badly as above.
- After interconnecting via an op amp voltage follower instead of the wire, the A/D starts to work properly.

I assumed the PIC analog circuits were designed for internal connections from the VRef- pin, without any external workaround. Please, advise.

Many thanks.

Mila.

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 1 year ago in reply to Mila_G +1
    You explicitly mention in your workaround attempts: Workaround attempts: - 0.416 V output from DAC to RB7, directly conneted to RA2 via a wire, works just as badly as above. I'm merely explaining the…
  • shabaz
    0 shabaz over 1 year ago

    I didn't read it all, and I have not used a PIC for many years, but looking here:

    image

    image

    image

    image

    If I've understood your requirement right (I might not have - I'm not used to these registers and other detail you mention) it's not a surprise if wiring the DAC to anything requires a buffer. The DAC appears to be composed of a ladder of resistors with no buffer from what I can tell, so yes, you'd need to add your own buffer (e.g. op-amp) when realistically connecting that externally to anything.

    If you mention your actual end requirement (including what you're actually trying to connect the ADC to), and why the external buffer is not usable, then perhaps a different or better solution could be provided.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Mila_G
    0 Mila_G over 1 year ago in reply to shabaz

    I have read the PIC specs carefully: "A buffer must be used on the DAC reference output for external connections to the DAC1OUT1/2 pins.", see above. But I would like to use internal connection! No user external circuitry conneted to the RA2 pin, no wiring, but only internal connection from RA2 to the ADC ref. input inside the MCU.

    Many thanks. Mila.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 1 year ago in reply to Mila_G

    You explicitly mention in your workaround attempts:

    Workaround attempts:
    - 0.416 V output from DAC to RB7, directly conneted to RA2 via a wire, works just as badly as above.

    I'm merely explaining the pointlessness of doing that, since the datasheet makes it clear that would not be possible.

    You have a solution, which is a buffer.

    If you are unwilling to accept a workaround, then I'm no expert here but it's clear from the datasheet that what you're suggesting is not possible.

    Check the diagram below. The negative reference input to the ADC comes from either a pin, or from ground. You can see it in red.

    The DAC output (described as a DAC reference output in the datasheet) in usable internally , as an input to the channel (shown in blue below), not as a input to the ADC negative reference.

    image

    If you provided more information about your actual use-case (what you're measuring for instance) then maybe there are other solutions, but trying to make an internal connection that doesn't exist won't work.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • scottiebabe
    0 scottiebabe over 1 year ago

    You may consider doing the operation digitally. Your increasing the sensitivity 8% or 0.1 bits changing the FSR from 5V to 4.6V. You could subtract 416 mV in software. Sounds like a neat project, best of luck.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • James123
    0 James123 9 months ago

    ADC input signals are really sensitive to source impedance, and it's generally recommended to keep the maximum impedance of your analog signal source around 10 kΩ. If the source impedance is too high, it can lead to longer sampling times, which may mess up your conversion results. This could be one of the issues you're facing when using an internally generated negative voltage reference.
    To avoid problems, make sure your circuit design doesn't introduce extra impedance that could affect the ADC's performance. For more detailed information, check out the PIC16F18877 datasheet, especially the sections on ADC configuration and operation.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube