📄 smpsadc.h
字号:
/*----------------------------------------------------------------------------------------------------*/
#define ADC_GLOB_INT_PR7 0x0007 /* ADC Global conv interrupt priority 7 (High Priority) */
#define ADC_GLOB_INT_PR6 0x0006 /* ADC Global conv interrupt priority 6 */
#define ADC_GLOB_INT_PR5 0x0005 /* ADC Global conv interrupt priority 5 */
#define ADC_GLOB_INT_PR4 0x0004 /* ADC Global conv interrupt priority 4 */
#define ADC_GLOB_INT_PR3 0x0003 /* ADC Global conv interrupt priority 3 */
#define ADC_GLOB_INT_PR2 0x0002 /* ADC Global conv interrupt priority 2 */
#define ADC_GLOB_INT_PR1 0x0001 /* ADC Global conv interrupt priority 1 (Low Priority) */
#define ADC_GLOB_INT_DIS 0x0000 /* ADC Global conv interrupt priority Disabled */
#define ADC_AN1_0_INT_PR7 0x0007 /* ADC Pair 0 (AN1 & AN0) conv interrupt priority 7 (High Priority) */
#define ADC_AN1_0_INT_PR6 0x0006 /* ADC Pair 0 (AN1 & AN0) conv interrupt priority 6 */
#define ADC_AN1_0_INT_PR5 0x0005 /* ADC Pair 0 (AN1 & AN0) conv interrupt priority 5 */
#define ADC_AN1_0_INT_PR4 0x0004 /* ADC Pair 0 (AN1 & AN0) conv interrupt priority 4 */
#define ADC_AN1_0_INT_PR3 0x0003 /* ADC Pair 0 (AN1 & AN0) conv interrupt priority 3 */
#define ADC_AN1_0_INT_PR2 0x0002 /* ADC Pair 0 (AN1 & AN0) conv interrupt priority 2 */
#define ADC_AN1_0_INT_PR1 0x0001 /* ADC Pair 0 (AN1 & AN0) conv interrupt priority 1 (Low Priority) */
#define ADC_AN1_0_INT_DIS 0x0000 /* ADC Pair 0 (AN1 & AN0) conv interrupt priority Disabled */
#define ADC_AN3_2_INT_PR7 0x0007 /* ADC Pair 1 (AN3 & AN2) conv interrupt priority 7 (High Priority) */
#define ADC_AN3_2_INT_PR6 0x0006 /* ADC Pair 1 (AN3 & AN2) conv interrupt priority 6 */
#define ADC_AN3_2_INT_PR5 0x0005 /* ADC Pair 1 (AN3 & AN2) conv interrupt priority 5 */
#define ADC_AN3_2_INT_PR4 0x0004 /* ADC Pair 1 (AN3 & AN2) conv interrupt priority 4 */
#define ADC_AN3_2_INT_PR3 0x0003 /* ADC Pair 1 (AN3 & AN2) conv interrupt priority 3 */
#define ADC_AN3_2_INT_PR2 0x0002 /* ADC Pair 1 (AN3 & AN2) conv interrupt priority 2 */
#define ADC_AN3_2_INT_PR1 0x0001 /* ADC Pair 1 (AN3 & AN2) conv interrupt priority 1 (Low Priority) */
#define ADC_AN3_2_INT_DIS 0x0000 /* ADC Pair 1 (AN3 & AN2) conv interrupt priority Disabled */
#define ADC_AN5_4_INT_PR7 0x0007 /* ADC Pair 2 (AN5 & AN4) conv interrupt priority 7 (High Priority) */
#define ADC_AN5_4_INT_PR6 0x0006 /* ADC Pair 2 (AN5 & AN4) conv interrupt priority 6 */
#define ADC_AN5_4_INT_PR5 0x0005 /* ADC Pair 2 (AN5 & AN4) conv interrupt priority 5 */
#define ADC_AN5_4_INT_PR4 0x0004 /* ADC Pair 2 (AN5 & AN4) conv interrupt priority 4 */
#define ADC_AN5_4_INT_PR3 0x0003 /* ADC Pair 2 (AN5 & AN4) conv interrupt priority 3 */
#define ADC_AN5_4_INT_PR2 0x0002 /* ADC Pair 2 (AN5 & AN4) conv interrupt priority 2 */
#define ADC_AN5_4_INT_PR1 0x0001 /* ADC Pair 2 (AN5 & AN4) conv interrupt priority 1 (Low Priority) */
#define ADC_AN5_4_INT_DIS 0x0000 /* ADC Pair 2 (AN5 & AN4) conv interrupt priority Disabled */
#define ADC_AN7_6_INT_PR7 0x0007 /* ADC Pair 3 (AN7 & AN6) conv interrupt priority 7 (High Priority) */
#define ADC_AN7_6_INT_PR6 0x0006 /* ADC Pair 3 (AN7 & AN6) conv interrupt priority 6 */
#define ADC_AN7_6_INT_PR5 0x0005 /* ADC Pair 3 (AN7 & AN6) conv interrupt priority 5 */
#define ADC_AN7_6_INT_PR4 0x0004 /* ADC Pair 3 (AN7 & AN6) conv interrupt priority 4 */
#define ADC_AN7_6_INT_PR3 0x0003 /* ADC Pair 3 (AN7 & AN6) conv interrupt priority 3 */
#define ADC_AN7_6_INT_PR2 0x0002 /* ADC Pair 3 (AN7 & AN6) conv interrupt priority 2 */
#define ADC_AN7_6_INT_PR1 0x0001 /* ADC Pair 3 (AN7 & AN6) conv interrupt priority 1 (Low Priority) */
#define ADC_AN7_6_INT_DIS 0x0000 /* ADC Pair 3 (AN7 & AN6) conv interrupt priority Disabled */
#define ADC_AN9_8_INT_PR7 0x0007 /* ADC Pair 4 (AN9 & AN8) conv interrupt priority 7 (High Priority) */
#define ADC_AN9_8_INT_PR6 0x0006 /* ADC Pair 4 (AN9 & AN8) conv interrupt priority 6 */
#define ADC_AN9_8_INT_PR5 0x0005 /* ADC Pair 4 (AN9 & AN8) conv interrupt priority 5 */
#define ADC_AN9_8_INT_PR4 0x0004 /* ADC Pair 4 (AN9 & AN8) conv interrupt priority 4 */
#define ADC_AN9_8_INT_PR3 0x0003 /* ADC Pair 4 (AN9 & AN8) conv interrupt priority 3 */
#define ADC_AN9_8_INT_PR2 0x0002 /* ADC Pair 4 (AN9 & AN8) conv interrupt priority 2 */
#define ADC_AN9_8_INT_PR1 0x0001 /* ADC Pair 4 (AN9 & AN8) conv interrupt priority 1 (Low Priority) */
#define ADC_AN9_8_INT_DIS 0x0000 /* ADC Pair 4 (AN9 & AN8) conv interrupt priority Disabled */
#define ADC_AN11_10_INT_PR7 0x0007 /* ADC Pair 5 (AN11 & AN10) conv interrupt priority 7 (High Priority) */
#define ADC_AN11_10_INT_PR6 0x0006 /* ADC Pair 5 (AN11 & AN10) conv interrupt priority 6 */
#define ADC_AN11_10_INT_PR5 0x0005 /* ADC Pair 5 (AN11 & AN10) conv interrupt priority 5 */
#define ADC_AN11_10_INT_PR4 0x0004 /* ADC Pair 5 (AN11 & AN10) conv interrupt priority 4 */
#define ADC_AN11_10_INT_PR3 0x0003 /* ADC Pair 5 (AN11 & AN10) conv interrupt priority 3 */
#define ADC_AN11_10_INT_PR2 0x0002 /* ADC Pair 5 (AN11 & AN10) conv interrupt priority 2 */
#define ADC_AN11_10_INT_PR1 0x0001 /* ADC Pair 5 (AN11 & AN10) conv interrupt priority 1 (Low Priority) */
#define ADC_AN11_10_INT_DIS 0x0000 /* ADC Pair 5 (AN11 & AN10) conv interrupt priority Disabled */
/* *******************A/D Converter Function Prototypes *****************************************/
void OpenSmpsADC(unsigned int config1) __attribute__ ((section (".libperi"))); /* config ADC */
void ConfigSmpsADCPort(unsigned int config1) __attribute__ ((section (".libperi"))); /* config ADC Port Pin*/
void ConfigSmpsADCTrigSource0(unsigned int config1) __attribute__ ((section (".libperi"))); /* config ADC Pair #0 */
void ConfigSmpsADCTrigSource1(unsigned int config1) __attribute__ ((section (".libperi"))); /* config ADC Pair #1 */
void ConfigSmpsADCTrigSource2(unsigned int config1) __attribute__ ((section (".libperi"))); /* config ADC Pair #2 */
void ConfigSmpsADCTrigSource3(unsigned int config1) __attribute__ ((section (".libperi"))); /* config ADC Pair #3 */
void ConfigSmpsADCTrigSource4(unsigned int config1) __attribute__ ((section (".libperi"))); /* config ADC Pair #4 */
void ConfigSmpsADCTrigSource5(unsigned int config1) __attribute__ ((section (".libperi"))); /* config ADC Pair #5 */
void ConvertSmpsADCPair0(void) __attribute__ ((section (".libperi"))); /* Start an A/D conversion for Pair #0 */
void ConvertSmpsADCPair1(void) __attribute__ ((section (".libperi"))); /* Start an A/D conversion for Pair #1 */
void ConvertSmpsADCPair2(void) __attribute__ ((section (".libperi"))); /* Start an A/D conversion for Pair #2 */
void ConvertSmpsADCPair3(void) __attribute__ ((section (".libperi"))); /* Start an A/D conversion for Pair #3 */
void ConvertSmpsADCPair4(void) __attribute__ ((section (".libperi"))); /* Start an A/D conversion for Pair #4 */
void ConvertSmpsADCPair5(void) __attribute__ ((section (".libperi"))); /* Start an A/D conversion for Pair #5 */
void ConfigIntSmpsADCPair0(unsigned int adc_intp, unsigned int adc_intp_priority) __attribute__ ((section (".libperi")));
void ConfigIntSmpsADCPair1(unsigned int adc_intp, unsigned int adc_intp_priority) __attribute__ ((section (".libperi")));
void ConfigIntSmpsADCPair2(unsigned int adc_intp, unsigned int adc_intp_priority) __attribute__ ((section (".libperi")));
void ConfigIntSmpsADCPair3(unsigned int adc_intp, unsigned int adc_intp_priority) __attribute__ ((section (".libperi")));
void ConfigIntSmpsADCPair4(unsigned int adc_intp, unsigned int adc_intp_priority) __attribute__ ((section (".libperi")));
void ConfigIntSmpsADCPair5(unsigned int adc_intp, unsigned int adc_intp_priority) __attribute__ ((section (".libperi")));
void ConfigIntSmpsADCGlobal(unsigned int adc_intp, unsigned int adc_intp_priority) __attribute__ ((section (".libperi")));
unsigned int ReadSmpsADC(unsigned int buff_no) __attribute__ ((section (".libperi"))); /*Read A/D result */
char BusySmpsADCPair0(void) __attribute__ ((section (".libperi"))); /* Check status of A/D conversion Pair #0 */
char BusySmpsADCPair1(void) __attribute__ ((section (".libperi"))); /* Check status of A/D conversion Pair #1 */
char BusySmpsADCPair2(void) __attribute__ ((section (".libperi"))); /* Check status of A/D conversion Pair #2 */
char BusySmpsADCPair3(void) __attribute__ ((section (".libperi"))); /* Check status of A/D conversion Pair #3 */
char BusySmpsADCPair4(void) __attribute__ ((section (".libperi"))); /* Check status of A/D conversion Pair #4 */
char BusySmpsADCPair5(void) __attribute__ ((section (".libperi"))); /* Check status of A/D conversion Pair #5 */
void CloseSmpsADC(void) __attribute__ ((section (".libperi"))); /* Turn off A/D */
/*******************************************Macros******************************************/
/* Macros to Enable/Disable interrupts and set Interrupt priority of ADC Pairs */
#define EnableIntSmpsADCPair0 (IEC2bits.ADCP0IE = 1)
#define DisableIntSmpsADCPair0 (IEC2bits.ADCP0IE = 0)
#define SetPriorityIntSmpsADCPair0(priority) (IPC9bits.ADCP0IP = priority)
#define EnableIntSmpsADCPair1 (IEC2bits.ADCP1IE = 1)
#define DisableIntSmpsADCPair1 (IEC2bits.ADCP1IE = 0)
#define SetPriorityIntSmpsADCPair1(priority) (IPC9bits.ADCP1IP = priority)
#define EnableIntSmpsADCPair2 (IEC2bits.ADCP2IE = 1)
#define DisableIntSmpsADCPair2 (IEC2bits.ADCP2IE = 0)
#define SetPriorityIntSmpsADCPair2(priority) (IPC9bits.ADCP2IP = priority)
#define EnableIntSmpsADCPair3 (IEC2bits.ADCP3IE = 1)
#define DisableIntSmpsADCPair3 (IEC2bits.ADCP3IE = 0)
#define SetPriorityIntSmpsADCPair3(priority) (IPC10bits.ADCP3IP = priority)
#define EnableIntSmpsADCPair4 (IEC2bits.ADCP4IE = 1)
#define DisableIntSmpsADCPair4 (IEC2bits.ADCP4IE = 0)
#define SetPriorityIntSmpsADCPair4(priority) (IPC10bits.ADCP4IP = priority)
#define EnableIntSmpsADCPair5 (IEC2bits.ADCP5IE = 1)
#define DisableIntSmpsADCPair5 (IEC2bits.ADCP5IE = 0)
#define SetPriorityIntSmpsADCPair5(priority) (IPC10bits.ADCP5IP = priority)
#define EnableIntSmpsADCGlobal (IEC0bits.ADIE = 1)
#define DisableIntSmpsADCGlobal (IEC0bits.ADIE = 0)
#define SetPriorityIntSmpsADCGlobal(priority) (IPC2bits.ADIP = priority)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -