blob: 8653f967ee3ed588e1c5697ba4deb44e38d1f66e (
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
37
|
#include <xc.h>
#include <stdint.h>
#include "system.h"
#include "types.h"
#include "spi.h"
#include "dac.h"
void
main(void) {
sysInit();
spiInit();
dacInit();
dacSet1a((U16){0u, 252u}); // 1.23V
for (;;) {
}
}
void
__interrupt() isr(void) {
static U8 ctr = 0u;
static U16 level = {0, 0};
if (TMR1IF) {
ctr++;
if (ctr == 23u) { // 1s period
ctr = 0u;
dacSet1a(level);
addU16(&level, 50u);
}
TMR1IF = 0;
}
}
|