8051-ELL库  beta 1.1.6
8051-ELL library API Document Center
STC8x_ADC.h 文件参考
#include "ELL_CORE.h"
#include "STC8Ax_REG.h"
STC8x_ADC.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  ADC_InitType
 ADC初始化结构体句柄,初始化时请定义该句柄,并用其地址来传参。 更多...
 

宏定义

#define PER_LIB_MCU_MUODEL   STC8Ax
 如果没有定义这个宏,默认为STC8Ax。 If the mirco is undefined,select to STC8Ax 更多...
 
#define PER_LIB_ADC_CTRL   1
 如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1" 更多...
 
#define PER_LIB_ADC_INIT_CTRL   1
 如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1" 更多...
 
#define PER_LIB_ADC_NVIC_CTRL   1
 如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1" 更多...
 
#define PER_LIB_ADC_WORK_CTRL   1
 如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1" 更多...
 
#define ADC_Channel_REV   0x0F
 ADC通道15,测量内部参考电压。ADC channel 15 is internal refv voltage. 更多...
 
#define ADC_Channel_P10_8Ax   0x00
 
#define ADC_Channel_P11_8Ax   0x01
 
#define ADC_Channel_P12_8Ax   0x02
 
#define ADC_Channel_P13_8Ax   0x03
 
#define ADC_Channel_P14_8Ax   0x04
 
#define ADC_Channel_P15_8Ax   0x05
 
#define ADC_Channel_P16_8Ax   0x06
 
#define ADC_Channel_P17_8Ax   0x07
 
#define ADC_Channel_P00_8Ax   0x08
 
#define ADC_Channel_P01_8Ax   0x09
 
#define ADC_Channel_P02_8Ax   0x0A
 
#define ADC_Channel_P03_8Ax   0x0B
 
#define ADC_Channel_P04_8Ax   0x0C
 
#define ADC_Channel_P05_8Ax   0x0D
 
#define ADC_Channel_P06_8Ax   0x0E
 
#define ADC_Channel_P30_8G1K08A   0x00
 
#define ADC_Channel_P31_8G1K08A   0x01
 
#define ADC_Channel_P32_8G1K08A   0x02
 
#define ADC_Channel_P33_8G1K08A   0x03
 
#define ADC_Channel_P54_8G1K08A   0x04
 
#define ADC_Channel_P55_8G1K08A   0x05
 
#define ADC_Channel_P10_8G1K08_T   0x00
 
#define ADC_Channel_P11_8G1K08_T   0x01
 
#define ADC_Channel_P12_8G1K08_T   0x02
 
#define ADC_Channel_P13_8G1K08_T   0x03
 
#define ADC_Channel_P14_8G1K08_T   0x04
 
#define ADC_Channel_P15_8G1K08_T   0x05
 
#define ADC_Channel_P16_8G1K08_T   0x06
 
#define ADC_Channel_P17_8G1K08_T   0x07
 
#define ADC_Channel_P30_8G1K08_T   0x08
 
#define ADC_Channel_P31_8G1K08_T   0x09
 
#define ADC_Channel_P32_8G1K08_T   0x0A
 
#define ADC_Channel_P33_8G1K08_T   0x0B
 
#define ADC_Channel_P34_8G1K08_T   0x0C
 
#define ADC_Channel_P35_8G1K08_T   0x0D
 
#define ADC_Channel_P36_8G1K08_T   0x0E
 
#define ADC_Channel_P10_8G2K64S2_S4   0x00
 
#define ADC_Channel_P11_8G2K64S2_S4   0x01
 
#define ADC_Channel_P12_8G2K64S2_S4   0x02
 
#define ADC_Channel_P13_8G2K64S2_S4   0x03
 
#define ADC_Channel_P14_8G2K64S2_S4   0x04
 
#define ADC_Channel_P15_8G2K64S2_S4   0x05
 
#define ADC_Channel_P16_8G2K64S2_S4   0x06
 
#define ADC_Channel_P17_8G2K64S2_S4   0x07
 
#define ADC_Channel_P00_8G2K64S2_S4   0x08
 
#define ADC_Channel_P01_8G2K64S2_S4   0x09
 
#define ADC_Channel_P02_8G2K64S2_S4   0x0A
 
