00001
00022
00023
00024
00025 #ifndef _COMPARATOR_DRV_H_
00026 #define _COMPARATOR_DRV_H_
00027
00028
00029
00030
00034
00035
00039
00040
00041
00045 #define Comp_0_config() \
00046 AC0CON = (COMP0_ENABLE_BIT_VALUE<<AC0EN)| \
00047 (COMP0_INTERRUPT_ENABLE<<AC0IE)| \
00048 (COMP0_INTERRUPT_SELECT<<AC0IS0)| \
00049 (COMP_CLOCK_SOURCE<<ACCKSEL)| \
00050 (COMP0_NEG_INPUT_SELECT<<AC0M0);
00052
00053
00054
00058 #define Comp_1_config() \
00059 AC1CON = (COMP1_ENABLE_BIT_VALUE<<AC1EN)| \
00060 (COMP1_INTERRUPT_ENABLE<<AC1IE)| \
00061 (COMP1_INTERRUPT_SELECT<<AC1IS0)| \
00062 (COMP1_CAPTURE_ENABLE<<AC1ICE)| \
00063 (COMP1_NEG_INPUT_SELECT<<AC1M0);
00065
00066
00070 #define Comp_2_config() \
00071 AC2CON = (COMP2_ENABLE_BIT_VALUE<<AC1EN)| \
00072 (COMP2_INTERRUPT_ENABLE<<AC1IE)| \
00073 (COMP2_INTERRUPT_SELECT<<AC1IS0)| \
00074 (COMP2_NEG_INPUT_SELECT<<AC1M0);
00076
00077
00078
00082 #define Comp_3_config() \
00083 AC3CON = (COMP3_ENABLE_BIT_VALUE<<AC1EN)| \
00084 (COMP3_INTERRUPT_ENABLE<<AC1IE)| \
00085 (COMP3_INTERRUPT_SELECT<<AC1IS0)| \
00086 (COMP3_NEG_INPUT_SELECT<<AC1M0);
00088
00089
00090
00091
00092
00093 #define COMP_DISABLE 0
00094 #define COMP_ENABLE 1
00095
00096 #define COMP_DISABLE_INTERRUPT 0
00097 #define COMP_ENABLE_INTERRUPT 1
00098
00099 #define COMP_INTERRUPT_ON_OUTPUT_TOGGLE 0
00100 #define COMP_INTERRUPT_ON_OUTPUT_FALLING_EDGE 2
00101 #define COMP_INTERRUPT_ON_OUTPUT_RISING_EDGE 3
00102
00103 #define COMP_USE_VREF_DIV640 0
00104 #define COMP_USE_VREF_DIV320 1
00105 #define COMP_USE_VREF_DIV213 2
00106 #define COMP_USE_VREF_DIV160 3
00107 #define COMP_USE_BANDGAP 4
00108 #define COMP_USE_DAC_OUTPUT 5
00109 #define COMP_USE_NEGATIVE_PIN 6
00110
00111 #define COMP_CLOCK_IO 0
00112 #define COMP_CLOCK_PLL 1
00113
00114 #define COMP_CAPTURE_DISABLE 0
00115 #define COMP_CAPTURE_ENABLE 1
00116
00118
00119 #endif // _COMPARATOR_DRV_H_
00120