PIC12F1822 need help with D/A, fixed voltage regulator. 6 lines of code.

Thread Starter

kirkmans

Joined Mar 13, 2011
4
Fixed Voltage Regulator and D/A converter set-up help needed.
Micro is PIC12F1822.
My first time using both of these modules.
I want to read the FVR voltage, but it doesn't come out on a pin.
I'm trying to read it thru the D/A output pin

I set the Fixed Voltage Regulator to 2.048 volts
movlw b'11001010' ;Enabled, ready, 2.048 V to DAC and CPS
movwf FVRCON ;(in bank 2)

Next, I set it to be the reference to the D/A converter and set the D/A converter to max.
Per data sheet, Vout should equal Vsource, the FVR.
movlw b'01101000' ;DAC disabled, positive source FVR selected, out on DACOUT pin
movwf DACCON0 ;(in bank 2) Reference equation 17-1 in data sheet.
movlw b'00011111' ;Voltage output selected to be max
movwf DACCON1 ;(in bank 2)

The DACOUT pin (RA0 pin 7) stays at 0 volts. I'm expecting 2.048.
According to the data sheet section 17.3, the DAC output should override the digital output buffer.
It doesn't. I still can get digital output on RA0 if I pulse it in software.

I'm asking this because a function that uses both the FVR and D/A isn't working. I suspect something is
set up wrong, but can't figure out what.
 

AlbertHall

Joined Jun 4, 2014
12,072
Welcome to AAC @kirkmans
Please post the whole code - config, includes, everything.
Put CODE before your your code and /CODE, both within square brackets, after it. This makes it easier for us to read.
 

Thread Starter

kirkmans

Joined Mar 13, 2011
4
The wrong bank was selected. It works when I'm actually in bank 2.
No need to post the code.
This post can be considered closed.
 
Top