#define ADC_Channel_P03_8G2K64S2_S4   0x0B
 
#define ADC_Channel_P04_8G2K64S2_S4   0x0C
 
#define ADC_Channel_P05_8G2K64S2_S4   0x0D
 
#define ADC_Channel_P06_8G2K64S2_S4   0x0E
 
#define ADC_Channel_P10_8H1K28   0x00
 
#define ADC_Channel_P11_8H1K28   0x01
 
#define ADC_Channel_P12_8H1K28   0x02
 
#define ADC_Channel_P13_8H1K28   0x03
 
#define ADC_Channel_P14_8H1K28   0x04
 
#define ADC_Channel_P15_8H1K28   0x05
 
#define ADC_Channel_P16_8H1K28   0x06
 
#define ADC_Channel_P17_8H1K28   0x07
 
#define ADC_Channel_P00_8H1K28   0x08
 
#define ADC_Channel_P01_8H1K28   0x09
 
#define ADC_Channel_P02_8H1K28   0x0A
 
#define ADC_Channel_P03_8H1K28   0x0B
 
#define ADC_Channel_P10_8H1K08   0x00
 
#define ADC_Channel_P11_8H1K08   0x01
 
#define ADC_Channel_P30_8H1K08   0x08
 
#define ADC_Channel_P31_8H1K08   0x09
 
#define ADC_Channel_P32_8H1K08   0x0A
 
#define ADC_Channel_P33_8H1K08   0x0B
 
#define ADC_Channel_P34_8H1K08   0x0C
 
#define ADC_Channel_P35_8H1K08   0x0D
 
#define ADC_Channel_P36_8H1K08   0x0E
 
#define ADC_Channel_P10_8H3K64S2_S4   0x00
 
#define ADC_Channel_P11_8H3K64S2_S4   0x01
 
#define ADC_Channel_P12_8H3K64S2_S4   0x02
 
#define ADC_Channel_P16_8H3K64S2_S4   0x06
 
#define ADC_Channel_P17_8H3K64S2_S4   0x07
 
#define ADC_Channel_P00_8H3K64S2_S4   0x08
 
#define ADC_Channel_P01_8H3K64S2_S4   0x09
 
#define ADC_Channel_P02_8H3K64S2_S4   0x0A
 
#define ADC_Channel_P03_8H3K64S2_S4   0x0B
 
#define ADC_Channel_P04_8H3K64S2_S4   0x0C
 
#define ADC_Channel_P05_8H3K64S2_S4   0x0D
 
#define ADC_Channel_P06_8H3K64S2_S4   0x0E
 
#define ADC_Channel_P10_8H8K64U_2K64T   0x00
 
#define ADC_Channel_P11_8H8K64U_2K64T   0x01
 
#define ADC_Channel_P54_8H8K64U_2K64T   0x02
 
#define ADC_Channel_P13_8H8K64U_2K64T   0x03
 
#define ADC_Channel_P14_8H8K64U_2K64T   0x04
 
#define ADC_Channel_P15_8H8K64U_2K64T   0x05
 
#define ADC_Channel_P16_8H8K64U_2K64T   0x06
 
#define ADC_Channel_P17_8H8K64U_2K64T   0x07
 
#define ADC_Channel_P00_8H8K64U_2K64T   0x08
 
#define ADC_Channel_P01_8H8K64U_2K64T   0x09
 
#define ADC_Channel_P02_8H8K64U_2K64T   0x0A
 
#define ADC_Channel_P03_8H8K64U_2K64T   0x0B
 
#define ADC_Channel_P04_8H8K64U_2K64T   0x0C
 
#define ADC_Channel_P05_8H8K64U_2K64T   0x0D
 
#define ADC_Channel_P06_8H8K64U_2K64T   0x0E
 
#define ADC_GET_CHANNEL()   (ADC_CONTR & 0x0F)
 ADC获取当前采集通道宏函数。 更多...
 
#define ADC_CHANGE_CHANNEL(channel)
 ADC改变采集通道宏函数。 更多...
 
#define ADC_GET_FLAG()   (ADC_CONTR & 0x20)
 ADC获取采集完成(中断)标志位宏函数。 更多...
 
