CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

12F1572 DAC problems

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stivio



Joined: 03 Jan 2026
Posts: 2

View user's profile Send private message

12F1572 DAC problems
PostPosted: Sat Jan 03, 2026 6:39 am     Reply with quote

Hello all,

I am trying to get something from the DAC of the 12F1572, but nothing works.

Now, I am trying to get only DAC function but still dont work.
The output is connected to a multimeter, not loaded.

Tnak you for your help!

the code:

[code]

#include <12F1572.h>
#fuses NOWDT,NOMCLR,NOPROTECT,NOLVP,INTRC_IO
#use delay (internal=8MHz)

void main()
{
setup_oscillator( OSC_8MHZ );

OUTPUT_A(0b00000000);

setup_vref (VREF_ON | VREF_ADC_OFF | VREF_COMP_DAC_4V096 | TEMPERATURE_INDICATOR_DISABLED);

setup_dac(DAC_OUTPUT | DAC_FVR);



while(TRUE)
{
dac_write (20);

delay_ms(5);

}

}
[/code]
stivio



Joined: 03 Jan 2026
Posts: 2

View user's profile Send private message

PostPosted: Sat Jan 03, 2026 7:20 am     Reply with quote

The original problem solved:

Even the PICKIT3 is loading the output, so after removing connection, I get voltage from the DAC.

But some intresting news...

In case, when the DAC_FVR selected in setup, the register value is (A2) 10100010.
In case of DAC_VDD the output is 10100000.

according the datasheet it should be 10101000 and 10100000.

(my curiosity... I just checked... In case of DAC_VREF 10100001 ->it should be 10100100)

The wrong 2 bits are modified in the register, so needed to change them in the header files.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group