|
- typedef struct
- {
- u8 ADC_Px; //, ADC_P10 ~ ADC_P17,ADC_P1_All
- u8 ADC_Speed; // ADC_90T,ADC_180T,ADC_360T,ADC_540T
- u8 ADC_Power; //ADC ENABLE,DISABLE
- u8 ADC_AdjResult; //ADC ADC_RES_H2L8,ADC_RES_H8L2
- u8 ADC_Polity; // PolityHigh,PolityLow
- u8 ADC_Interrupt; // ENABLE,DISABLE
- } ADC_InitTypeDef;
- void ADC_config(void)
- {
- ADC_InitTypeDef ADC_InitStructure; //結(jié)構(gòu)定義
- ADC_InitStructure.ADC_Px = ADC_P10 | ADC_P11 | ADC_P12; //設(shè)置要做ADC的IO, ADC_P10 ~ ADC_P17(或操作),ADC_P1_All
- ADC_InitStructure.ADC_Speed = ADC_360T; //ADC速度 ADC_90T,ADC_180T,ADC_360T,ADC_540T
- ADC_InitStructure.ADC_Power = ENABLE; //ADC功率允許/關(guān)閉 ENABLE,DISABLE
- ADC_InitStructure.ADC_AdjResult = ADC_RES_H8L2; //ADC結(jié)果調(diào)整, ADC_RES_H2L8,ADC_RES_H8L2
- ADC_InitStructure.ADC_Polity = PolityLow; //優(yōu)先級(jí)設(shè)置 PolityHigh,PolityLow
- ADC_InitStructure.ADC_Interrupt = DISABLE; //中斷允許 ENABLE,DISABLE
- ADC_Inilize(&ADC_InitStructure); //初始化
- ADC_PowerControl(ENABLE); //單獨(dú)的ADC電源操作函數(shù), ENABLE或DISABLE
- }
復(fù)制代碼 |
|