#define ADC_CLEAR_FLAG()   do{ADC_CONTR &= 0xDF;}while(0)
 ADC清除采集完成(中断)标志位宏函数。 更多...
 
#define NVIC_ADC_CTRL(run)   do{EADC = run;}while(0)
 ADC中断开关控制宏函数。 更多...
 
#define NVIC_ADC_PRI(pri)
 ADC选择中断优先级宏函数。 更多...
 

枚举

enum  ADCAcc_Type {
  ADC_Acc_12Bits = 0x00 , ADC_Acc_11Bits = 0x01 , ADC_Acc_10Bits = 0x02 , ADC_Acc_9Bits = 0x03 ,
  ADC_Acc_8Bits = 0x04
}
 ADC采集精度枚举体。 更多...
 
enum  ADCAlign_Type { ADC_Left = 0x00 , ADC_Right = 0x01 }
 ADC输出结果对齐方向枚举体。 更多...
 

函数

FSCSTATE ADC_Init (const ADC_InitType *adcx)
 ADC外设初始化函数。 更多...
 
uint16_t ADC_Get_Sample (uint8_t channel, ADCAcc_Type acc)
 ADC获取采集结果函数(查询法)。 更多...
 
uint16_t ADC_Get_Sample_Interrupt (ADCAcc_Type acc)
 ADC获取采集结果函数(中断法)。 更多...
 
FSCSTATE NVIC_ADC_Init (NVICPri_Type pri, BOOL run)
 ADC中断初始化函数。 更多...
 

宏定义说明

◆ ADC_CHANGE_CHANNEL

#define ADC_CHANGE_CHANNEL (   channel)
值:
do{ \
ADC_CONTR = (ADC_CONTR & 0xF0) | (channel); \
}while(0)
sfr ADC_CONTR
Definition: STC15x_REG.h:767

ADC改变采集通道宏函数。

ADC change the macro function of the current acquisition channel.

参数
[in]channelADC采集通道,不同的芯片型号,通道有所不同,请查看头文件的宏定义。 ADC acquisition channel, different chip models, the channel is different, please check the macro definition of the header file

◆ ADC_Channel_P00_8Ax

#define ADC_Channel_P00_8Ax   0x08

STC8A: ADC通道8。ADC channel 8.

◆ ADC_Channel_P00_8G2K64S2_S4

#define ADC_Channel_P00_8G2K64S2_S4   0x08

8G2K64: ADC通道8。ADC channel 8.

◆ ADC_Channel_P00_8H1K28

#define ADC_Channel_P00_8H1K28   0x08

8H1K28: ADC通道8。ADC channel 8.

◆ ADC_Channel_P00_8H3K64S2_S4

#define ADC_Channel_P00_8H3K64S2_S4   0x08

8H3K64: ADC通道8。ADC channel 8.

◆ ADC_Channel_P00_8H8K64U_2K64T

#define ADC_Channel_P00_8H8K64U_2K64T   0x08

8H8K/2K: ADC通道8。ADC channel 8.

◆ ADC_Channel_P01_8Ax

#define ADC_Channel_P01_8Ax   0x09

STC8A: ADC通道9。ADC channel 9.

◆ ADC_Channel_P01_8G2K64S2_S4

#define ADC_Channel_P01_8G2K64S2_S4   0x09

8G2K64: ADC通道9。ADC channel 9.

◆ ADC_Channel_P01_8H1K28

#define ADC_Channel_P01_8H1K28   0x09

8H1K28: ADC通道9。ADC channel 9.

◆ ADC_Channel_P01_8H3K64S2_S4

#define ADC_Channel_P01_8H3K64S2_S4   0x09

8H3K64: ADC通道9。ADC channel 9.

◆ ADC_Channel_P01_8H8K64U_2K64T

#define ADC_Channel_P01_8H8K64U_2K64T   0x09

8H8K/2K: ADC通道9。ADC channel 9.

◆ ADC_Channel_P02_8Ax

#define ADC_Channel_P02_8Ax   0x0A

STC8A: ADC通道10。ADC channel 10.

◆ ADC_Channel_P02_8G2K64S2_S4

#define ADC_Channel_P02_8G2K64S2_S4   0x0A

8G2K64: ADC通道10。ADC channel 10.

◆ ADC_Channel_P02_8H1K28

