|
本帖最后由 qyljzjxl 于 2022-8-6 20:22 編輯
實驗條件:STM32F103最小系統板(網上10幾元那種)、LM35模塊 使用了PB0引腳,ADC采集溫度值。
關鍵程序代碼:
while(1){
/* Printf message with AD value to serial port every 1 second */
AD_value = ADC_ConvertedValue;
AD_value = (AD_value/4096)*3.3*1000/10;
temperature=AD_value;
printf("The current temperature value =%d 0C \r\n", temperature);
delay_ms(1000); /* delay 1000ms */
}
實驗效果:可以輸出溫度,但與實際溫度相差近一倍,不知道怎么回事?求助!
|
|