Become a subscriber (Free)

Join 29,000 other subscribers to receive subscriber sale discounts and other free resources.
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine.

Using the internal DAC in a PIC Micro

You have probably got a usable DAC (Digital to Analogue Converter) if your PIC micro has a comparator inside. The voltage reference module in the PIC micro lets you generate a programmable analogue voltage.

"Using the internal DAC in a PIC Micro."

You have probably got a usable DAC If your PIC micro has a comparator inside. The voltage reference module in the PIC micro lets you generate a programmable analogue voltage.

Inside some PICs there is a voltage reference and a comparator.

The normal use for the voltage reference is to connect it to one input of the internal comparator - the other input has the voltage you want the comparator to test.

But for some PIC microcontrollers you can
send this voltage to an external pin for your own use.

Note: Some PIC micros do not let you output the voltage reference to anexternal pin - you just have to read the datasheet (if the see CVRCONhas a control bit labeled CVROE)- if it does then you can use the DAC output.

Although the internal voltage reference is not that versatile (as it was not really intended for external use) it is free, programmable and ready to use.

It has a few limitations but the most important is that you can not drive high currents out so as long as it is driving a high impedance it will be OK.  
Note: If you need to drive more current just buffer it with an opamp.

Normal use of the DAC

The voltage reference module was only intended to generate a voltage for the comparator module but some devices include a control bit to output this voltage to a pin.  

Note: The comparator module is flexible and does not have to use the reference - it can also use the analogue input from a pin.  There's more information on using the comparator here.

Not all devices have this control bit so you have to look in the data sheet to check if your device will output the voltage.  See the next section to look at typical registers in the voltage reference part of the datasheet.

Note: This control was only intended for testing the reference generator but with careful use you can use it in your projects.

PIC DAC control registers


Continue >>>>

New! Comments

Have your say about what you just read! Leave me a comment in the box below.

Claim Your: Useful

"Arduino Software Guide"

   Right Now...

Privacy Policy | Contact | About Me

Site Map | Terms of Use

Visit our Facebook Page:

   Click Here

Sign up for MicroZine
''The'' Microcontroller Newsletter

Enter your first Name and primary email address in the form below:

And receive absolutely FREE a full project for:

"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be  Removed 
at any time.  

It will  NOT be 
available indefinitely SO
To avoid 
disappointment  get it:


Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.

To get exclusive access Enter your first name Name and primary email address Now in the form above.:

But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates

Scroll up to the form above and sign up NOW. Don't forget it's FREE and if you don't like it, you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.

Readers Comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's


- Ranish Pottath

"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan


"Awesome site,
very, very easy and nice
to navigate!"

- Matt

Learn Microcontrollers

"Interested in

Sign up for The
Free 7 day guide:


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."

- Dave


"Your site is a great
and perfect work.

- Suresh


"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.

- Anon

Recent Articles

  1. Eye Tracking System

    Eye tracking : How to detect the gaze of your eye and track where you are looking.

    Read more

  2. DS18B20: How to use it on the Arduino Uno.

    How to Easily Use the DS18B20 Maxim One-Wire thermometer with Arduino example code using both external powered and parasitic powered devices.

    Read more

  3. The best Microcontroller projects and resources.

    Do you want to learn how to use a microcontroller in your electronic projects or do you need inspiration for your next project? If so you have found the right place!

    Read more