-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathADC.h
64 lines (42 loc) · 1.38 KB
/
ADC.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* File: ADC.h
* Author: Mario
*
*/
#ifndef ADC_H
#define ADC_H
#include <stdint.h>
#include <pic16f1709.h>
#define ADC_CLK_FOSCDIV2 0b000
#define ADC_CLK_FOSCDIV4 0b100
#define ADC_CLK_FOSCDIV8 0b001
#define ADC_CLK_FOSCDIV16 0b101
#define ADC_CLK_FOSCDIV32 0b010
#define ADC_CLK_FOSCDIV64 0b110
#define ADC_CLK_FRC 0b111
#define ADC_NVREF_VSS 0
#define ADC_NVREF_EXTERNAL 1
#define ADC_PVREF_VDD 0
#define ADC_PVREF_EXTERNAL 2
#define ADC_FORMAT_LEFT 0
#define ADC_FORMAT_RIGHT 1
#define ADC_CH_AN0 0
#define ADC_CH_AN1 1
#define ADC_CH_AN2 2
#define ADC_CH_AN3 3
#define ADC_CH_AN4 4
#define ADC_CH_AN5 5
#define ADC_CH_AN6 6
#define ADC_CH_AN7 7
#define ADC_CH_AN8 8
#define ADC_CH_AN9 9
#define ADC_CH_AN10 10
#define ADC_CH_AN11 11
/******************************************************************************
* APIs supported by this driver
*****************************************************************************/
void ADC_setup(uint8_t ADC_CLK,uint8_t ADC_PVREF,uint8_t ADC_NVREF);
void ADC_Format(uint8_t ADC_FORMAT);
void ADC_Init_CH(uint8_t ADC_CH);
uint16_t ADC_Read(uint8_t ADC_CH);
#endif /* ADC_H */