aboutsummaryrefslogtreecommitdiffstats
path: root/fw/dac.h
blob: 1882c3e9764755151009f308b70c3a83a343e31a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Microchip MCP4912 10-bit DAC
 *
 * Device: PIC16F1459
 * Compiler: XC8 v3.00
 *
 * Usage:
 *
 * #include <xc.h>
 * #include <stdint.h>
 * #include "types.h"
 * #include "dac.h"
 */

// Pin mapping
#define DAC1_CS_TRIS TRISBbits.TRISB7
#define DAC1_CS LATBbits.LATB7
#define DAC2_CS_TRIS TRISBbits.TRISB5
#define DAC2_CS LATBbits.LATB5

void dacInit(void);

// Set DAC1 VOUTA.
// Only the lower 10 bits are used.
void dacSet1a(U16 level);

// Set DAC1 VOUTB.
// Only the lower 10 bits are used.
void dacSet1b(U16 level);

// Set DAC2 VOUTA.
// Only the lower 10 bits are used.
void dacSet2a(U16 level);

// Set DAC2 VOUTB.
// Only the lower 10 bits are used.
void dacSet2b(U16 level);