From 631204a1feffa8cf3795060370b14dfb9f53f533 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 31 Jan 2017 23:15:28 +0100 Subject: WIP --- dac.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 dac.c (limited to 'dac.c') diff --git a/dac.c b/dac.c new file mode 100644 index 0000000..12fb41c --- /dev/null +++ b/dac.c @@ -0,0 +1,13 @@ +#include +#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; +} -- cgit v1.2.3