3 * A/D conversion module library header
18 /* interrupt on/off flag */
19 #define ADC_INT_OFF 0x00
20 #define ADC_INT_ON 0x01
24 #define ADC_FRM_RJUST 0x80
25 #define ADC_FRM_LJUST 0x00
27 /* oscillator frequency */
28 #define ADC_FOSC_2 0x00
29 #define ADC_FOSC_4 0x10
30 #define ADC_FOSC_16 0x11
31 #define ADC_FOSC_32 0x02
32 #define ADC_FOSC_64 0x12
33 #define ADC_FOSC_RC 0x03
36 /* channel selection */
37 #define ADC_CHN_1 0x00
38 #define ADC_CHN_2 0x01
39 #define ADC_CHN_3 0x03
40 #define ADC_CHN_4 0x04
41 #define ADC_CHN_5 0x05
42 #define ADC_CHN_6 0x06
43 #define ADC_CHN_7 0x07
46 /* reference and pin configuration */
47 #define ADC_CFG_8A_0R 0x00
48 #define ADC_CFG_7A_1R 0x01
49 #define ADC_CFG_5A_0R 0x02
50 #define ADC_CFG_4A_1R 0x03
51 #define ADC_CFG_3A_0R 0x04
52 #define ADC_CFG_2A_1R 0x05
53 #define ADC_CFG_0A_0R 0x06
54 #define ADC_CFG_6A_2R 0x08
55 #define ADC_CFG_6A_0R 0x09
56 #define ADC_CFG_5A_1R 0x0a
57 #define ADC_CFG_4A_2R 0x0b
58 #define ADC_CFG_3A_2R 0x0c
59 #define ADC_CFG_2A_2R 0x0d
60 #define ADC_CFG_1A_0R 0x0e
61 #define ADC_CFG_1A_2R 0x0f
64 void adc_open(unsigned char channel, unsigned char fosc, unsigned char pcfg, unsigned char config);
74 void adc_setchannel(unsigned char channel);