#define ADC_Channel_P02_8H1K28   0x0A

8H1K28: ADC通道10。ADC channel 10.

◆ ADC_Channel_P02_8H3K64S2_S4

#define ADC_Channel_P02_8H3K64S2_S4   0x0A

8H3K64: ADC通道10。ADC channel 10.

◆ ADC_Channel_P02_8H8K64U_2K64T

#define ADC_Channel_P02_8H8K64U_2K64T   0x0A

8H8K/2K: ADC通道10。ADC channel 10.

◆ ADC_Channel_P03_8Ax

#define ADC_Channel_P03_8Ax   0x0B

STC8A: ADC通道11。ADC channel 11.

◆ ADC_Channel_P03_8G2K64S2_S4

#define ADC_Channel_P03_8G2K64S2_S4   0x0B

8G2K64: ADC通道11。ADC channel 11.

◆ ADC_Channel_P03_8H1K28

#define ADC_Channel_P03_8H1K28   0x0B

8H1K28: ADC通道11。ADC channel 11.

◆ ADC_Channel_P03_8H3K64S2_S4

#define ADC_Channel_P03_8H3K64S2_S4   0x0B

8H3K64: ADC通道11。ADC channel 11.

◆ ADC_Channel_P03_8H8K64U_2K64T

#define ADC_Channel_P03_8H8K64U_2K64T   0x0B

8H8K/2K: ADC通道11。ADC channel 11.

◆ ADC_Channel_P04_8Ax

#define ADC_Channel_P04_8Ax   0x0C

STC8A: ADC通道12。ADC channel 12.

◆ ADC_Channel_P04_8G2K64S2_S4

#define ADC_Channel_P04_8G2K64S2_S4   0x0C

8G2K64: ADC通道12。ADC channel 12.

◆ ADC_Channel_P04_8H3K64S2_S4

#define ADC_Channel_P04_8H3K64S2_S4   0x0C

8H3K64: ADC通道12。ADC channel 12.

◆ ADC_Channel_P04_8H8K64U_2K64T

#define ADC_Channel_P04_8H8K64U_2K64T   0x0C

8H8K/2K: ADC通道12。ADC channel 12.

◆ ADC_Channel_P05_8Ax

#define ADC_Channel_P05_8Ax   0x0D

STC8A: ADC通道13。ADC channel 13.

◆ ADC_Channel_P05_8G2K64S2_S4

#define ADC_Channel_P05_8G2K64S2_S4   0x0D

8G2K64: ADC通道13。ADC channel 13.

◆ ADC_Channel_P05_8H3K64S2_S4

#define ADC_Channel_P05_8H3K64S2_S4   0x0D

8H3K64: ADC通道13。ADC channel 13.

◆ ADC_Channel_P05_8H8K64U_2K64T

#define ADC_Channel_P05_8H8K64U_2K64T   0x0D

8H8K/2K: ADC通道13。ADC channel 13.

◆ ADC_Channel_P06_8Ax

#define ADC_Channel_P06_8Ax   0x0E

STC8A: ADC通道14。ADC channel 14.

◆ ADC_Channel_P06_8G2K64S2_S4

#define ADC_Channel_P06_8G2K64S2_S4   0x0E

8G2K64: ADC通道14。ADC channel 14.

◆ ADC_Channel_P06_8H3K64S2_S4

#define ADC_Channel_P06_8H3K64S2_S4   0x0E

8H3K64: ADC通道14。ADC channel 14.

◆ ADC_Channel_P06_8H8K64U_2K64T

#define ADC_Channel_P06_8H8K64U_2K64T   0x0E

8H8K/2K: ADC通道14。ADC channel 14.

◆ ADC_Channel_P10_8Ax

#define ADC_Channel_P10_8Ax   0x00

STC8A: ADC通道0。ADC channel 0.

◆ ADC_Channel_P10_8G1K08_T

#define ADC_Channel_P10_8G1K08_T   0x00

8G1K08: ADC通道0。ADC channel 0.

◆ ADC_Channel_P10_8G2K64S2_S4

#define ADC_Channel_P10_8G2K64S2_S4   0x00

8G2K64: ADC通道0。ADC channel 0.

◆ ADC_Channel_P10_8H1K08

