 |
 |
| View previous topic :: View next topic |
| Author |
Message |
stivio
Joined: 03 Jan 2026 Posts: 2
|
| 12F1572 DAC problems |
Posted: Sat Jan 03, 2026 6:39 am |
|
|
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
|
|
Posted: Sat Jan 03, 2026 7:20 am |
|
|
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. |
|
 |
|
|
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
|