aboutsummaryrefslogtreecommitdiff
path: root/dac.c
blob: 12fb41c35f81ab337ae0ece888254922381ea7ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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;
}