#define ADC_Channel_P10_8H1K08   0x00

8H1K28: ADC通道0。ADC channel 0.

◆ ADC_Channel_P10_8H1K28

#define ADC_Channel_P10_8H1K28   0x00

8H1K28: ADC通道0。ADC channel 0.

◆ ADC_Channel_P10_8H3K64S2_S4

#define ADC_Channel_P10_8H3K64S2_S4   0x00

8H3K64: ADC通道0。ADC channel 0.

◆ ADC_Channel_P10_8H8K64U_2K64T

#define ADC_Channel_P10_8H8K64U_2K64T   0x00

8H8K/2K: ADC通道0。ADC channel 0.

◆ ADC_Channel_P11_8Ax

#define ADC_Channel_P11_8Ax   0x01

STC8A: ADC通道1。ADC channel 1.

◆ ADC_Channel_P11_8G1K08_T

#define ADC_Channel_P11_8G1K08_T   0x01

8G1K08: ADC通道1。ADC channel 1.

◆ ADC_Channel_P11_8G2K64S2_S4

#define ADC_Channel_P11_8G2K64S2_S4   0x01

8G2K64: ADC通道1。ADC channel 1.

◆ ADC_Channel_P11_8H1K08

#define ADC_Channel_P11_8H1K08   0x01

8H1K28: ADC通道1。ADC channel 1.

◆ ADC_Channel_P11_8H1K28

#define ADC_Channel_P11_8H1K28   0x01

8H1K28: ADC通道1。ADC channel 1.

◆ ADC_Channel_P11_8H3K64S2_S4

#define ADC_Channel_P11_8H3K64S2_S4   0x01

8H3K64: ADC通道1。ADC channel 1.

◆ ADC_Channel_P11_8H8K64U_2K64T

#define ADC_Channel_P11_8H8K64U_2K64T   0x01

8H8K/2K: ADC通道1。ADC channel 1.

◆ ADC_Channel_P12_8Ax

#define ADC_Channel_P12_8Ax   0x02

STC8A: ADC通道2。ADC channel 2.

◆ ADC_Channel_P12_8G1K08_T

#define ADC_Channel_P12_8G1K08_T   0x02

8G1K08: ADC通道2。ADC channel 2.

◆ ADC_Channel_P12_8G2K64S2_S4

#define ADC_Channel_P12_8G2K64S2_S4   0x02

8G2K64: ADC通道2。ADC channel 2.

◆ ADC_Channel_P12_8H1K28

#define ADC_Channel_P12_8H1K28   0x02

8H1K28: ADC通道2。ADC channel 2.

◆ ADC_Channel_P12_8H3K64S2_S4

#define ADC_Channel_P12_8H3K64S2_S4   0x02

8H3K64: ADC通道2。ADC channel 2.

◆ ADC_Channel_P13_8Ax

#define ADC_Channel_P13_8Ax   0x03

STC8A: ADC通道3。ADC channel 3.

◆ ADC_Channel_P13_8G1K08_T

#define ADC_Channel_P13_8G1K08_T   0x03

8G1K08: ADC通道3。ADC channel 3.

◆ ADC_Channel_P13_8G2K64S2_S4

#define ADC_Channel_P13_8G2K64S2_S4   0x03

8G2K64: ADC通道3。ADC channel 3.

◆ ADC_Channel_P13_8H1K28

#define ADC_Channel_P13_8H1K28   0x03

8H1K28: ADC通道3。ADC channel 3.

◆ ADC_Channel_P13_8H8K64U_2K64T

#define ADC_Channel_P13_8H8K64U_2K64T   0x03

8H8K/2K: ADC通道3。ADC channel 3.

◆ ADC_Channel_P14_8Ax

#define ADC_Channel_P14_8Ax   0x04

STC8A: ADC通道4。ADC channel 4.

◆ ADC_Channel_P14_8G1K08_T

#define ADC_Channel_P14_8G1K08_T   0x04

8G1K08: ADC通道4。ADC channel 4.

◆ ADC_Channel_P14_8G2K64S2_S4

#define ADC_Channel_P14_8G2K64S2_S4   0x04

8G2K64: ADC通道4。ADC channel 4.

◆ ADC_Channel_P14_8H1K28

