从手册上看的是: /* Temperature sensor calibration value address */ #define TEMP110_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FFFF7C2)) #define TEMP30_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FFFF7B8)) #define VDD_CALIB ((uint16_t) (330)) #define VDD_APPLI ((uint16_t) (300)) int32_t temperature; /* will contain the temperature in degree Celsius */ temperature = (((int32_t) ADC1->DR * VDD_APPLI / VDD_CALIB) - (int32_t) *TEMP30_CAL_ADDR ); temperature = temperature * (int32_t)(110 - 30); temperature = temperature / (int32_t)(*TEMP110_CAL_ADDR - *TEMP30_CAL_ADDR); temperature = temperature + 30; 用这个测出来是70多度 在网上搜的是图片上那样测出来是40多度,到底哪个可以用啊? ADC初始化: ADC_InitStructure.ADC_Resolution=ADC_Resolution_12b; ADC_InitStructure.ADC_ContinuousConvMode=ENABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge=ADC_ExternalTrigConvEdge_None; ADC_InitStructure.ADC_ExternalTrigConv=DISABLE; ADC_InitStructure.ADC_DataAlign=ADC_DataAlign_Right; ADC_InitStructure.ADC_ScanDirection=ADC_ScanDirection_Upward; ADC_Init(ADC1, &ADC_InitStructure); ADC_ITConfig(ADC1, ADC_IT_EOC, ENABLE); ADC_Cmd(ADC1, ENABLE); ADC_TempSensorCmd(ENABLE); ADC_ChannelConfig(ADC1, ADC_Channel_16, ADC_SampleTime_239_5Cycles); ADC_StartOfConversion(ADC1); |
上面的那几个参考值可以在数据手册上找到,具体值你要看看你用的那个芯片的数据手册上的值是多少。
好像还有2个校准值可以使用,具体的值保存在了内部flash的上,
请问一下怎样把TS_CAL1和TS_CAL2的值取出来呢?