Best Microcontroller Projects


[?] Subscribe To
This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Add to Newsgator
Subscribe with Bloglines

Home
LCD-KEYS OnePort
PIC Introduction
PIC Programming
Programmer Types
PIC Programmer
Schematic Tool
PIC Projects
PIC Tutorials
C Course
Digital Downloads
Store
My SECRET
Oscilloscopes
Contact Me
About Me
Terms of Use
Search This Site
Freebies
Articles
Problem?-Solution
MicroBlog
Books
Resource Links
Site Map
Your Projects
Video du Jour
Rant/Rave
Privacy Policy


<<<<< Back to  

PIC registers for DAC control


Sign up for MicroZine:
''The'' Microcontroller Newsletter


:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Enter your first Name and primary email address in the form above:

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:

Now



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.



Social Bookmarking
Click & Add:
add to BlinkBlink
add to Del.icio.usDel.icio.us
add to DiggDigg
add to FurlFurl
add to GoogleGoogle
add to SimpySimpy
add to SpurlSpurl
Bookmark at TechnoratiTechnorati
add to YahooY! MyWeb
Find out Why social bookmarking is
Useful For You.

Readers comments

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

SUPERB and FANTASTIC."


- Ranish Pottath


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

- Milan

bursach<at>gmail.com

Learn PIC C Now
Wondering how to program your next project using C and need a great start?


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


- Matt
matt_tr<at>
wolf359.cjb.net


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


- Dave

de_scott<at>bellsouth.net

Learn Microcontrollers
"Interested in
Microcontrollers?"


Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"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.
Regards."


- Anon





"Configuring the PIC pin for DAC output"

DAC output pin RA2/AN2/CVREF/VREF
(Pin Block Diagram).


The block diagram below shows pin 1 of the 16F88  - it's useful to see how the hardware is connected so you can set up the pin correctly for voltage reference output.


RA2/AN2/CVREF/VREF pin (pin1 16F88)
pin 1 of 16F88 RA2

It shows that the voltage reference is directly connected to the pin so all you need to do to output a voltage is to set the TRISA bit (to 1) - to make the P & N fets go into high impedance i.e. drawing no current - and set CVROE (1) obviously CVREN has to be 1 to enable the voltage reference.  As well as this set ANSEL (1) (see below).

Note: The TRIS control circuit not shown on this diagram.
  • ANSEL for pin RA2 to 1
  • TRISA for pin RA2 to 1
  • CVROE to 1
  • CVREN to 1

Controlling ANSEL

The RA2 pin is the only pin that is analogue I/O (because of the voltage reference output) all other analogue pins are analogue input only.  

This register (ANSEL) defaults to all ones so they are all analogue I/(O) at power up but it's best to control the values so you know what they should be.

Making it go.

Measured values

Vsupply = 4.93V

(i) CVRR = 1 (Low range)
Outputs 16 voltage steps from 0.01V to 3.05V

(ii) CVRR = 0 (high range)
Outputs 16 voltage steps from 1.22V to 3.53V

Data sheet information

Low volt range

(i) for CVRR=1
0.00 CVRSRC to 0.625 CVRSRC with CVRSRC/24 step size
CVREF = (VR<3:0>/24) • (CVRSRC)
and

High volt range

(ii) for CVRR=0
0.25 CVRSRC to 0.72 CVRSRC with CVRSRC/32 step size
CVREF = 1/4 • (CVRSRC) + (VR3:VR0/32) • (CVRSRC)

So for the second range (higher voltage output range) you can have finer step sizes and a slightly higher maximum voltage output (but the minimum is not zero).

CVRSRC = 4.93V

Measured (i) 0.01V to  3.05V
For (i) Range is 0V to  4.93*0.625 = 3.08V
Measured (ii) 1.22V to  3.53V
For (ii) Range is 0.25*4.93 = 1.23V to  4.93*0.72 = 3.55V

This shows the practical measurements match the datasheet predictions very well.

Speed

Running at 8MHz with the following code produces a pulse width for an output step of 11us (90kHz) - obviously this will change depending on the code used but you could probably create a simple signal generator.

Note: You can increase the output speed by using a 20MHz crystal - for the current project it is using the internal oscillator at 8MHz so there's room for improvement.

Setting up and controlling the DAC in C
 
Continue>>>>






Jump from DAC page to
Home page: Best-Microcontroller-Projects.com



Don't forget to Sign Up for your

Microcontroller Newsletter

With "Essential tips and techniques",

..."New Site Info" and more...

Including a free project :

How to drive an LCD and 12key keypad using "Only One 8 Bit Port" with no interface logic!...

(Works for any microcontroller)

This costs you : Nothing...
Just fill out the form below and you'll get full C source code and project schematic and description.



Email

Name

Then

Don't worry -- your e-mail address is totally secure.
I promise to use it only to send you MicroZine.
Google
 
  Best Microcontroller projects.