#define ADC_Channel_P14_8H1K28   0x04

8H1K28: ADC通道4。ADC channel 4.

◆ ADC_Channel_P14_8H8K64U_2K64T

#define ADC_Channel_P14_8H8K64U_2K64T   0x04

8H8K/2K: ADC通道4。ADC channel 4.

◆ ADC_Channel_P15_8Ax

#define ADC_Channel_P15_8Ax   0x05

STC8A: ADC通道5。ADC channel 5.

◆ ADC_Channel_P15_8G1K08_T

#define ADC_Channel_P15_8G1K08_T   0x05

8G1K08: ADC通道5。ADC channel 5.

◆ ADC_Channel_P15_8G2K64S2_S4

#define ADC_Channel_P15_8G2K64S2_S4   0x05

8G2K64: ADC通道5。ADC channel 5.

◆ ADC_Channel_P15_8H1K28

#define ADC_Channel_P15_8H1K28   0x05

8H1K28: ADC通道5。ADC channel 5.

◆ ADC_Channel_P15_8H8K64U_2K64T

#define ADC_Channel_P15_8H8K64U_2K64T   0x05

8H8K/2K: ADC通道5。ADC channel 5.

◆ ADC_Channel_P16_8Ax

#define ADC_Channel_P16_8Ax   0x06

STC8A: ADC通道6。ADC channel 6.

◆ ADC_Channel_P16_8G1K08_T

#define ADC_Channel_P16_8G1K08_T   0x06

8G1K08: ADC通道6。ADC channel 6.

◆ ADC_Channel_P16_8G2K64S2_S4

#define ADC_Channel_P16_8G2K64S2_S4   0x06

8G2K64: ADC通道6。ADC channel 6.

◆ ADC_Channel_P16_8H1K28

#define ADC_Channel_P16_8H1K28   0x06

8H1K28: ADC通道6。ADC channel 6.

◆ ADC_Channel_P16_8H3K64S2_S4

#define ADC_Channel_P16_8H3K64S2_S4   0x06

8H3K64: ADC通道6。ADC channel 6.

◆ ADC_Channel_P16_8H8K64U_2K64T

#define ADC_Channel_P16_8H8K64U_2K64T   0x06

8H8K/2K: ADC通道6。ADC channel 6.

◆ ADC_Channel_P17_8Ax

#define ADC_Channel_P17_8Ax   0x07

STC8A: ADC通道7。ADC channel 7.

◆ ADC_Channel_P17_8G1K08_T

#define ADC_Channel_P17_8G1K08_T   0x07

8G1K08: ADC通道7。ADC channel 7.

◆ ADC_Channel_P17_8G2K64S2_S4

#define ADC_Channel_P17_8G2K64S2_S4   0x07

8G2K64: ADC通道7。ADC channel 7.

◆ ADC_Channel_P17_8H1K28

#define ADC_Channel_P17_8H1K28   0x07

8H1K28: ADC通道7。ADC channel 7.

◆ ADC_Channel_P17_8H3K64S2_S4

#define ADC_Channel_P17_8H3K64S2_S4   0x07

8H3K64: ADC通道7。ADC channel 7.

◆ ADC_Channel_P17_8H8K64U_2K64T

#define ADC_Channel_P17_8H8K64U_2K64T   0x07

8H8K/2K: ADC通道7。ADC channel 7.

◆ ADC_Channel_P30_8G1K08_T

#define ADC_Channel_P30_8G1K08_T   0x08

8G1K08: ADC通道8。ADC channel 8.

◆ ADC_Channel_P30_8G1K08A

#define ADC_Channel_P30_8G1K08A   0x00

8G1K08A: ADC通道0。ADC channel 0.

◆ ADC_Channel_P30_8H1K08

#define ADC_Channel_P30_8H1K08   0x08

8H1K28: ADC通道8。ADC channel 8.

◆ ADC_Channel_P31_8G1K08_T

#define ADC_Channel_P31_8G1K08_T   0x09

8G1K08: ADC通道9。ADC channel 9.

◆ ADC_Channel_P31_8G1K08A

#define ADC_Channel_P31_8G1K08A   0x01

8G1K08A: ADC通道1。ADC channel 1.

◆ ADC_Channel_P31_8H1K08

