Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 21st January 2004, 03:13 PM   #1
Default PIC with built in DAC

Hi,

I am using a PIC16C782 which has a built in Digital to Analog converter. However i have not been able to find any commands which refer to setting up or reading the DAC.
If anyone could help it would be most appreciated.

Cheers

Matt
SocMatt is offline  
Old 21st January 2004, 04:00 PM   #2
Default Re: PIC with built in DAC

Quote:
Originally Posted by SocMatt
Hi,

I am using a PIC16C782 which has a built in Digital to Analog converter. However i have not been able to find any commands which refer to setting up or reading the DAC.
If anyone could help it would be most appreciated.

Cheers

Matt
I've never seen or used one, but pages 81-83 of the datasheets explain how to use it, including sample code for setting it up and outputing a value.

It looks pretty straight forward, I've copied the actual code below.

Code:
BANKSEL TRISB ; Select bank 1
BSF TRISB,1 ; Set RB1 input
BSF ANSEL,1 ; Set RB1 as analog
BANKSEL DACON0 ; Select Bank 2
CLRF DAC ; DAC to 00
MOVLW B’11000000’ ; Enable DAC output
MOVWF DACON0 ; Set REF = VDD

MOVLW DAC_VALUE
MOVWF DAC ; Set DAC output
Nigel Goodwin is offline  
Reply

Tags
built, dac, pic

Thread Tools
Display Modes




All times are GMT. The time now is 01:16 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker