|
为什么我的STM8S的AD在0V时为0X25~0X30?
[复制链接]
为什么我的STM8S的AD在0V时为0X25~0X30?电压加大还是数据大. 请版主指点. 配置: void ADC_config(void) { GPIO_Init_TypeDef GPIO_InitStructure; ADC_Init_TypeDef ADC_InitStructure; /* Init GPIO for ADC */ GPIO_InitStructure.GPIO_Mode = GPIO_MODE_IN_FL_NO_IT ; GPIO_InitStructure.GPIO_Pin = ( VTV | VEC | Z_V | XYV | FXV | VC | VD | V01 ); GPIO_Init(PBPORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_MODE_IN_FL_NO_IT ; GPIO_InitStructure.GPIO_Pin = ( V02 | ADCELSE ); GPIO_Init(PEPORT, &GPIO_InitStructure); ADC_DeInit(); enableInterrupts(); /* Initialize right data alignement */ ADC_InitStructure.ADC_Align = ADC_ALIGN_RIGHT; /* Disable the schmitt trigger on channel 9 */ ADC_InitStructure.ADC_SchmittTriggerChannel = ADC_SCHMITTTRIG_ALL; ADC_InitStructure.ADC_SchmittTriggerState = DISABLE; /* Analog channel to convert */ ADC_InitStructure.ADC_Channel = ADC_CHANNEL_1; /* Select Conversion mode */ ADC_InitStructure.ADC_ConversionMode = ADC_CONVERSIONMODE_SINGLE; /* Init ADC peripheral according to ADC_InitStructure */ ADC_Init(&ADC_InitStructure); /* Enable EOC interrupt */ } 读是这样的: ADC_StartConversion(); Delay(100); Conversion_Value = ADC_GetConversionValue(); ADC_ClearFlag();
|
|