#define ADC_Channel_P31_8H1K08   0x09

8H1K28: ADC通道9。ADC channel 9.

◆ ADC_Channel_P32_8G1K08_T

#define ADC_Channel_P32_8G1K08_T   0x0A

8G1K08: ADC通道10。ADC channel 10.

◆ ADC_Channel_P32_8G1K08A

#define ADC_Channel_P32_8G1K08A   0x02

8G1K08A: ADC通道2。ADC channel 2.

◆ ADC_Channel_P32_8H1K08

#define ADC_Channel_P32_8H1K08   0x0A

8H1K28: ADC通道10。ADC channel 10.

◆ ADC_Channel_P33_8G1K08_T

#define ADC_Channel_P33_8G1K08_T   0x0B

8G1K08: ADC通道11。ADC channel 11.

◆ ADC_Channel_P33_8G1K08A

#define ADC_Channel_P33_8G1K08A   0x03

8G1K08A: ADC通道3。ADC channel 3.

◆ ADC_Channel_P33_8H1K08

#define ADC_Channel_P33_8H1K08   0x0B

8H1K28: ADC通道11。ADC channel 11.

◆ ADC_Channel_P34_8G1K08_T

#define ADC_Channel_P34_8G1K08_T   0x0C

8G1K08: ADC通道12。ADC channel 12.

◆ ADC_Channel_P34_8H1K08

#define ADC_Channel_P34_8H1K08   0x0C

8H1K28: ADC通道12。ADC channel 12.

◆ ADC_Channel_P35_8G1K08_T

#define ADC_Channel_P35_8G1K08_T   0x0D

8G1K08: ADC通道13。ADC channel 13.

◆ ADC_Channel_P35_8H1K08

#define ADC_Channel_P35_8H1K08   0x0D

8H1K28: ADC通道13。ADC channel 13.

◆ ADC_Channel_P36_8G1K08_T

#define ADC_Channel_P36_8G1K08_T   0x0E

8G1K08: ADC通道14。ADC channel 14.

◆ ADC_Channel_P36_8H1K08

#define ADC_Channel_P36_8H1K08   0x0E

8H1K28: ADC通道14。ADC channel 14.

◆ ADC_Channel_P54_8G1K08A

#define ADC_Channel_P54_8G1K08A   0x04

8G1K08A: ADC通道4。ADC channel 4.

◆ ADC_Channel_P54_8H8K64U_2K64T

#define ADC_Channel_P54_8H8K64U_2K64T   0x02

8H8K/2K: ADC通道2。ADC channel 2.

◆ ADC_Channel_P55_8G1K08A

#define ADC_Channel_P55_8G1K08A   0x05

8G1K08A: ADC通道5。ADC channel 5.

◆ ADC_Channel_REV

#define ADC_Channel_REV   0x0F

ADC通道15,测量内部参考电压。ADC channel 15 is internal refv voltage.

◆ ADC_CLEAR_FLAG

#define ADC_CLEAR_FLAG ( )    do{ADC_CONTR &= 0xDF;}while(0)

ADC清除采集完成(中断)标志位宏函数。

ADC clears macro function of acquisition completion (interrupt) flag bit.

◆ ADC_GET_CHANNEL

#define ADC_GET_CHANNEL ( )    (ADC_CONTR & 0x0F)

ADC获取当前采集通道宏函数。

ADC obtains the macro function of the current acquisition channel.

◆ ADC_GET_FLAG

#define ADC_GET_FLAG ( )    (ADC_CONTR & 0x20)

ADC获取采集完成(中断)标志位宏函数。

ADC obtains macro function of acquisition completion (interrupt) flag bit.

返回
[bit] 完成(中断)标志位。Completion (interrupt) flag bit.

◆ NVIC_ADC_CTRL

#define NVIC_ADC_CTRL (   run)    do{EADC = run;}while(0)

ADC中断开关控制宏函数。

ADC interrupt switch control macro function.

参数
[in]run使能控制位。Enable control bit.

◆ NVIC_ADC_PRI

#define NVIC_ADC_PRI (   pri)
值:
do{ \
IPH = (IPH & 0xDF) | ((pri & 0x02) << 4); \
IP = (IP & 0xDF) | ((pri & 0x01) << 5); \
}while(0)
sfr IPH
Definition: STC15x_REG.h:212
sfr IP
Definition: STC15x_REG.h:210

