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