diff options
Diffstat (limited to 'dac.c')
-rw-r--r-- | dac.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -0,0 +1,13 @@ +#include <xc.h> +#include "dac.h" + +void dac_init(void) { + DAC1REFH = 0x00; + DAC1REFL = 0x00; + DAC1CON0 = 0xa0; /* enable, output on RA2, VDD - VSS */ +} + +inline void dac_set(uint8_t value) { + DAC1REFL = value; + DACLDbits.DAC1LD = 1; +} |