ADC选择中断优先级宏函数。

ADC select interrupt priority macro function.

参数
[in]pri中断优先级。 Priority of interrupt.

◆ PER_LIB_ADC_CTRL

#define PER_LIB_ADC_CTRL   1

如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1"

◆ PER_LIB_ADC_INIT_CTRL

#define PER_LIB_ADC_INIT_CTRL   1

如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1"

◆ PER_LIB_ADC_NVIC_CTRL

#define PER_LIB_ADC_NVIC_CTRL   1

如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1"

◆ PER_LIB_ADC_WORK_CTRL

#define PER_LIB_ADC_WORK_CTRL   1

如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1"

◆ PER_LIB_MCU_MUODEL

#define PER_LIB_MCU_MUODEL   STC8Ax

如果没有定义这个宏,默认为STC8Ax。 If the mirco is undefined,select to STC8Ax

枚举类型说明

◆ ADCAcc_Type

ADC采集精度枚举体。

This is the ADC acquisition accuracy enumeration.

枚举值
ADC_Acc_12Bits 

ADC12位采集精度。ADC12 bit acquisition accuracy.

ADC_Acc_11Bits 

ADC11位采集精度。ADC 11 bit acquisition accuracy.

ADC_Acc_10Bits 

ADC10位采集精度。ADC 10 bit acquisition accuracy.

ADC_Acc_9Bits 

ADC9位采集精度。ADC 9 bit acquisition accuracy.

ADC_Acc_8Bits 

ADC8位采集精度。ADC 8 bit acquisition accuracy.

◆ ADCAlign_Type

ADC输出结果对齐方向枚举体。

The ADC output is aligned with the direction enumerator.

枚举值
ADC_Left 

ADC采集数据左对齐。The data is aligned to the left.

ADC_Right 

ADC采集数据右对齐。The data is aligned to the right.

函数说明

◆ ADC_Get_Sample()

uint16_t ADC_Get_Sample ( uint8_t  channel,
ADCAcc_Type  acc 
)

ADC获取采集结果函数(查询法)。

This is a ADC get sample function.

参数
[in]channelADC采集通道,不同的芯片型号,通道有所不同,请查看头文件的宏定义。 ADC acquisition accuracy, different chip models, the highest accuracy is different, please check the macro definition of the header file.
[in]accADC采集精度,不同的芯片型号,最高精度有所不同,请查看头文件的宏定义。 ADC acquisition accuracy, different chip models, the highest accuracy is different, please check the macro definition of the header file.
返回
uint16_t 返回采集到的ADC值。Returns the collected ADC value.
注解
默认使用的是右对齐操作,如果读取的数据是左对齐,需要开发者自己处理。

◆ ADC_Get_Sample_Interrupt()

uint16_t ADC_Get_Sample_Interrupt ( ADCAcc_Type  acc)

ADC获取采集结果函数(中断法)。

This is a ADC get sample function in interrupt.

参数
[in]accADC采集精度,不同的芯片型号,最高精度有所不同,请查看头文件的宏定义。 ADC acquisition accuracy, different chip models, the highest accuracy is different, please check the macro definition of the header file.
返回
uint16_t 返回采集到的ADC值。Returns the collected ADC value.
注解
默认使用的是右对齐操作,如果读取的数据是左对齐,需要开发者自己处理。

◆ ADC_Init()

FSCSTATE ADC_Init ( const ADC_InitType adcx)

ADC外设初始化函数。

This is a ADC peripheral init function.

参数
[in]adcxADC结构体句柄,初始化时请定义该句柄,并用其地址来传参。 ADC structure handle. When initializing, please define the handle and use its address to pass parameters.
返回
FSC_SUCCESS 成功。success.
FSC_FAIL 失败。fail.

◆ NVIC_ADC_Init()

FSCSTATE NVIC_ADC_Init ( NVICPri_Type  pri,
BOOL  run 
)

ADC中断初始化函数。

This is a ADC priority initialization function.

参数
[in]pri中断优先级。Interrupt priority.
[in]run中断运行控制位。Interrupt operation control bit.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.