I'm trying to get the 10-bit DAC of the PIC16F1778 working and am not being
successful. Has anyone used this, or similar? I'm scoping the output pin
and getting nothing. Below is my code. Any push in the right direction is
appreciated.
Regards,
Mike
--
include 16f1778 -- target PICmicro
--
pragma target clock 8_000_000 -- oscillator frequency
--
pragma target OSC INTOSC_NOCLKOUT -- internal oscillator
pragma target PLLEN DISABLED -- PLL off
pragma target CLKOUTEN DISABLED -- no clock output
pragma target WDT DISABLED -- watchdog off
pragma target BROWNOUT DISABLED -- no brownout reset
pragma target FCMEN DISABLED -- no clock monitoring
pragma target IESO DISABLED -- no int/ext osc switching
pragma target LVP DISABLED -- low voltage programming
off
pragma target MCLR INTERNAL -- internal reset
--
--
OSCCON_SCS = 0 -- select primary oscillator
OSCCON_IRCF = 0b1110 -- 8 MHz
OSCCON_SPLLEN = FALSE -- software PLL off
--
enable_digital_io() -- make all pins digital I/O
--
LATA = 0
LATB = 0
LATC = 0
TRISA = 0
TRISB = 0
TRISC = 0
DAC1REFL = 0
DAC1REFH = 0
DAC1CON0 = 0b1010_0000 -- DAC on and output to the pin
--
var byte c = 0
--
forever loop
for 255 using c loop
DAC1REFL = c
DACLD_DAC1LD = true
_usec_delay(100_000)
end loop
end loop
--
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jallib/58400326-e940-49be-894a-87edbc767a72n%40googlegroups.com.